Name:
duh
2008-02-21 13:28
Help, I have no idea how to correctly use the API to create windows and fill them with text and shit.
Give me information, tutorials, etc.
Name:
Anonymous
2008-02-23 15:15
This is your Hello World in 1995 on Win32 and 'C'
#include <windows.h>
LRESULT CALLBACK WndProc(HWND hwnd,
UINT msg,
WPARAM wparam,
LPARAM lparam);
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR cmdline, int cmdshow) {
MSG msg;
HWND hwnd;
WNDCLASSEX wndclass = { 0 };
wndclass.cbSize = sizeof(WNDCLASSEX);
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszClassName = TEXT("Window1");
wndclass.hInstance = hInstance;
wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassEx(&wndclass);
hwnd = CreateWindow(TEXT("Window1"),
TEXT("Hello World"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
0,
NULL,
NULL,
hInstance,
NULL);
if( !hwnd )
return 0;
ShowWindow(hwnd, SW_SHOWNORMAL);
UpdateWindow(hwnd);
while( GetMessage(&msg, NULL, 0, 0) ) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg,
WPARAM wparam, LPARAM lparam) {
switch(msg) {
case WM_DESTROY:
PostQuitMessage(WM_QUIT);
break;
default:
return DefWindowProc(hwnd, msg, wparam, lparam);
}
return 0;
}
This is your Hello World in 2008 on C# and WPF
using System.Windows;
using System;
class Program {
[STAThread]
static void Main() {
Window f = new Window();
f.Title = "Hello World";
new Application().Run(f);
}
}
Anyone who wants to do the former needs their heads examined.