Re: edita 0.1.6/WM_COPYDATA experts?
- Posted by Al Getz <Xaxo at aol.com> May 27, 2005
- 472 views
Pete Lomax wrote: > > On Thu, 26 May 2005 03:53:10 -0700, Al Getz <guest at RapidEuphoria.com> > wrote: > > >First off, Microsoft recommends treating the pointer passed in the > >COPYDATA struct to be 'read only' by the called process. Unfortunately > >i dont know the reason behind them including this 'fact' in the > >documentation so i cant say when it will work otherwise. > > OK, so "how long" followed by "here's some memory" as used throughout > windows API is wrong; instead of > }}} <eucode> > elsif msg = CD_FILL then > return {length(filepaths[currfile])+length(filenames[currfile])} > elsif msg = CD_FILE then > -- len = peek4u(CDS+4) > mem = peek4u(CDS+8) > poke(mem,filepaths[currfile]&filenames[currfile]) > return {CD_EDITA} > <font color="#330033"></eucode> {{{ </font> > You are saying I need something like: > }}} <eucode> > elsif msg = CD_FILE then > len = peek4u(CDS+4) > if len!=4 then ?9/0 end if > mem = peek4u(CDS+8) > hwnd=peek4u(mem) > len = length(filepaths[currfile])+length(filenames[currfile]) > mem=allocate_StringZ(filepaths[currfile]&filenames[currfile]) > poke4(CDS,{CD_FILN,len,mem}) -- /OR/ my own version > void=c_func(xSendMessage,{hwnd, WM_COPYDATA, NULL, CDS}) > return {CD_EDITA} > <font color="#330033"></eucode> {{{ </font> > > Drat, and double drat. I really didn't want to force a handler be in > place in a requesting application... > > So I guess my question now is what is the *easiest/quickest* way to > set up a "handler" to receive the reply? And, indeed, get a suitable > hwnd to pass. What if the app is a simple console app? What if I don't > want to "include" win32lib/arwen? > > >Second, the source of the filename problem might be because Eu's > >'current_dir()' function does not always work as expected. > Thanks, but I really doubt it has anything to do with current_dir(). > If filepaths[currfile] was wrong the file would not/could not have > been opened in the first place. I also doubt that in it's wildest > misworkings, current_dir() would return "Edita - D:\edita..." > > Regards, > Pete > PS It fek'n works on win98; I fek'n hate M$ fek'n about like this for > no fek'n reason. ARGH! > PPS This is building into an unanswerable argument for Eu having > threads, not that it matters much to me as Rob would never concede > that anyone would ever want a shrouded component, let alone such a > strange thing as a shrouded thread. > > Hi Pete, Yeah, it's strange, but my guess is that the receiving process might move the memory once it's gotten so the pointer would no longer be valid to the sending process, but that's just a guess. Well, i guess there are many ways to handle having the sending process receive a reply... File mapping Having the second process send a reply via a wm_copydata call Registry BTW with CD you could send the required hWnd to the receiving process right? just by including it as part of the data sent...you just cant send memory pointers. Maybe even simply writing the data to a simple text file during the message request (before returning). You could even write the data in the form of an Eu sequence like {"Filename",123,456,hWnd} and have the calling process read the file after the copydata message returns. You'd have to figure out some common protocol for finding the filename but i dont think it would be too hard to do. I'd be interested to find out which method you choose when you decide... Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"