#include <windows.h> #include <tlhelp32.h> #include <vector> #include <string> #define…
- User
#include <windows.h> #include <tlhelp32.h> #include #include
#define ID_START_BUTTON 1 #define ID_STATUS_TEXT 2 // ID for the static text control
// Function prototypes DWORD_PTR GetAffinityMaskForAllCoresExceptCore0(); bool CheckForRunningProcesses(const std::vectorstd::wstring& processNames); void CheckAndModifyProcesses(const std::vectorstd::wstring& processNames, HWND hwnd); // Pass hwnd here LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); void OnStartButtonClick(HWND hwnd); void UpdateStatusText(HWND hwnd, const std::wstring& status);
// Main entry point int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // Remove console window FreeConsole();
std::vector<std::wstring> processNames = { L"MuMuPlayer.exe", L"MuMuVMMHeadless.exe", L"Ld9BoxHeadless.exe", L"Ld9BoxSVC.exe", L"dnplayer.exe", L"HD-Player.exe" }; // Step: Check for running processes before creating the window if (!CheckForRunningProcesses(processNames)) { MessageBox(NULL, "No emulator found.", "Error", MB_ICONERROR); return 0; // Exit the application if no emulators are found } const char CLASS_NAME[] = "EmulatorOptimizer"; // Register the window class WNDCLASS wc = {}; wc.lpfnWndProc = WindowProc; wc.hInstance = hInstance; wc.lpszClassName = CLASS_NAME; RegisterClass(&wc); HWND hwnd = CreateWindowEx( 0, CLASS_NAME, "Emulator Optimizer", // Changed title to "Emulator Optimizer" WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 300, 200, NULL, NULL, hInstance, NULL); if (hwnd == NULL) { return 0; } ShowWindow(hwnd, nCmdShow); // Create the Apply Emulator Optimization button CreateWindow( "BUTTON", // Predefined class; Unicode assumed "Apply Emulator Optimization", // Button text WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, // Styles 50, // x position 50, // y position 200, // Button width 30, // Button height hwnd, // Parent window (HMENU)ID_START_BUTTON, // Control identifier (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE), NULL); // Pointer not needed // Create the static text control for status message CreateWindow( "STATIC", // Predefined class "", // No initial text WS_VISIBLE | WS_CHILD, // Styles 50, // x position 100, // y position 200, // Width 30, // Height hwnd, // Parent window (HMENU)ID_STATUS_TEXT, // Control identifier hInstance, NULL); // Message loop MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return 0;}
// Windows Procedure LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_COMMAND: { if (LOWORD(wParam) == ID_START_BUTTON) { OnStartButtonClick(hwnd); } break; } case WM_DESTROY: PostQuitMessage(0); return 0;
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.