get window handle and making window move around and making them take focus

Posted on 2007-11-25
Last Modified: 2010-04-01
how do I get window handle and move them around?

and make them take focus?
Question by:Troudeloup
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 150 total points
ID: 20346484
are you talking about your own window? or a 3rd-party window?

Author Comment

ID: 20346770
any top level window,

such as notepad.exe
LVL 86

Assisted Solution

jkr earned 350 total points
ID: 20346783
To get the handle, use 'FindWindow()' (, to move it, use 'MoveWindow()' (, e.g.

HWND hwnd = FindWindow(NULL,"notepad.exe");

// check for error

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 20346790
is it like, functions that would work only if I use visual studio c++, like express?
LVL 86

Accepted Solution

jkr earned 350 total points
ID: 20346803
No, both of them work on all compilers that can create programs for teh Windows platform. All you need is

#include <windows.h>

Author Comment

ID: 20346822
will you take  a look of the keyboard and mouse events?
LVL 86

Expert Comment

ID: 20346832
Done ;o)

Author Comment

ID: 20352665

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C language IDE – Compilers installation 14 78
Move constructor only called if marked noexcept? 6 114
Exception thrown at 0x00007FFD5BC81F28 7 55
Outlook 13 84
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question