We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Writing Windows Win32 application

Medium Priority
Last Modified: 2013-12-03
I am new to windows programming.
I am trying to write an application to reorganize open(maximized) windows (like alt-tab) but in a fancy way.
Can some guru point me to some API, tutorial, samples for windows app/service development

- How to detect mouse position
- How to detect key stroke
- How to get all opened windows name, position and handle/pointer
- How to put active windows on top
- How to make a screen cap of the mini version of the windows

Watch Question

IT Professional
Top Expert 2005
>>- How to detect mouse position

You may catch WM_MOUSEMOVE or may use API ::GetCursorPos() .....

CPoint pt;
::GetCursorPos(&pt); // Retrieve mouse pos in pt

Sample : Mouse gestures recognition : http://www.codeproject.com/cpp/gestureapp.asp

>>How to detect key stroke

See :
Keyboard messages/accelerators handling in MFC dialog based applications

>>- How to get all opened windows name, position and handle/pointer

You may enumerate windows using EnumWindows API to retrieve handles and then use APIs like GetWindowPos to retrieve postition etc..
Check this : Finding module name from the window handle

>>How to put active windows on top

you may use ::SetWindowPos() with HWND_TOPMOST...
Check : Making a Window "Always On Top"

>>- How to make a screen cap

You may check following artcile with complete src :
Barry's Screen Capture : http://www.codeguru.com/cpp/g-m/gdi/capturingimages/article.php/c3663/

For more sources and example tutorials you may search codeguru / codeproject sites.

Hope this helps

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


Is there a C# version of these code?
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.