From: Leslie Milburn on 6 Nov 2009 02:56 "Franz Bachler" <fraba.nospam(a)gmx.at> wrote in message news:4af3b263$0$1555$91cee783(a)newsreader03.highway.telekom.at... >>> SetClassLong( hWnd, GCL_HICON, >>> (LONG) LoadIcon( GetModuleHandle(NULL), >>> MAKEINTRESOURCE(ICO_NAMEICON) ) ); >>> >>> The HWND-Handle from the OpenCV-Window is from >>> >>> hWnd=(HWND) cvGetWindowHandle(szNameofWindow); >> >> Use WM_SETICON message >> hth >> Leslie. > > Hello, > sorry but > > SendMessage(hWnd, WM_SETICON, (WPARAM) FALSE, > (LONG) LoadIcon(GetModuleHandle(NULL), > MAKEINTRESOURCE(ICO_NAME))); > > doesn't work. > > Greetings, > Franz > My guess is that the LoadIcon call is failing. Call it separately and check the results. hth Leslie.
From: Franz Bachler on 6 Nov 2009 04:28 > My guess is that the LoadIcon call is failing. Call it separately and > check the results. I've testet it so: if (LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(ICO_NAME))) exit(0); Result: The Programm exits; that shows that the return value of LoadIcon is not NULL. So this should work. If I replace ICO_NAME with the Name of a Button, then the program exits.
From: Dee Earley on 6 Nov 2009 09:23 On 06/11/2009 09:28, Franz Bachler wrote: >> My guess is that the LoadIcon call is failing. Call it separately and >> check the results. > > I've testet it so: > > if (LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(ICO_NAME))) > exit(0); > > Result: The Programm exits; that shows that the return value of LoadIcon is > not NULL. > So this should work. If I replace ICO_NAME with the Name of a Button, then > the program exits. You have actually added an Icon resource with the matching name? -- Dee Earley (dee.earley(a)icode.co.uk) i-Catcher Development Team iCode Systems
From: Franz Bachler on 6 Nov 2009 09:45 > You have actually added an Icon resource with the matching name? Yes, the program starts with a dialogbox and if you press a button in the dialogbox opens an OpenCV-Window. The dialogbox uses the same icon. But you can also start directly the OpenCV-Window with a switch without previous dialog box.
From: Leslie Milburn on 7 Nov 2009 06:20 "Franz Bachler" <fraba.nospam(a)gmx.at> wrote in message news:4af3ec4e$0$1556$91cee783(a)newsreader04.highway.telekom.at... >> My guess is that the LoadIcon call is failing. Call it separately and >> check the results. > > I've testet it so: > > if (LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(ICO_NAME))) > exit(0); > > Result: The Programm exits; that shows that the return value of LoadIcon > is not NULL. > > So this should work. If I replace ICO_NAME with the Name of a Button, then > the program exits. > This last part does not make sense as surely the button image is a bitmap and not an icon and therefore the call should fail. Are you sure the icon is actually in the resource file of the executable and not in a different rc file which might be part of your DLL for example ? This issue would be highlighted if you used hInstance in the LoadIcon call and not GetModuleHandle(NULL). Also while we are at it, LoadImage is now the preferred API from memory. Leslie
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: GetLogicalDriveStrings Next: Using SHChangeNotifyRegister |