hvordan udskriver man tekst i Winapis?
min kode:
#include <windows.h>
LRESULT CALLBACK MainWndProc (HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
switch(nMsg)
{
case WM_CREATE:
{
}
break;
case WM_DESTROY:
PostQuitMessage (0);
break;
}
DefWindowProc(hwnd, nMsg, wParam, lParam);
}
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
{
WNDCLASSEX wc;
char*szWndClassName;
memset (&wc, 0, sizeof(WNDCLASSEX));
wc.lpszClassName = szWndClassName;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = MainWndProc;
wc.hInstance = hInst;
wc.hIcon = LoadIcon(NULL, NULL);
wc.hIconSm = LoadIcon(NULL, NULL);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
RegisterClassEx (&wc);
MSG msg;
HWND hwnd;
hwnd = CreateWindow(szWndClassName, "Vindue...", WS_OVERLAPPEDWINDOW, 0, 0, 500, 500, NULL, NULL, hInst, NULL);
ShowWindow(hwnd, nShow);
UpdateWindow(hwnd);
while(GetMessage(&msg, NULL, 0, 0) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}