CMPT 212
Fall 1997
|
char buffer[10]; HDC hdc; TEXTMETRIC tm; int x = 1; int y = 1; hdc = GetDC(hwnd); GetTextMetrics(hdc, &tm); for (int i=0; i<=10; i++) { sprintf(buffer, "%d", i); TextOut(hdc, x, y, buffer, strlen(buffer)); y = y + tm.tmHeight + tm.tmExternalLeading; } ReleaseDC(hwnd, hdc);
HDC hdc; PAINTSTRUCT paintstruct; ... switch (message) { ... case WM_PAINT: hdc = BeginPaint(hwnd, &paintstruct); TextOut(hdc, 1, 1, str, strlen(str)); EndPaint(hwnd, &paintstruct); break; ... }
InvalidateRec(hwnd, NULL, 1);
int MessageBox(HWND, LPCSTR, LPCSTR, UINT)where
int response; response = MessageBox(hwnd, "What now?", "Question", MB_OKCANCEL | MB_ICONQUESTION); switch (response) { case IDOK: ... // user pressed "OK" button. break; case IDCANCEL: ... // user pressed "Cancel" button. break; }
Return to lecture notes index |
|
This page is maintained by simpson@cs.sfu.ca. | Last updated on 14 Nov 1997. |