[vtkusers] Re: Setting an icon on the renderwindow under Win32

jean-michel.rouet at philips.com jean-michel.rouet at philips.com
Tue Jul 29 06:42:44 EDT 2003

For info I finally found how to set the icon:
The trick was to get the Window handler from the vtkRenderWindow object, 
and the the instance handle from the window handle

Something like that works:

    // set icon to the vtk window
    HWND hWnd = (HWND) renwin->GetGenericWindowId(); // retrieve vtk 
window Id
    HICON hIcon2 = LoadIcon((HINSTANCE) GetWindowLong(hWnd,GWL_HINSTANCE), 


    SetClassLong(hWnd,          // window Handle
                 GCL_HICON,     // index of the Icon field
                 (LONG)hIcon2); // the icon handler


On 29/07/2003 08:28:25 Jean-Michel Rouet wrote:
>Dear VTK users,
>I searched through the VTK archive and also through google without 
finding any 
>convincing answer. 
>I'm focused here on the Win32 port of VTK, and I think this is not 
relevant for 
>the Unix/Linux part. 
>What I'm trying to do is to set an ICON into the title bar of the VTK 
>I managed somehow to specify an icon for the executable file using the 
>following line
>HICON hIcon1 = LoadIcon(NULL, "IDI_MYICON");
>where my icon is a reference to my ICON resource under visual C++.
>unfortunately, this does not affect the small icon that appears in the 
>bar (which remains a classical blue window application icon), nor does it 

>affect the small icon in the task bar. 
>Does anybody know how to modify this or simply give me some links towards 

>relevant pages?

More information about the vtkusers mailing list