Re: Hello again Al or anybody
- Posted by Al Getz <Xaxo at aol.com> Apr 11, 2006
- 480 views
don cole wrote: > > Al Getz wrote: > > > > Hi there Don, > > > > > > I can tell you that the ID's created with WinClass are not compatible > > with those of WinLib, however, the 'window handles' are! This means > > you can use many function calls for windows using WinClass even if the > > windows were created with WinLib (now that you've got the two working > > together). The only trick is to get the actual handle using > > WinLibs way of doing this -- last time i checked it was getHandle(), but > > who knows by now :) Once you get the handle you can pass it to > > WinClass functions (in many cases). > > > > An example would be with the SendMessage() call: > > > > atom hWnd,retv > > hWnd=WinLib:getHandle(winlib_id) --or however you are calling this > > retv=win:SendMessage(hWnd,MESSAGE,wParam,lParam) --a WinClass lib call > > > > Note that you MUST use the winlib's id, not one created by winclass. > > > > To get the handle for a window in WinClass, use: > > atom hWnd > > hWnd=Track:GetHandle(winclass_id) > > > > It's also possible to create an ID in WinClass that refers to a window > > created with WinLib, but to do this you'd have to create the window > > in WinLib and then port it to another ID in WinClass by calling the > > GetNextID() function in ReTrack.ew, then call SetHandle(), then > > SetParentID(). You'd have to decide which lib to handle events with > > i guess. Note however i havent actually tried this (yet) hee hee. > > > > > > Al > > > > > > My bumper sticker: "I brake for LED's" > > > > From "Black Knight": > > "I can live with losing the good fight, > > but i can not live without fighting it". > > "Well on second thought, maybe not." > > > Hello Al thank you for your response, > > If I do convert a Winlib ID to a WinClass ID I'm still going to come up with > an integer larger than 0. Which brings me back to the problem in line 152 of > reTrack: > subscript value 17(or whatever the winClass ID is) is out of bounds reading > from sequence of length 0. > > This is called from: > retv=win:InvalidateRect(GetHandle(Window1),0,1)--Window1 is created with > winlib32.ew. > in SetWindowGraphics > > > Don Cole Hi again Don, Well, if you had called GetNextID() that shouldnt be the case, because GetNextID() calls NextID(), which either creates a new sequence element (in Win_Handles) or reuses a previous element that is no longer in use. Thus, calling InvalidateRect should work ok because GetNextID() forces the sequence in question to be long enough to support the ID passed to GetHandle(). Another way of saying this is that the ID returned from GetNextID() will never be higher than the length of that sequence. I'm also assuming nothing was modified in ReTrack.ew of course. Here's a quick example... Before the next Create call Win_Handles might be {}. Now the function call: Window1=Window:Create(...) Now Window1=1 and Win_Handles={12345678} which is one window handle stored and the window id is 1. If another Create is called then the next id would be 2, and Win_Handles={12345678,87654321} (the second handle is stored in position #2 of the sequence.) This means when GetHandle is called it will always have a handle to return, even if it's zero because RemoveID was perhaps called. Hope this makes sense Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's" From "Black Knight": "I can live with losing the good fight, but i can not live without fighting it". "Well on second thought, maybe not."