Code:
#include <windows.h>
/* Declare Windows procedure */
LRESULT CALLBACK WndProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);
static char szClassName[ ] = "SecSuite";
static HINSTANCE ghInstance=NULL;
int WINAPI WinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASSEX wincl; /* Data structure for the windowclass */
HWND hwnd; /* This is the handle for our window */
MSG Msg; /* Here messages to the application are saved */
/* The Window structure */
wincl.cbSize=sizeof (WNDCLASSEX);
wincl.style = CS_DBLCLKS;/* Catch double-clicks */
wincl.lpfnWndProc = WndProc;/* This function is called by windows */
wincl.cbClsExtra=0;/* No extra bytes after the window class */
wincl.cbWndExtra=0;/* structure or the window instance */
wincl.hInstance=hInstance;
wincl.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wincl.hCursor=LoadCursor(NULL,IDC_ARROW);
wincl.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
wincl.lpszMenuName=NULL;/* No menu */
wincl.lpszClassName = szClassName;
wincl.hIconSm =LoadIcon(NULL,IDI_APPLICATION);
/* Register the window class, and if it fails quit the program */
if (!RegisterClassEx (&wincl))
{
MessageBox(0,"Error registering window!","Error",MB_ICONSTOP|MB_OK);
return 0;
}
/* The class is registered, let's create the program*/
hwnd = CreateWindowEx (
WS_EX_STATICEDGE, /* Extended possibilites for variation */
szClassName, /* Classname */
"Woot", /* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen */
544, /* The programs width */
375, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to desktop */
NULL, /* No menu */
hInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
if(hwnd==NULL)
{
MessageBox(0,"Window creation failed!","Error",MB_ICONSTOP|MB_OK);
return 0;
}
/* Make the window visible on the screen */
ShowWindow (hwnd, nCmdShow);
UpdateWindow(hwnd);
/* Run the message loop. It will run until GetMessage() returns 0 */
while (GetMessage (&Msg, NULL, 0, 0))
{
TranslateMessage(&Msg);/* Translate virtual-key msgs into char msgs */
DispatchMessage(&Msg);/* Send message to WindowProcedure */
}
/* The program return-value is 0 - The value that PostQuitMessage() gave */
return Msg.wParam;
}
/* This function is called by the Windows function DispatchMessage() */
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
LPSTR szMessage="^_^";
switch (Message)/* handle the messages */
{
case WM_PAINT:
hdc=BeginPaint(hwnd,&ps);
TextOut(hdc,70,50,szMessage,strlen(szMessage));
EndPaint(hwnd,&ps);
break;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:/* for messages that we don't deal with */
return DefWindowProc (hwnd, Message, wParam, lParam);
}
return 0;
}
Woot ^_^ hah, 100 lines for a window with nothing but ^_^ in it