PDA

View Full Version : how can i set the plugin icon ?


Epsylon3
December 4th, 2005, 04:10
in documentation of Registerpluginclass...

it's wrote :

int Registerpluginclass(char *classname,char *iconname,HINSTANCE dllinst,WNDPROC classproc);

iconname - name of icon resource in plugin DLL;

If iconname is NULL, uses standard plugin icon (letter 'P').

but Ressources are integer Constants
#define IDI_ICON1 115

I am unable to set icon :/ could somebody tell me how ?

GaBoR
December 5th, 2005, 19:45
HICON LoadIcon(

HINSTANCE hInstance, // handle of application instance
LPCTSTR lpIconName // icon-name string or icon resource identifier
);
Declare a handle to an icon & an instance of the module :
HICON ico;
HMODULE hInstance;

hInstance=GetModuleHandle(

LPCTSTR lpModuleName // address of module name to return handle for
);
ico=LoadIcon(hInstance,MAKEINTRESOURCE(IDI_ICON));
SendMessage(hWnd,WM_SETICON,false,(long)ico);
But maybe you don't need all of these, because you can use:
The MAKEINTRESOURCE macro converts an integer value to a resource type compatible with Win32 resource-management functions. This macro is used in place of a string containing the name of the resource.

LPTSTR MAKEINTRESOURCE(

WORD wInteger // integer to convert
);

Epsylon3
December 6th, 2005, 08:07
Thanks