|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Icon.FromHandle(..) not working?Icon.FromHandle() and passing in a windows handle, yet nothing works ive tried two different things and neither work. Ive been googleing this to no avail....code: Protected Overrides Sub WndProc(ByRef m As Message) MyBase.WndProc(m) If m.Msg = WM_SYSCOMMAND Then Select Case m.WParam.ToInt32 Case 1000 Dim tray As New NotifyIcon(Me.components) tray.Icon = Icon.FromHandle(m.HWnd) ''tried using Me.Handle to see if that would work but no 'tray.Icon = Icon.FromHandle(Me.Handle) tray.Visible = True AddHandler tray.DoubleClick, AddressOf NotifyIcon1_DoubleClick SendMessage(m.HWnd.ToInt32, 0, Nothing, Nothing) End Select End If End Sub i set a breakpoint and step through, the method returns something, but apparently not an Icon like the MSDN documentation says...any idea how i can get this working? thanks -- -iwdu15 "iwdu15" <jmmgoalsteratyahoodotcom> schrieb: You will have to pass in an icon handle ('HICON').> hi, im attempting to get an applications Icon by using the method > Icon.FromHandle() and passing in a windows handle -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> so then if i get a windows handle, how can i get either a)its icon handle or
b) its icon? thanks for your help -- -iwdu15 "iwdu15" <jmmgoalsteratyahoodotcom> schrieb: PInvoke with 'SendMessage' + 'WM_GETICON' (see documentation).> so then if i get a windows handle, how can i get either a)its icon handle > or > b) its icon? -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> i cant seem to figre this out....google hasnt helped either....heres what i
have Protected Overrides Sub WndProc(ByRef m As Message) MyBase.WndProc(m) If m.Msg = WM_SYSCOMMAND Then Select Case m.WParam.ToInt32 Case 1000 SendMessage(m.HWnd, WM_GETICON, Nothing, Nothing) Dim tray As New NotifyIcon Dim x As IntPtr = DefWindowProcA(m.HWnd, WM_GETICON, Nothing, Nothing) tray.Icon = Icon.FromHandle(x) tray.Visible = True AddHandler tray.DoubleClick, AddressOf NotifyIcon1_DoubleClick SendMessage(m.HWnd, 0, Nothing, Nothing) End Select End If End Sub yet the DefWindowProcA doesnt return a windows handle....i couldnt find any documentation of how to get a specific message on MSDN or AllApi etc....thanks -- -iwdu15 "iwdu15" <jmmgoalsteratyahoodotcom> schrieb: 'SendMessage''s return value is the icon handle you can pass to >i cant seem to figre this out....google hasnt helped either....heres what i > have 'Icon.FromHandle'. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> SendMessage() was returning 0, so i found a way around it. I iterated through
each process comparing that handle to the handle i already have, if theyre the same i get the main module file name and extract the icon....thanks though Herfried! -- -iwdu15
RegEx Either Or
Windows Service Cannot Move Files Stopping Attributes.Add from converting my JavaScript event code to HTML 2 Gig Print Spooler process Dispose of Notifier Icon GPS & Windows Mobile XML into SQL 2005 Express using VB 2005 VB Express Object deleted or memory leak? Lauch VB.NET App From Network Drive Or Network Share. |
|||||||||||||||||||||||