What is a message pump?

A message loop is a small piece of code that exists in any native Windows program. It roughly looks like this: MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } The GetMessage() Win32 API retrieves a message from Windows. Your program typically spends 99.9% of its time there, waiting for Windows to tell … Read more

How to write hello world in assembly under Windows?

This example shows how to go directly to the Windows API and not link in the C Standard Library. global _main extern _GetStdHandle@4 extern _WriteFile@20 extern _ExitProcess@4 section .text _main: ; DWORD bytes; mov ebp, esp sub esp, 4 ; hStdOut = GetstdHandle( STD_OUTPUT_HANDLE) push -11 call _GetStdHandle@4 mov ebx, eax ; WriteFile( hstdOut, message, … Read more

How can a Metro app in Windows 8 communicate with a backend desktop app on the same machine?

I’m porting my existing project to Win8 right now. It consists of windows service and tray application which are talking to each other via NamedPipes WCF. As you may already know Metro doesn’t support named pipes. I ended up using TcpBinding for full duplex connection. This post describes what functionality is supported. Sample of my … Read more

Where can I find my .emacs file for Emacs running on Windows?

Copy and pasted from the Emacs FAQ, http://www.gnu.org/software/emacs/windows/: Where do I put my init file? On Windows, the .emacs file may be called _emacs for backward compatibility with DOS and FAT filesystems where filenames could not start with a dot. Some users prefer to continue using such a name, because Windows Explorer cannot create a file … Read more

Check whether a path is valid

Try Uri.IsWellFormedUriString(): The string is not correctly escaped. http://www.example.com/path???/file name The string is an absolute Uri that represents an implicit file Uri. c:\\directory\filename The string is an absolute URI that is missing a slash before the path. file://c:/directory/filename The string contains unescaped backslashes even if they are treated as forward slashes. http:\\host/path/file The string represents … Read more

Find out what process registered a global hotkey? (Windows API)

One possible way is to use the Visual Studio tool Spy++. Give this a try: Run the tool (for me, it’s at C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\spyxx_amd64.exe or you can download it). Note: there is spyxx.exe (32-bit version) and spyxx_amd64.exe (64-bit version) – if you don’t see anything in 64-bit use the 32-bit version (ie.catches … Read more

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