Solved

Need example of using GetWindowHwnd and SetWindowPos

Posted on 1998-03-20
3
1,624 Views
Last Modified: 2008-02-01
I am trying to set the postion of a Dialog box in my application. I was looking into how to use the SetWindowPos function, but do not know how to implement this in the dialog's OnInitDialog call. Apparently i need to get the handle of the dialog first.
0
Comment
Question by:englm
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
alexo earned 50 total points
ID: 1183671
You seem to be using MFC.  In that case, you already have the handle inside the CDialog class.
Since CDialog is a sub-class of CWnd, you can just call CWnd::SetWindowPos() from your OnInitDialog() function (you can omit the "CWnd::" qualifier).  You don't have to supply the handle, check the documentatation of CWnd::SetWindowPos().

BTW, MFC related questions have a better chance to be correctly answered in the "MFC" area.
0
 
LVL 4

Expert Comment

by:tflai
ID: 1183672
By the way, MoveWindow() gets the job done much easier, if all you want is move or resize the window.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1183673
Right.  If you don't need to set the Z-order of the window (position it "behind" or "in front of" other windows) than MoveWindow() is better.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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
Parsing XML instructions in Java/any other language.... 3 116
C++ Language error 28 247
How to convert MFC APP to Win32 APP. 19 97
Indy 10 not Receiving UDP broadcast 3 22
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

830 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