[Solved] How to open regedit with C++ [duplicate]

Here is, what I needed. String GetFullHKEY (HKEY hKeyRoot) { if (HKEY_LOCAL_MACHINE == hKeyRoot) return _T(“HKEY_LOCAL_MACHINE\\”); if (HKEY_CLASSES_ROOT == hKeyRoot) return _T(“HKEY_CLASSES_ROOT\\”); if (HKEY_CURRENT_CONFIG == hKeyRoot) return _T(“HKEY_CURRENT_CONFIG\\”); if (HKEY_CURRENT_USER == hKeyRoot) return _T(“HKEY_CURRENT_USER\\”); if (HKEY_USERS == hKeyRoot) return _T(“HKEY_USERS\\”); } bool RegistryGoTo (HKEY hKeyRoot, const String &lpctPath, String lpctValue) { if (lpctPath.empty() || 0 … Read more

[Solved] Using Multi Threading in Win32 Api [closed]

Introduction Multi-threading is a powerful tool for improving the performance of applications. It allows multiple tasks to be executed simultaneously, thus reducing the amount of time required to complete a task. The Win32 API provides a set of functions that allow developers to create and manage multiple threads in their applications. In this article, we … Read more

[Solved] Windows7.1 SDK: C2373: “MonitorFromWindow” Redefinition

The error is telling you that your declaration of MonitorFromWindow conflicts with the prior declaration. The prior declaration in Winuser.h declared the function with extern “C” linkage, is __declspec(dllimport) and has the __stdcall calling convention. You should remove your erroneous declaration and use that from the header file. 15 solved Windows7.1 SDK: C2373: “MonitorFromWindow” Redefinition

[Solved] Is my application runs from inside Visual Studio vs. by executing an EXE file

It not exactly solution, but: Raymond Chen(Microsoft winapi guru*) is most close in spirit to the problem I facing, helping me detect in what mode or circumstances I run my console session. How can I tell whether my console program was launched from Explorer or from a command prompt? printf(“this process = %d\n”, GetCurrentProcessId()); DWORD … Read more

[Solved] Differentiating between password and other kind of keyboard inputs in a keylogger

If the foreground app is using standard Win32 UI controls, then try this: use GetForegroundWindow() to get the HWND of the foreground window. then use GetWindowThreadProcessId() and GetGUIThreadInfo() to get the foreground window’s currently focused child control. then use GetClassName() to check if it is a standard EDIT control (this check might fail in some … Read more

[Solved] Windows message loop and server loop

This is a very confusing question as it asks one question in the title, but the content addresses a different problem (threads crashing). To address the primary question: Microsoft did add a way to handle socket communications in a GUI thread friendly way: WSAAsyncSelect. This will send socket events as messages to your applications message … Read more

[Solved] Wait for message delivered to MainWindow sent using SendMessage API

Here is the sample code in C++,(Removed error checking) MainWindow.cpp: #include <windows.h> #include <iostream> LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; } DWORD WINAPI createyourwindow(LPVOID param) { WNDCLASSEXW wcex = { 0 }; wcex.cbSize = … Read more

[Solved] CreateProcess causing problems

First, fgets will get a string with charactor ‘\n’ when size of inserted string <(255-1). So, let’s set the \n to \0: fgets(cmd, 255, stdin); cmd[strlen(cmd) – 1] = ‘\0’; CreateProcess(cmd, NULL, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); Second, more instances of cmd to popup in the command line. If what you mean … Read more