Solved

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

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

and make them take focus?
0
Comment
Question by:Troudeloup
  • 4
  • 3
8 Comments
 
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?
0
 

Author Comment

by:Troudeloup
ID: 20346770
any top level window,

such as notepad.exe
0
 
LVL 86

Assisted Solution

by:jkr
jkr earned 350 total points
ID: 20346783
To get the handle, use 'FindWindow()' (http://msdn2.microsoft.com/en-us/library/ms633499.aspx), to move it, use 'MoveWindow()' (http://msdn2.microsoft.com/en-us/library/ms633534.aspx), e.g.

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

// check for error

MoveWindow(hwnd,100,200,300,300,TRUE);
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

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

Accepted Solution

by:
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>
0
 

Author Comment

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

Expert Comment

by:jkr
ID: 20346832
Done ;o)
0
 

Author Comment

by:Troudeloup
ID: 20352665
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

785 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