How to gracefully terminate a process?

EnumWindows enumerates all the top level windows in a process. GetWindowThreadProcessId gets the process and Id of each thread. You now have enough information to gracefully close any GUI application. You can send WM_CLOSE messages to any window you wish to close. Many windows handle WM_CLOSE to prompt the user to save documents.You can send … Read more

How can a Windows service application be written in Haskell?

I admit, this problem has been vexing me for some days now. From walking the return values and the contents of GetLastError, I’ve determined that this code should be working correctly according to the system. Because it clearly isn’t (it seems to enter an undefined state that inhibits the service handler from running successfully), I’ve … Read more

Finding undocumented APIs in Windows

Use a tool to dump the export table from a shared library (for example, a .dll such as kernel32.dll). You’ll see the named entry points and/or the ordinal entry points. Generally for windows the named entry points are unmangled (extern “C”). You will most likely need to do some peeking at the assembly code and … Read more

Foreground Vs Active window

The active window (the result of GetActiveWindow()) is the window attached to the calling thread that gets input. The foreground window (the result of of GetForegroundWindow()) is the window that’s currently getting input regardless of its relationship to the calling thread. The active window is essentially localized to your application; the foreground window is global … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)