hier:
PHP-Code:
BOOL _SetConsoleIcon(HICON hIcon)
{
typedef BOOL (WINAPI *SetConsoleIcon_t)(HICON handle);
SetConsoleIcon_t SetConsoleIcon;
HMODULE hDll = LoadLibraryA("kernel32"); //loadlibrary ist falsch -> getmodulehandle
if(hDll)
{
SetConsoleIcon = (SetConsoleIcon_t)GetProcAddress(hDll, "SetConsoleIcon"); // null check fehlt
FreeLibrary(hDll); // weg
return (BOOL)SetConsoleIcon(hIcon); // C return - int
}
else
return false; // c++ return - bool
}
// kann zB so in main() verwendet werden (mit VS ):
_SetConsoleIcon(LoadIcon(instance,MAKEINTRESOURCE(IDI_ICON1)));