1. sendMessage() problem
- Posted by Alexander Toresson <alexander.toresson at gmail.com> Apr 21, 2005
- 532 views
I would like to send a message to a control that is not created through win32lib, and therefore hasn't got any win32lib id (which sendMessage is expecting), but I know the windows id. Is this possible without altering win32lib.ew? Regards, Alexander Toresson
2. Re: sendMessage() problem
- Posted by Phil Russell <pg_russell at lineone.net> Apr 21, 2005
- 491 views
Alexander Toresson wrote: > > I would like to send a message to a control that is not created through > win32lib, and > therefore hasn't got any win32lib id (which sendMessage is expecting), but I > know the > windows id. Is this possible without altering win32lib.ew? > > Regards, Alexander Toresson > Hi Alexander, Try: return = w32Func( xSendMessage, {<window id>, <msg id>, <wParam>, <lParam>} ) xSendMessage is already defined in win32lib. Regards, Phil
3. Re: sendMessage() problem
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Apr 21, 2005
- 500 views
Alexander Toresson wrote: > > I would like to send a message to a control that is not created through > win32lib, and > therefore hasn't got any win32lib id (which sendMessage is expecting), but I > know the > windows id. Is this possible without altering win32lib.ew? Yes. You basically have to wrap the call to Sendmessage. If you look at the sendMessage() in win32lib, probably all you'd need to do is supply a handle rather than a win32lib id. This should work for you:
global function sendMessageHwnd( atom hwnd, atom pCmd, object wParm, object lParm ) -- send a command to a control atom memset atom lRetVal memset = 0 -- Check for text being passed. if sequence(wParm) then memset = w32new_memset() wParm = w32acquire_mem(memset, wParm) end if if sequence(lParm) then if memset = 0 then memset = w32new_memset() end if lParm = w32acquire_mem(memset, lParm) end if lRetVal = c_func( qSendMessage, { hwnd, pCmd, wParm, lParm } ) if memset != 0 then w32release_mem(memset) end if return lRetVal end function
Matt Lewis
4. Re: sendMessage() problem
- Posted by Alexander Toresson <alexander.toresson at gmail.com> Apr 21, 2005
- 525 views
Matt Lewis wrote: > > Alexander Toresson wrote: > > > > I would like to send a message to a control that is not created through > > win32lib, and > > therefore hasn't got any win32lib id (which sendMessage is expecting), but I > > know the > > windows id. Is this possible without altering win32lib.ew? > > Yes. You basically have to wrap the call to Sendmessage. If you look > at the sendMessage() in win32lib, probably all you'd need to do is > supply a handle rather than a win32lib id. This should work for you: > }}} <eucode> > global function sendMessageHwnd( atom hwnd, atom pCmd, object wParm, object > lParm ) > -- send a command to a control > atom memset > atom lRetVal > > memset = 0 > -- Check for text being passed. > if sequence(wParm) then > memset = w32new_memset() > wParm = w32acquire_mem(memset, wParm) > end if > if sequence(lParm) then > if memset = 0 then > memset = w32new_memset() > end if > lParm = w32acquire_mem(memset, lParm) > end if > > lRetVal = c_func( qSendMessage, { hwnd, pCmd, wParm, lParm } ) > if memset != 0 then > w32release_mem(memset) > end if > return lRetVal > end function > </eucode> {{{ > > Matt Lewis > The problem with that is that qSendMessage is local to win32lib.ew. I tried using xSendMessage instead (as proposed by Phil Russell), replacing the line containing qSendMessage with: lRetVal = w32Func( xSendMessage, {hwnd, pCmd, wParm, lParm} ) And it works fine. Thank you, Matt and Phil! Regards, Alexander Toresson