计算器外挂
// 计算器.cpp : 定义应用程序的入口点。 // #include "stdafx.h" #include "计算器.h" #include"resource.h" #define MAX_LOADSTRING 100 // 全局变量: HINSTANCE hInst; // 当前实例 TCHAR szTitle[MAX_LOADSTRING]; // 标题栏文本 TCHAR szWindowClass[MAX_LOADSTRING]; // 主窗口类名 // 此代码模块中包含的函数的前向声明: ATOM MyRegisterClass(HINSTANCE hInstance); BOOL InitInstance(HINSTANCE, int); LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, _In_ int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); // TODO: 在此放置代码。 MSG msg; // 初始化全局字符串 LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_MY, szWindowClass, MAX_LOADSTRING); MyRegisterClass(hInstance); // 执行应用程序初始化: if (!InitInstance (hInstance, nCmdShow)) { return FALSE; } // 主消息循环: while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return (int) msg.wParam; } // // 函数: MyRegisterClass() // // 目的: 注册窗口类。 // ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = MAKEINTRESOURCE(IDI_ICON1); wcex.lpszClassName = szWindowClass; wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_ICON1)); return RegisterClassEx(&wcex); } // // 函数: InitInstance(HINSTANCE, int) // // 目的: 保存实例句柄并创建主窗口 // // 注释: // // 在此函数中,我们在全局变量中保存实例句柄并 // 创建和显示主程序窗口。 // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { HWND hWnd; hInst = hInstance; // 将实例句柄存储在全局变量中 hWnd = CreateWindow(szWindowClass, TEXT("Calculator"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); if (!hWnd) { return FALSE; } ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); return TRUE; } // // 函数: WndProc(HWND, UINT, WPARAM, LPARAM) // // 目的: 处理主窗口的消息。 // // WM_COMMAND - 处理应用程序菜单 // WM_PAINT - 绘制主窗口 // WM_DESTROY - 发送退出消息并返回 // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; switch (message) { case WM_CREATE:{ CreateWindow( TEXT("edit"), TEXT(""), WS_CHILD | WS_VISIBLE | WS_BORDER, 50, 20, 200, 50, hWnd, (HMENU)10001, hInst, NULL); CreateWindow( TEXT("button"), TEXT("结果"), WS_CHILD | WS_VISIBLE, 0, 20, 40, 40, hWnd, (HMENU)10002, hInst, NULL); CreateWindow( TEXT("button"), TEXT("1"), WS_CHILD | WS_VISIBLE, 50, 70, 30, 30, hWnd, (HMENU)10003, hInst, NULL); CreateWindow( TEXT("button"), TEXT("2"), WS_CHILD | WS_VISIBLE, 50, 100, 30, 30, hWnd, (HMENU)10004, hInst, NULL); CreateWindow( TEXT("button"), TEXT("3"), WS_CHILD | WS_VISIBLE, 50, 130, 30, 30, hWnd, (HMENU)10005, hInst, NULL); CreateWindow( TEXT("button"), TEXT("4"), WS_CHILD | WS_VISIBLE, 90, 70, 30, 30, hWnd, (HMENU)10006, hInst, NULL); CreateWindow( TEXT("button"), TEXT("5"), WS_CHILD | WS_VISIBLE, 90, 100, 30, 30, hWnd, (HMENU)10007, hInst, NULL); CreateWindow( TEXT("button"), TEXT("6"), WS_CHILD | WS_VISIBLE, 90, 130, 30, 30, hWnd, (HMENU)10008, hInst, NULL); CreateWindow( TEXT("button"), TEXT("7"), WS_CHILD | WS_VISIBLE, 130, 70, 30, 30, hWnd, (HMENU)10009, hInst, NULL); CreateWindow( TEXT("button"), TEXT("8"), WS_CHILD | WS_VISIBLE, 130, 100, 30, 30, hWnd, (HMENU)10010, hInst, NULL); CreateWindow( TEXT("button"), TEXT("9"), WS_CHILD | WS_VISIBLE, 130, 130, 30, 30, hWnd, (HMENU)10011, hInst, NULL); CreateWindow( TEXT("button"), TEXT("+"), WS_CHILD | WS_VISIBLE, 180, 70, 30, 30, hWnd, (HMENU)10012, hInst, NULL); CreateWindow( TEXT("button"), TEXT("—"), WS_CHILD | WS_VISIBLE, 180, 100, 30, 30, hWnd, (HMENU)10013, hInst, NULL); CreateWindow( TEXT("button"), TEXT("*"), WS_CHILD | WS_VISIBLE, 210, 100, 30, 30, hWnd, (HMENU)10014, hInst, NULL); CreateWindow( TEXT("button"), TEXT("/"), WS_CHILD | WS_VISIBLE, 210, 70, 30, 30, hWnd, (HMENU)10015, hInst, NULL); CreateWindow( TEXT("button"), TEXT("="), WS_CHILD | WS_VISIBLE, 180, 130, 30, 30, hWnd, (HMENU)10016, hInst, NULL); CreateWindow( TEXT("button"), TEXT("AC"), WS_CHILD | WS_VISIBLE, 210, 130, 30, 30, hWnd, (HMENU)10017, hInst, NULL); }break; case WM_COMMAND:{ wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); HWND hFin = FindWindow(NULL, TEXT("计算器")); // 分析菜单选择: switch (wmId) { //123456789 case 10003:{ SendMessage(hFin, WM_COMMAND, 0x00000083, 0); }break; case 10004:{ SendMessage(hFin, WM_COMMAND, 0x00000084, 0); }break; case 10005:{ SendMessage(hFin, WM_COMMAND, 0x00000085, 0); }break; case 10006:{ SendMessage(hFin, WM_COMMAND, 0x00000086, 0); }break; case 10007:{ SendMessage(hFin, WM_COMMAND, 0x00000087, 0); }break; case 10008:{ SendMessage(hFin, WM_COMMAND, 0x00000088, 0); }break; case 10009:{ SendMessage(hFin, WM_COMMAND, 0x00000089, 0); }break; case 10010:{ SendMessage(hFin, WM_COMMAND, 0x0000008A, 0); }break; case 10011:{ SendMessage(hFin, WM_COMMAND, 0x0000008B, 0); }break; //+-*/ case 10012:{ SendMessage(hFin, WM_COMMAND, 0x0000005D, 0); }break; case 10013:{ SendMessage(hFin, WM_COMMAND, 0x0000005E, 0); }break; case 10014:{ SendMessage(hFin, WM_COMMAND, 0x0000005C, 0); }break; case 10015:{ SendMessage(hFin, WM_COMMAND, 0x0000005B, 0); }break; // case 10016:{ SendMessage(hFin, WM_COMMAND, 0x00000079, 0); }break; case 10017:{ SendMessage(hFin, WM_COMMAND, 0x00000051, 0); }break; case IDM_EXIT: DestroyWindow(hWnd); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } break; } case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
让数据变得更安全!