#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#define W32_LEAN_AND_MEAN
#define appName "Title"
#define wcName "Window Class Name"
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,LPSTR lpcmdline, int iCmdShow)
{
HWND hWnd;
MSG msg;
WNDCLASSEX wc;
wc.style= WS_OVERLAPPEDWINDOW | WS_VISIBLE;
wc.lpfnWndProc= WndProc;
wc.lpszClassName = wcName;
wc.lpszMenuName= NULL;
wc.hInstance= hInst;
wc.hIcon= LoadIcon(NULL,IDI_APPLICATION);
wc.hCursor= LoadCursor(NULL, IDC_ARROW);
wc.hIconSm = LoadIcon(NULL,IDI_APPLICATION);
wc.hbrBackground= (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.cbClsExtra= NULL;
wc.cbWndExtra= NULL;
wc.cbSize= sizeof(&wc);
if(!RegisterClassEx(&wc))
MessageBox(NULL,"Error Registering Class","Error",MB_OK); return 0;
if(!(hWnd = CreateWindowEx( NULL,
wcName,
appName,
WS_OVERLAPPEDWINDOW |WS_VISIBLE,
0, 0,
400, 400,
NULL,NULL,
hInst,
NULL)))
MessageBox(NULL, "Error Creating Window", "Error",MB_OK); return 0;
ShowWindow(hWnd, iCmdShow);
UpdateWindow(hWnd);
while( GetMessage(&msg,0,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd,UINT msg, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
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;
}
return DefWindowProc(hWnd,msg,wParam,lParam);
}
w32, huh?
Help me... Help me... Help me... Plz... Help me...
Thank you... Thank you... Thank you... Oh... Thank you...
_________________________________________________________________________
Can someone be nice and help me on my way to be the next Hideo Kojima? Thought So...
If you want help please be so kind as to explain your problem. Simply posting your source code and putting "help me help me help me" around it is useless.
1. In your if''s you''re missing some braces.
2. wc.style should NOT be = WS_OVERLAPPEDWINDOW | WS_VISIBLE;
but it should be (for instance) = CS_CLASSDC;
wc.style is the style of the window class NOT the window itself.
**************
A year spent in artificial intelligence is enough to make one believe in God.
2. wc.style should NOT be = WS_OVERLAPPEDWINDOW | WS_VISIBLE;
but it should be (for instance) = CS_CLASSDC;
wc.style is the style of the window class NOT the window itself.
**************
A year spent in artificial intelligence is enough to make one believe in God.
"We confess our little faults to persuade people that we have no large ones." -Francois de La Rochefoucauld (1613 - 1680). | My blog
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement