Custom icon not displayed in upper left corner or on task bar?

My first suggestion would be to try loading a standard icon instead of your own icon.

My first suggestion would be to try loading a standard icon instead of your own icon: hMyIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_ERROR)); This should probably work, and you should see the red error message icon. The next thing to do is try to obtain the instance handle in a different way. Console windows are a strange breed, don't mix them too much with the rest of the Win32 API.

Try: hInstance = GetModuleHandle(NULL).

– JAKE6459 Oct 7 '10 at 0:37 I'll post a modified version of your source, see my comments... – Anders Oct 7 '10 at 0:38 @Jake: Because console windows are quite different from normal windows. The "window" itself resides in a separate system process (CSRSS) and trying to use standard API functions on it won't get you expected results. Read this article for a bit of related history.

– casablanca Oct 7 '10 at 0:42.

Are you sure your LoadIcon calls return! = NULL? LoadIcon always loads a 32x32 icon, MSDN says if hIconSm is NULL, it checks the icon resource for a icon with the correct size so maybe you should try to set hIconSm=NULL; You could use WM_SETICON Edit: //(Having your code from the start would have made things easier) #include #include "resource.

H" MSG msg; HWND hwndwnd; HICON hMyIcon; LRESULT CALLBACK WndProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam ) { switch ( message ) { case WM_CLOSE: DestroyWindow(hwnd);//exit( 0 ); break; case WM_DESTROY: PostQuitMessage(0); break; case WM_CREATE: // SendMessage(hwndwnd,WM_SETICON,ICON_SMALL,(LPARAM)hMyIcon); break; } return DefWindowProc( hwnd, message, wparam, lparam ); } int main(int ArgumentNum, char *arg) { /* You don't own/control the console window, don't use it's HWND if you don't have to. ...And there is even a function to get the HWND if you need it, no need for FindWindow char title500; GetConsoleTitleA( title, 500 ); HWND hwndConsole = FindWindowA( NULL, title ); HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hwndConsole, GWLP_HINSTANCE); */ HINSTANCE hInstance=GetModuleHandle(NULL); hMyIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); WNDCLASSEX wc; wc. CbSize = sizeof(WNDCLASSEX); wc.

Style = CS_DROPSHADOW; wc. LpfnWndProc = WndProc; wc. CbClsExtra = 0; wc.

CbWndExtra = 0; wc. HInstance = hInstance; wc. HIcon = hMyIcon; wc.

HCursor = LoadCursor(/*hInstance*/NULL, IDC_ARROW); wc. HbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH ); wc. LpszMenuName = 0; wc.

LpszClassName = "Jacob"; #if 1 //The easy way wc. HIconSm = NULL;//hMyIcon; LoadIcon only loads 32x32 icons, you would get the wrong icon #else //The hard way wc. HIconSm = (HICON)LoadImage(hInstance,MAKEINTRESOURCE(IDI_ICON1),IMAGE_ICON,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0); #endif RegisterClassEx(&wc); //create window hwndwnd = CreateWindow("Jacob", "My Window", WS_OVERLAPPEDWINDOW, 520 , 20, 300, 300, NULL, NULL, hInstance, NULL); ShowWindow(hwndwnd,SW_SHOW); while(GetMessage( &msg, /*hwndwnd*/NULL, 0, 0) >0 ) //normally not a good idea to specify a hwnd { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.

WParam; }.

I have determined it does not return NULL with if (hMyIcon == NULL) { std::cout Im not so good with using messages yet. – JAKE6459 Oct 5 '10 at 0:59 1 After CreateWindow, do SendMessage(yourwindow,WM_SETICON,ICON_SMALL,(LPARAM)youriconhandle); (You can also set the large icon this way) – Anders Oct 5 '10 at 1:26 I tried that as well. Could it have anything to do with me not using the winmain function, because im registering my class and creating my window in just the main function, so do I need winmain for it to work?

Would you like me to edit my post and put my source in? – JAKE6459 Oct 6 '10 at 1:57 1 No, you don't need WinMain, but you do need a message loop. Posting your code would probably help – Anders Oct 6 '10 at 15:53 Source posted, hopefully I formatted it right when I did.

– JAKE6459 Oct 6 '10 at 22:12.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions