1. Win API question

Can someone tell me why this won't work?

It should put a notepad icon on the window.  Make sure you make a file 
"C:\myfile.txt" before you run the program.

--begin code

include win32lib.ew
without warning

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

constant xExtractAssociatedIcon =
    registerw32Function(shell32, "ExtractAssociatedIconA", {C_INT, 
C_POINTER, C_INT}, C_INT),
    icon = addIcon( w32Func( xExtractAssociatedIcon, { 0, "C:\\myfile.txt", 
0 } ) )


procedure paintWin( integer self, integer event, sequence parms )

          copyBlt( win, 10, 10, icon )

end procedure
setHandler( win, w32HPaint, routine_id( "paintWin" ) )

WinMain( win, Normal )

--end code

Thanks,

Phil

new topic     » topic index » view message » categorize

2. Re: Win API question

----- Original Message ----- 
From: "Philip D." <philip1987 at hotmail.com>
To: <EUforum at topica.com>
Subject: Win API question


> 
> 
> Can someone tell me why this won't work?
> 
> It should put a notepad icon on the window.  Make sure you make a file 
> "C:\myfile.txt" before you run the program.
> 
> --begin code
> 
> include win32lib.ew
> without warning
> 
> constant win = create( Window, "win", 0, Default, Default, 500, 500, 0 )
> 
> constant xExtractAssociatedIcon =
>     registerw32Function(shell32, "ExtractAssociatedIconA", {C_INT, 
> C_POINTER, C_INT}, C_INT),
>     icon = addIcon( w32Func( xExtractAssociatedIcon, { 0, "C:\\myfile.txt", 
> 0 } ) )
> 
> 
> procedure paintWin( integer self, integer event, sequence parms )
> 
>           copyBlt( win, 10, 10, icon )
> 
> end procedure
> setHandler( win, w32HPaint, routine_id( "paintWin" ) )
> 
> WinMain( win, Normal )
> 

copyBlt and the other blitting routines are designed to work with bitmaps and
not icons.

Brian's example using an Icon control is probably the easiest alternative.
-- 
Derek

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

3. Re: Win API question

Mircoangelo is one of the better ones, but it costs.
----- Original Message ----- 
From: "Philip D." <philip1987 at hotmail.com>
To: <EUforum at topica.com>
Subject: RE: Win API question


> 
> 
> I just tried every number from 1 to 10, none of them look any different, 
> they all look crammed.
> 
> Also, where can I find an icon editor?  I don't have one.
> 
> Phil
> 
> 
> ------
> 
> Bernie Ryan wrote:
> 
>  >Yes, but how do I get it to display the 16x16 version of the icon
>  >instead of the crammed 32x32 version?
> 
> Philip:
> 
>     I look at the ICON used on NotePad and it contains 8 icons.
>     first, forth, and eight icons are the smallest icons.
> 
> icon = addIcon( w32Func( xExtractAssociatedIcon,
>        { 0, "C:\\myfile.txt", 0 } ) )
> 
> In the last parameter you used index zero which will try to use a default
> because you didn't use a specific index.
> 
> Try using 1, 4, or 8 in the last parameter.
> 
> Bernie
> 
> 
> 
> TOPICA - Start your own email discussion group. FREE!
> 
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu