Little trouble

xiaoxiao2021-03-06  21

Really encountering questions!

The next time the code cannot be empty in this day, Xiao Xiao is stupid, wrote hundreds of lines of code, not paying attention, this is finished, BUG is a bunch.

Check me exhausted.

Next time, I won the main point, be careful, design it again, don't write, it is not good.

What is a bamboo, what is unrest, what is big wisdom. Buddha: Dazhi is foolish. Buddha is also: I am here again, because I often say: "I don't go to hell, who enters hell". The Buddha has great wisdom, not ordinary people, what we have to do is to learn from Buddha. How much is it? It is no longer like this, and I can't care about the consequences. The Buddha is very vision, it is far from us, I can't reach the realm of the Buddha, but at least I can see it than now. This requires Buddha wisdom. Many of us said: "Serving the people, be a public servant." I don't know why the servant is always the people. Oh, it's not far away. I rely on, what is the height? ! !

Or just the procedures and Buddha, I think the Buddha is when the programmer, the Buddha is definitely not a general programmer. Unlike me, ~~~~ Tianma line blank, wrong, a bunch, put the netizens to get the machine to shut down, the most depressed is that I want to write that process, now write to the virus. depressed! ! !

Say that I still analyze my silly program! !

In fact, it is also very simple, why is it designed? ! !

I use vc.net; the following is .CPP program

I checked for a long time or have a bug, it is estimated that there is a problem when menu message processing.

But I really don't know how to check this BUG! ! !

Have a master, please help, please my QQ: 76359121

#include #include "resource.h"

// Global variable Hinstance Hinst; int TempColor; // Save the number of color schemes

BOOL // declare function CALLBACK DialogFun (HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain (HINSTANCE, HINSTANCE, LPSTR, int); InitApplication (HINSTANCE); InitInstance (HINSTANCE, int); LRESULT CALLBACK MainWndProc (HWND, UINT , Wparam, lparam; BOOL PAINTWINDOWS (HWND, INT); // Defines the flush window function BOOL PAINTSMALLWINDOWS (HWND, INT); / / Defines the window function hWnd on the Pinting dialog box is the handle of the dialog, int is transform color // parameter application entry point function int WINAPI WinMain (hINSTANCE hinstance, hINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {MSG msg; if (! InitApplication (hinstance)) return FALSE; if return (InitInstance (hinstance, nCmdShow)!) False; While (GetMessage (& MSG, (HWND) NULL, 0, 0)) {/ * IF (GetMessage (& MSG, (HWND) NULL, 0, 0) == -1) {MessageBox (null, "The Applcation CAN 't run "," error ", MB_OK; return 0;} * / translateMessage (& msg); DispatchMessage (& msg);} return msg.wparam; // unreferenced_parameter (lpcmdline);} // application initialization BOOL INITAPPLICATION Hinstance Hinstance) {WNDCLASS WNDCLASS;

wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION); wndclass.hInstance = Hinstance; wndclass.lpfnwndproc = mainwndproc; wndclass.lpszclassname = "myclass"; WNDCLASS.LPSZMENUNAME = "MyMENU"; WNDCLASS.STYLE = CS_HREDRAW | CS_VREDRAW;

IF (0 == RegisterClass) {Return False;} else returse;

}

// Create and display window BOOL InitInstance (Hinstance Hinstance, Int Ncmdshow) {hwnd hwnd;

// Save the application-instance handle.

hinst = hinstance;. // Create the main window hwnd = CreateWindow ( "MyClass", // name of window class "welcome", // title-bar string WS_OVERLAPPEDWINDOW, // top-level window CW_USEDEFAULT, // default horizontal position CW_USEDEFAULT, // default vertical position CW_USEDEFAULT, // default width CW_USEDEFAULT, // default height (HWND) NULL, // no owner window (HMENU) NULL, // use class menu hinstance, // handle to application instance (LPVOID) NULL); // no window-creation dataif (! Hw) Return False;

// show the window and send a wm_paint message to the window // procedure.

ShowWindow (HWND, NCMDSHOW); UpdateWindow (hwnd); Return True;} Lresult Callback MainwndProc (HWND HWND, UINT UMSG, WPARAM WPARAM, LPARAM LPARAM) {// PAINTSTRUCT PS;

// HMENU HMENU; SWITCH (UMSG) {Case WM_Command: // HMenu = GetMenu (HWND); Switch (WPARAM)) {CASE IDM_DIALOG_TEST: DIALOGBOX (Hinst, "MyDialog", HWnd, (DLGPROC) Dialogfun; return DefWindowProc (HWND, UMSG, WPARAM, LPARAM); Case IDM_Test1: MessageBox (HWnd, "Test Menu1", "Menu1", MB_OK; Return DefWindowProc (HWND, UMSG, WPARAM, LPARAM);

CASE IDM_TEST2: MessageBeep (0); MessageBox (HWND, "Menu 2 Test", "Navyblue", MB_OK; Return DefWindowProc (HWND, UMSG, WPARAM, LPARAM);

Case IDM_ABOUT_ME: MessageBox (hwnd, "is a good way!", "This guy is too lazy prompt you:", MB_OK); Return DefWindowProc (HWND, UMSG, WPARAM, LPARAM);

// createdialog}

Case WM_CREATE: // Initialize The window. Return DefWindowProc (HWND, UMSG, WPARAM, LPARAM);

Case WM_Paint: // Paint The Window's Client Area.

PaintWindows (hwnd, TempColor); return DefWindowProc (hwnd, uMsg, wParam, lParam); case WM_SIZE: // Set the size and position of the window return 0; case WM_DESTROY:.. // Clean up window-specific data objects PostQuitMessage (0); Return DefWindowProc (HWND, UMSG, WPARAM, LPARAM);

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Process Other Messages.

Default: Return DefWindowProc (HWND, UMSG, WPARAM, LPARAM);} Return DefWindowProc (HWND, UMSG, WPARAM, LPARAM);

}

// processing dialog message BOOL CALLBACK DialogFun (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {HWND colorHwnd; colorHwnd = GetDlgItem (hDlg, IDC_COLOR); switch (message) {case WM_INITDIALOG: SetWindowText (hDlg, TEXT ( " :: Deep Blue Studio Produced by :: ")); Return True; Case WM_COMMAND: Switch (WPARAM) {Case ID_OK: Enddialog (HDLG, 0); Return True; Case IDC_ChangeColor: TempColor = 0; Return True; Case IDC_CHANGECOLOR2: TempColor = 1; Return True;} Case WM_Paint: PaintsmallWindows (ColorHWnd, TempColor); Break;} return 0;}

转载请注明原文地址:https://www.9cbs.com/read-40353.html

New Post(0)