RE: Win API question
- Posted by Brian Broker <bkb at cnw.com> Dec 09, 2003
- 525 views
Phil, Both the second and third parameters for ExtractAssociatedIcon are pointers. It took some experimentation but this works... include win32lib.ew without warning constant Win = create( Window, "Win", 0, Default, Default, 100, 100, 0 ), Icn = create( Icon, "", Win, 35, 20, 32, 32, 0 ) constant xExtractAssociatedIcon = registerw32Function(shell32, "ExtractAssociatedIconA", {C_INT, C_POINTER, C_POINTER}, C_INT) procedure init( integer self, integer event, sequence params ) atom lpIconPath, lpiIcon, icon lpIconPath = allocate_string( "C:\\myfile.txt" ) lpiIcon = allocate(4) poke4(lpiIcon,0) icon = w32Func( xExtractAssociatedIcon, { instance(), lpIconPath,lpiIcon } ) setIcon( Icn, icon ) end procedure setHandler( Win,w32HOpen,routine_id("init") ) WinMain( Win, Normal ) -- Brian Philip Deets wrote: > > > 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 > >