I was discussing Win32 programming with an associate today. Which prompted me to go back and look at code from nearly 10 years ago. Here it is:
int PASCAL
WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszCmdParam,
int nCmdShow
)
{
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
hInst=hInstance;
if (!hPrevInstance) {
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = sizeof(PVOID);
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon (hInst, MAKEINTRESOURCE(3000));
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground= GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = TEXT("GenericMenu");
wndclass.lpszClassName= szAppName;
RegisterClass(&wndclass);
}
hwnd = CreateWindow (szAppName,
szWindowTitle,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
ShowWindow (hwnd,nCmdShow);
UpdateWindow(hwnd);
while (GetMessage (&msg, NULL, 0,0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
}
Anyone remember what all this does? ;) LOL Here's how I do it today:
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
public class Form1 : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
public Form1()
{
}
}
41010732-52d5-499b-b054-4ab659d241fc|0|.0