Main.cpp
#define WIN32_LEAN_AND_MEAN#include <windows.h>#include "RESOURCES.H"LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam){ PAINTSTRUCT ps; HDC hdc; switch(msg) { case WM_CREATE: { return(0); } break; case WM_PAINT: { hdc = BeginPaint(hwnd, &ps); EndPaint(hwnd, &ps); return(0); } break; case WM_DESTROY: { PostQuitMessage(0); return(0); } break; default:break; } return(DefWindowProc(hwnd, msg, wparam, lparam));}int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){ WNDCLASSEX winclass; HWND hwnd; MSG msg; winclass.cbSize = sizeof(WNDCLASSEX); winclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW; winclass.lpfnWndProc = WindowProc; winclass.cbClsExtra = 0; winclass.cbWndExtra = 0; winclass.hInstance = hInstance; winclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); winclass.hCursor = LoadCursor(NULL, IDC_ARROW); winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); winclass.lpszMenuName = NULL; winclass.lpszClassName = "WINCLASS1"; winclass.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); if(!RegisterClassEx(&winclass)) return(0); if(!(hwnd = CreateWindowEx(NULL, "WINCLASS1", "My Awesome Window!", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0,0, 400,400, NULL, NULL, hInstance, NULL))) return(0); while(TRUE) { if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if(msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } } return(msg.wParam);}
The .h file
#define IDI_ICON1 100
And the icon file...here's the branch..
Resource File(folder)
ICONS
IDI_ICON1
What's up with this?! Argh!
----------------------
Always will be smarter
than you,
--=ME=--
----------------------
[edited by - Wachar on April 16, 2002 7:05:13 PM]