[Solved] Why doesn’t my Windows API callback function run? [closed]

The documentation for SendMessageCallback tells you, why your callback will not ever be called: If the target window belongs to a different thread from the caller, then the callback function is called only when the thread that called SendMessageCallback also calls GetMessage, PeekMessage, or WaitMessage. The target window obviously belongs to a different thread, because … Read more

[Solved] CreateThread() does not work [closed]

You didn’t post any minimal compiling code we can help you debug, so, everything I’m about to say are guesses based on other questions I’ve seen on this topic: make sure asd is declared static, CreateThread is a C function and knows nothing about class methods make sure asd is declared __stdcall, having wrong calling … Read more

[Solved] Correctly receive messages from button

To detect a button press in another process, you have to hook that process. You have four choices for doing that: use SetWindowsHookEx() to install a WH_CALLWNDPROC or WH_GETMESSAGE hook into the target process to catch the WM_COMMAND/BN_CLICKED message that is sent to the button’s parent window when the button is clicked. The message identifies … Read more

[Solved] Setting Checkbox Options C++ [closed]

How can I give the CreateWindowW function multiple strings for multiple checkboxes? CreateWindow() can only create 1 window/control per call. You will have to manually split up the strings and then call CreateWindow() separately for each individual checkbox. Assuming your vector<string> contains the checkbox strings, you can pass the vector to your window via the … Read more

[Solved] Function Pointers stored in global variables get set to 0 when entering function, and get back to previous state when exiting function

if you write in header file static PFNGLGETERRORPROC glGetError; every c/cpp have own private copy of glGetError and it not conflict with other because it static – so different cpp files use different versions of glGetError – in one cpp unit you init one version and it !=0, when you enter to another cpp unit … Read more

[Solved] How to handle messages from multiple windows

There are several problems with your code: ProcessThread() is declared all wrong for CreateThread(), and the compiler would normally scream at you for that, but you are using an erroneous type-cast to quiet the compiler instead of fixing the error. As such, ProcessThread() will not be able to receive the vector correctly at runtime. The … Read more

[Solved] C create and run windows service

I think you miss some important requirements for a windows service.According to the MSDN. You need a service main function and a control handler function as you can’t handle the “start” command if there’s no control handler function registered. So you can refer to the code to know how to wrote a ServiceMain Function and … Read more

[Solved] How mingw32-g++ compiler know where to inject system calls in the WIN32 machine executable?

To quote the gcc manual: If no init section is available, when GCC compiles any function called main (or more accurately, any function designated as a program entry point by the language front end calling expand_main_function), it inserts a procedure call to __main as the first executable code after the function prologue. The __main function … Read more

[Solved] The Command CreateProcess C++

If you just want to open an existing image using defualt app then use ShellExectue API. For example: ShellExecuteW(NULL, L”open”, L”Z:\\cat.PNG”, NULL, NULL, SW_SHOW); You could also open image with mspaint using the same API: ShellExecuteW(NULL, L”open”, L”C:\\Windows\\system32\\mspaint.exe”, L”Z:\\cat.PNG”, NULL, SW_SHOW); ShellExecuteEx will let you wait for finishing process. You can do the same using … Read more