Solved

DoModal()

Posted on 1998-05-13
2
776 Views
Last Modified: 2013-11-20
How can I control the position of the dialog called by DoModal()
0
Comment
Question by:nhcuong
[X]
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
2 Comments
 
LVL 4

Accepted Solution

by:
piano_boxer earned 0 total points
ID: 1310263
The position can be changed in the dialogs own OnInitDialog() function. If you want to position the dialog from where you call DoModal, you need to pass the x/y point in member variables of you dialog class:

CMyDialog dlg;
dlg.m_x = 200;
dlg.m_y = 100;
dlg.DoModal();

---

BOOL CMyDialog::OnInitDialog()
{
    CDialog::OnInitDialog();

    SetWindowPos(NULL, m_x, m_y, 0, 0, SWP_NOZORDER|SWP_NOSIZE);

    return TRUE;
}

-----------------------
2 Points ??????????????
0
 

Author Comment

by:nhcuong
ID: 1310264
I've done as you directed. The position of main dialog or modal
is called by the main dialog change depend where I put SetWindowPos.
But modal always fix over main dialog, that's mean when I the modal
displayed, I can't see the main dialog.


0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

691 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