FsExtractCustomIcon
Moderators: Hacker, petermad, Stefan2, white
FsExtractCustomIcon
I am currently having problems with FsExtractCustomIcon.
No matter what I do I can not get the icon to change. Does anyone have an example in C++?
My current code. I tried using a predefined icon to see if that would work. If I change it to IDI_ICON1 which is defined in the fsplugin sample I get a compiler error. Saying undeclared identifier. I am not very good at C++ so any help would be greatly appreciated.
int __stdcall FsExtractCustomIcon(char* RemoteName,int ExtractFlags,HICON* TheIcon)
{
HICON myIcon = NULL;
if (stricmp(RemoteName+pluginrootlen, "A:\\") == 0)
{
myIcon = LoadIcon(NULL, IDI_APPLICATION);
TheIcon = &myIcon;
return FS_ICON_EXTRACTED;
}
return FS_ICON_USEDEFAULT;
}
Thanks,
Austin
No matter what I do I can not get the icon to change. Does anyone have an example in C++?
My current code. I tried using a predefined icon to see if that would work. If I change it to IDI_ICON1 which is defined in the fsplugin sample I get a compiler error. Saying undeclared identifier. I am not very good at C++ so any help would be greatly appreciated.
int __stdcall FsExtractCustomIcon(char* RemoteName,int ExtractFlags,HICON* TheIcon)
{
HICON myIcon = NULL;
if (stricmp(RemoteName+pluginrootlen, "A:\\") == 0)
{
myIcon = LoadIcon(NULL, IDI_APPLICATION);
TheIcon = &myIcon;
return FS_ICON_EXTRACTED;
}
return FS_ICON_USEDEFAULT;
}
Thanks,
Austin
Got it working
I finally got it working. I needed to change the DLLMain to
HINSTANCE theDll = NULL;
BOOL APIENTRY DllMain( HINSTANCE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
theDll = hModule;
return TRUE;
}
I changed HANDLE hModule to HINSTANCE hModule.
Then I stroed the hModule into theDll varible.
Then I used myIcon = LoadIcon(theDll, MAKEINTRESOURCE(IDI_ICON2)); to get the icon.
Could someone validate that this is the correct way to do this?
Thanks,
Austin
HINSTANCE theDll = NULL;
BOOL APIENTRY DllMain( HINSTANCE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
theDll = hModule;
return TRUE;
}
I changed HANDLE hModule to HINSTANCE hModule.
Then I stroed the hModule into theDll varible.
Then I used myIcon = LoadIcon(theDll, MAKEINTRESOURCE(IDI_ICON2)); to get the icon.
Could someone validate that this is the correct way to do this?
Thanks,
Austin
- André Martin
- Senior Member
- Posts: 245
- Joined: 2003-02-05, 15:46 UTC
- Location: Dresden, Germany
Absolutely correct, but I prefer the following:
Code: Select all
if(ExtractFlags&FS_ICONFLAG_SMALL)
*TheIcon = LoadImage(ApplicationInstance, "ICON", IMAGE_ICON, 16, 16, 0);
else *TheIcon = LoadImage(ApplicationInstance, "ICON", IMAGE_ICON, 32, 32, 0);
Browse the web with the HTTP SmartBrowserPlugin
Check your mails with the POP3/SMTP EmailPlugin!
Check your mails with the POP3/SMTP EmailPlugin!
The code that actually worked is below. I could not get it to work without the MAKEINTRESOURCE and casting to HICON.
I could not get it to work without these changes to André's sample.
ApplicationInstance comes from DLLMain. Is there another way to get the ApplicationInstance?
Thanks,
Austin
I could not get it to work without these changes to André's sample.
ApplicationInstance comes from DLLMain. Is there another way to get the ApplicationInstance?
Code: Select all
if(ExtractFlags&FS_ICONFLAG_SMALL)
*TheIcon = (HICON) LoadImage(ApplicationInstance, MAKEINTRESOURCE(IDI_ICON2), IMAGE_ICON, 16, 16, 0);
else *TheIcon = (HICON) LoadImage(ApplicationInstance, MAKEINTRESOURCE(IDI_ICON2), IMAGE_ICON, 32, 32, 0);
Austin
- André Martin
- Senior Member
- Posts: 245
- Joined: 2003-02-05, 15:46 UTC
- Location: Dresden, Germany