1. Referencing control id's in DLLs

Can a dll create controls on a window?

Here is an example program that doesn't work.

--prog.dll as eu source

include win32lib.ew

global procedure add( integer win_id )
          VOID = create( Button, "button", win_id, 10, 10, 50, 30, 0 )
end procedure

--end prog.dll

--prog.exw

include win32lib.ew
without warning

constant win = create(Window,"win",0,Default,Default,100,100,0)

constant dll = open_dll( "test.dll" )
         xAdd = define_c_proc( dll, "add", { C_INT } )
c_proc( xAdd, {win} )

WinMain( win, Normal )

--end prog.exw

I would like for this to have created a window with a button in it.  Can I 
do that at all in a dll?

Thanks,
Phil

new topic     » topic index » view message » categorize

2. Re: Referencing control id's in DLLs

----- Original Message ----- 
From: "Philip D." <philip1987 at hotmail.com>
To: <EUforum at topica.com>
Subject: Referencing control id's in DLLs


> 
> 
> Can a dll create controls on a window?
> 
> Here is an example program that doesn't work.
> 
> --prog.dll as eu source
> 
> include win32lib.ew
> 
> global procedure add( integer win_id )
>           VOID = create( Button, "button", win_id, 10, 10, 50, 30, 0 )
> end procedure
> 
> --end prog.dll
> 
> --prog.exw
> 
> include win32lib.ew
> without warning
> 
> constant win = create(Window,"win",0,Default,Default,100,100,0)
> 
> constant dll = open_dll( "test.dll" )
>          xAdd = define_c_proc( dll, "add", { C_INT } )
> c_proc( xAdd, {win} )
> 
> WinMain( win, Normal )
> 
> --end prog.exw
> 
> I would like for this to have created a window with a button in it.  Can I 
> do that at all in a dll?
> 

Not using win32lib (or most other Eu libraries). The reason is that the
variables used by win32lib in the prog.dll would be a different set of varaibles
used by the win32lib in prog.exw. Thus when you pass the 'win' value to the dll,
the dll does not know about the window you are passing as a parent to the button.

Because the DLL and the Eu app are to different and independant programs, the
'include' does NOT refer to the same space.

To do this sort of thing, you would have to resort to low level API calls and
look after any housekeeping yourself.

-- 
Derek

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

3. Re: Referencing control id's in DLLs

Try this:

    xAdd = define_c_proc( dll, "add", { E_INTEGER } )    -- not C_INT

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

Search



Quick Links

User menu

Not signed in.

Misc Menu