Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <windows.h>
- //AQUI, ESTAVA TENTANDO SÓ RECEBER O ÍCONE, SEM USAR A ALLEGRO
- int main(){
- int n=585,i;
- char strExePath [64];
- HMODULE hModule=NULL;
- HICON hIcon=NULL;
- HDC hdc;
- HINSTANCE hInst= GetModuleHandle (0);
- LPCTSTR lpFileName = "C:\\msnmsgr.exe"; //por exemplo: o ícone do msn
- hModule = LoadLibrary(lpFileName);
- if(hModule==NULL)
- printf("Erro1");
- if(GetModuleFileName (hModule, strExePath, 64)==0)
- printf("Erro2");
- else
- printf("strExePath: %s",strExePath);
- hIcon = ExtractIcon( hInst, lpFileName, 0);
- if(hIcon==NULL)
- printf("Erro3");
- else
- printf("\nIcone encontrado.");
- DrawIcon(hdc,10,20,hIcon);
- printf("\nFim do programa.");
- getchar();
- if(DestroyIcon(hIcon)==0)
- printf("Erro4");
- return 0;
- }
Add Comment
Please, Sign In to add comment