1. sendMessage() problem

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

new topic     » topic index » view message » categorize

2. Re: sendMessage() problem

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: sendMessage() problem

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

new topic     » goto parent     » topic index » view message » categorize

4. Re: sendMessage() problem

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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu