how use resource files?

Pages: 12
yes. the images files have several extencions... in these case i use ~6(GIF, CUR, ANI, JPG, PNG, BMP and maybe more). but when we create the resource, we must know the file extension. my objective is detect it automatic using a string or something instead the 2nd parameter... i'm sorry, but it's 1 thing that i want. if i can't, i must 'give up' or find another imagination.


- when we use LoadResource() with FindResource() and LockResource(): the LockResource() can return HICON using casting?
finally i did something cool... i'm testing if the FindResource() is NULL using the ResourceID and the type, for test the type... i think that it's a nice thot, but i'm doing something wrong that i don't know.. i'm using the FindResource() correctly?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
string GetResourceType(DWORD ResourceID)
{
    HRSRC rscFind;
    rscFind=FindResource(GetModuleHandle(NULL), MAKEINTRESOURCE(ResourceID), RT_ANICURSOR);
    if(rscFind!=NULL)
        return "ANICUR";
    rscFind=FindResource(GetModuleHandle(NULL), MAKEINTRESOURCE(ResourceID), RT_ANIICON);
    if(rscFind!=NULL)
        return "ANIICO";
    rscFind=FindResource(GetModuleHandle(NULL), MAKEINTRESOURCE(ResourceID), RT_BITMAP);
    if(rscFind!=NULL)
        return "BMP";
    rscFind=FindResource(GetModuleHandle(NULL), MAKEINTRESOURCE(ResourceID), RT_CURSOR);
    if(rscFind!=NULL)
        return "CUR";
    rscFind=FindResource(GetModuleHandle(NULL), MAKEINTRESOURCE(ResourceID), RT_ICON);
    if(rscFind!=NULL)
        return "ICO";
    return "OTHER";
}

the return is 'OTHER' when the type is ICON.
ok.. i fix it... but i need ask something:
what is the diference between RT_ICON and RT_GROUP_ICON?
seems that an ico file can have several ico images... so we must use RT_GROUP_ICON.
thanks to all
Topic archived. No new replies allowed.
Pages: 12