Learn to summarize what you have learned every day and record it is a good habit! Hey ~ It seems that you have to cheer, don't write because you are too lazy! Jiang River is a stream collection! To achieve his own little dream, it is still diligent! There is not much time, and it is going to see PASS in half a semester. I feel fast now! Write to yourself: Believe in yourself, unremitting efforts, there is nothing impossible. Below is a dialogue applet generated by SDK does not generate a window, and some basic functions implemented directly using dialog boxes include changing background colors and displaying text files in the clipboard as follows:
#include
Int WinApi Winmain (Hinstance Hinstance, Hinstance Hprevinstance, LPSTR LPCMDLINE, INT NCMDSHOW) {msg msg;
IF (100 == DialogBox (Hinstance, "MyDialog", NULL, (DLGPROC) Dialogfun) {PostQuitMessage (WM_QUIT);} While (GetMessage (& MSG, (HWND) NULL, 0, 0) {TranslateMessage (& MSG); DispatchMessage (& MSG);} Return Msg.wParam; Unreferenced_Parameter (LPCMDLINE);
}
Bool Callback Dialogfun (HWnd Dlghwnd, Uint Message, WPARAM WPARAM, LPARAM LPARAM) {
Switch (Message) {
Rect Rect; Case WM_PAINT:
PAINTSTRUCT ps; HDC hdc; HBRUSH brush, oldbrush; hdc = BeginPaint (dlghwnd, & ps); brush = CreateSolidBrush (tempcolor [color]); // Create a brush GetClientRect (dlghwnd, & rect); // get the main window area oldbrush = (Hbrush) SelectObject (HDC, Brush); Rectangle (HDC, Rect.Lect, Rect.top, Rect.right, Rect.Bottom); SelectObject (HDC, Oldbrush); Endpaint (DLGHWND, & PS); Return False;
Case WM_INITDIALOG: // ShowWindow (NULL, SW_SHOWNORMAL); RETURN FALSE; CASE WM_COMMAND: SWITCH (WPARAM) {CASE IDOK: EndDialog (DLGHWND, 100); // Definition 100 to determine exit dialog
return TRUE; case ID_CHANGECOLOR: color = 1; InvalidateRect (dlghwnd, NULL, FALSE); return TRUE; case ID_CHANGECOLOR2: color = 2; InvalidateRect (dlghwnd, NULL, FALSE); return TRUE; case ID_CHANGECOLOR3: color = 0; InvalidateRect ( dlghwnd, NULL, FALSE); return TRUE; case ID_PASTE: // HWND pasteHwnd; if (OpenClipboard (NULL)) // open clipboard {if (IsClipboardFormatAvailable (CF_TEXT)) {HANDLE hClip; char * pBuffer; hClip = GetClipboardData ( CF_TEXT); pBuffer = (char *) GlobalLock (hClip); GlobalUnlock (hClip); SetDlgItemText (dlghwnd, IDC_EDIT_PASTE, pBuffer);} else {MessageBox (dlghwnd, "your clipboard is not a text file", "there no text ", MB_OK);} closeclipboard (); // Close clipboard}} default: returnaf false;}}