RUNit > Inside RUNit

Inside RUNit
'(not only) for programmers'



this page is some kind of FAQ from the developers view.
(I received a few emails from programmers asking questions like "how does this work, how did you do that,...")

 
  which programming language/compiler do I use?
how does RUNit detect the mouse click without any visible window?
where is the DLL?
about the Change Icon dialog

how does the clickable URL in the About dialog work?
 

 

 
  which programming language/compiler do I use?
RUNit is written in C (no MFC)
I'm currently using MSVC 5.0

   
   
  how does RUNit detect the mouse click?

when not running in "whole screen mode", RUNit creates a window at the edge of the screen.
the window is created with the extended style WS_EX_TRANSPARENT, so you usually don't see much of it.

CreateWindowEx(WS_EX_ACCEPTFILES|WS_EX_TRANSPARENT|WS_EX_TOOLWINDOW, szAppName, szTitle, WS_POPUP, 0,0, iScreenWidth,1, NULL, NULL, hInstance, NULL);

so "detecting" the mouse click is nothing more than processing the WM_RBUTTONDOWN message in this case.
in "whole screen mode" RUNit installs a systemwide HOOK to filter out the WM_RBUTTONDOWN messages of all windows in the system.

SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc, hInstDll, (DWORD)NULL);

this leads us to the next question...

 

   
   
  where is the DLL?

according to the manuals, a Hook function must reside in a .dll
I didn't like the idea of writing a .dll just for this one function, and aside from that i have always had this idee fixe that a good mag. lex program has to be "single EXE - no setup - no DLLs"

so I tried putting the Hook function into the .exe file - and it worked!
but it worked only until i tested the program under Windows NT...

it seems that for some reason, calling SetWindowsHookEx() with the Hook function residing in the .exe file, DOES work under Windows 95/98 but NOT under Windows NT.

so I had to write a .dll...

..but because I don't like .dlls very much and I didn't want to bother the user with this little creature, the .dll is extracted from RUNit.exe at runtime (it's that small runit.tmp file in the same directory as RUNit.exe)

 

   
   
  about the Change Icon dialog

because I didn't like the OleUIChangeIcon dialog, and because I'm lazy and risky I'm using the undocumented PickIconDialog, which is also used in the shortcut properties dialog when changing the icon.
it is exported from shell32.dll by ordinal 62.

(in version 2.0 the dialog did not work correctly under NT because i had forgotten the char<>wchar_t conversion - you see, you have to be careful with these undocumented functions)

 

   
   
  how does the clickable URL in the About dialog work?
you can pass URLs to ShellExecute()...