V
Kuldren schrieb:
Naja in deinem Code verwendest du ja immer noch LoadImage und nicht LoadIcon
außerdem solltest genauer angeben was nicht funktioniert weil unter "funzt irgendwie nicht" kann man viel verstehen.
[cpp]
#define WIN32_LEAN_AND_MEAN // instructs the compiler to not include extraneous MFC overhead
#include <windows.h>
#include <commctrl.h>
LRESULT CALLBACK WindowProc(HWND hwnd,
UINT msg,
WPARAM wparam,
LPARAM lparam)
{
switch(msg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default: break;
}
return (DefWindowProc(hwnd, msg, wparam, lparam));
}
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdline,
int nCmdShow)
{
InitCommonControls();
WNDCLASSEX winclass;
winclass.cbSize = sizeof(WNDCLASSEX);
winclass.style = CS_VREDRAW | CS_HREDRAW | CS_OWNDC | CS_DBLCLKS;
winclass.lpfnWndProc = WindowProc;
winclass.cbClsExtra = 0; // extra class info space
winclass.cbWndExtra = 0; // extra window info space
winclass.hInstance = hInstance; // assign the application instance
winclass.hIcon = LoadIcon(NULL,TEXT("MyIcon.ico"));
int error = GetLastError(); // <- error == 0 ! aber kein Icon Sichtbar
winclass.hCursor = LoadCursor(hInstance, IDC_ARROW);
winclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);//(HBRUSH)GetStockObject(WHITE_BRUSH);
winclass.lpszMenuName = NULL; // the name of the menu to attach
winclass.lpszClassName = TEXT("WINCLASS1"); // the name of the class itself
winclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassEx(&winclass);
HWND hwnd;
hwnd = CreateWindowEx(NULL,
TEXT("WINCLASS1"),
TEXT("Fenstertitel"),
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
0,
0,
400,
400,
NULL, // handle to parent
NULL, // handle to menu
hInstance, // instance of this application
NULL);
if(hwnd==NULL)
return -10;
//UpdateWindow();
MSG msg;
while(GetMessage(&msg, NULL, 0, 0))
{
// translate any accelerator keys
TranslateMessage(&msg);
// send the message to the window proc
DispatchMessage(&msg);
}
return 0;
}
[/cpp]