Keeping Window Location

Hello,

I've written a DLL which consists of a dialog box.  This dialog box gets 
invoked when a user pressess a specific button in parent app.  When this 
dialog box is invoked, a user can move it around the screen and close it (fun 
stuff!).  

My question is this: is there a way to remember the last position of this 
dialog box so when it is closed and invoked again, it will start from its 
last position?  I think Dialog Properities can enable this functionality but 
I am not sure which box to check to make it work.  Any suggestions?

Thank you,
Victor.
0
victorsk (138)
6/6/2005 9:22:01 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
806 Views

Similar Articles

[PageSpeed] 7

>My question is this: is there a way to remember the last position of this 
>dialog box so when it is closed and invoked again, it will start from its 
>last position?

Victor,

Use GetWindowRect (in WM_DESTROY) to save the coordinates &
SetWindowPos (from WM_INITDIALOG) to restore the position.

Dave
-- 
MVP VC++ FAQ: http://www.mvps.org/vcfaq
0
davidl7375 (2060)
6/6/2005 11:36:51 PM
Fantastic, thank you.

"David Lowndes" wrote:

> >My question is this: is there a way to remember the last position of this 
> >dialog box so when it is closed and invoked again, it will start from its 
> >last position?
> 
> Victor,
> 
> Use GetWindowRect (in WM_DESTROY) to save the coordinates &
> SetWindowPos (from WM_INITDIALOG) to restore the position.
> 
> Dave
> -- 
> MVP VC++ FAQ: http://www.mvps.org/vcfaq
> 
0
victorsk (138)
6/7/2005 12:11:02 AM
I usually call GetWindowPlacement, store the results in the Registry, and reuse them using
SetWindowPlacement when the window is re-created. My Registry class has features that
manage window placement nicely. Send me email and I'll send you the latest version...it
isn't on my Web site yet.
				joe

On Mon, 6 Jun 2005 14:22:01 -0700, "victorsk" <victorsk@discussions.microsoft.com> wrote:

>Hello,
>
>I've written a DLL which consists of a dialog box.  This dialog box gets 
>invoked when a user pressess a specific button in parent app.  When this 
>dialog box is invoked, a user can move it around the screen and close it (fun 
>stuff!).  
>
>My question is this: is there a way to remember the last position of this 
>dialog box so when it is closed and invoked again, it will start from its 
>last position?  I think Dialog Properities can enable this functionality but 
>I am not sure which box to check to make it work.  Any suggestions?
>
>Thank you,
>Victor.

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
6/7/2005 1:58:29 AM
Reply:

Similar Artilces:

Allow for a Budget Transfer window in Great Plains
There is a need for a Budget transfer window in Great Plains Dynamics. This could be similar to a journal entry window that checks for validity of acocunts and balances. Currently, a transfer must be entered manually in the Budget Mtn window which allows for a great deal of error and with no edit report. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the M...

Log in Windows Mail Vista
Dear sir/miss/misses, When I give up my right username and password, Windows Mail won't make aconnection with the server. Do you know a solution for this problem? With kindest regards, Ms. G. Pol "Geerte Pol" <g.pol6@kpnplanet.nl> schreef in bericht news:uErHQ$7iKHA.1236@TK2MSFTNGP04.phx.gbl... > Dear sir/miss/misses, > > When I give up my right username and password, Windows Mail won't make > aconnection with the server. Do you know a solution for this problem? > > With kindest regards, > > Ms. G. Pol "Ge...

recovery of deleted e-mails in Windows Mail
I recently permanently deleted several e-mails from the deleted file and need to recover them. I have seen different software packages claiming to do this. I am not a Geek (no ofense) and just have basic computer skills. My question - are these softward applications easy to use or do you need to to have higher skill levels? Is is safe to download directly from the internet? Any advice would be appreciated. Jake -- Jake428 Posted via http://www.vistaheads.com You can try a file undelete utility, such as Recuva: http://www.piriform.com/recuva Frankly, the success ...

What does Sync mean in windows live mail?
What does Sync mean in windows live mail? Send and Receive in Windows Live Mail 2009 http://liveunplugged.spaces.live.com/blog/cns!F92775FC46A390CA!644.entry -- ...winston ms-mvp mail "Bob" <bobbREMOVE-CAPSus99@CAPSyaREMOVE-CAPShoo.com> wrote in message news:eFymNJjoKHA.5464@TK2MSFTNGP02.phx.gbl... > What does Sync mean in windows live mail? What an unbelievable decision. Why change the informative and logical "Send/Receive Mail" in favour of an obscure bit of computer-speak? Bert "Bert Coules" <mal@bertcoules.co.uk&g...

Subscribing to calendar in Windows Live
From what I gather I need to subscribe to my Outlook calendar using Windows Live Calendar, so that I can view it online (going by this link: http://office.microsoft.com/en-us/outlook/HA103887591033.aspx). I have been trying for three days and keep getting the message "Calendar subscription error. There's a problem subscribing to calendars right now. Please try again later." Is this service down? ...

User selects file location
I have a macro that formats data and saves certain portions of a worksheet into a csv file. The macro prompts the user for a path to save the file to. Instead of the user typing in the path, is there a way to have them select it somehow...similar to what happens when you select File - Save As from the main Excel menu? I appreciate your feedback. Monica a drop down box perhaps. http://www.contextures.com/tiptech.html -- Don Guillett SalesAid Software donaldb@281.com "Monica" <anonymous@discussions.microsoft.com> wrote in message news:941e01c4336e$c3b64ce0$a1012...

Windows in Taskbar
I'm using Office 2007 with Windows XP, SP3. I have show all windows in the taskbar checked off in options, but all my open Word documents are in one window. I don't know how to explain that any better; I have to click on the window, and my documents are listed there. Then I need to click on the one I want to open. How can I get them all to display on my taskbar the way they used to with Office 2003? Thanks. Note that if you have many documents open at the same time, they will be grouped on the taskbar. To turn off that option: Right-click the taskbar and choose Pro...

CFile::Seek() runtime error in Windows 98/ME
Hi, in my application I have this code: #define POS_CABECERA 258048 CFile f; f.Open(m_fichero,CFile::modeRead|CFile::typeBinary); f.Seek(POS_CABECERA,CFile::begin); f.Read(config,sizeof(cfgstruct)); f.Close(); POS_CABECERA is a #defined position on my file (the file that I'm opening is the own executable), and in Windows 2000/XP all works fine, but when i run in Windows 98/ME I have a runtime error in the call to Seek, what i am doing wrong? I don't have more info about the error because my Visual Studio is installed in a Windows XP, by the way, can I debug my application ru...

how to restore correct 'favorites' location?
in vista, suddenly favorites are gone because the location of the favorites file is wrong! the good old favorites file is still there in documents, but the path listed for favorites in IE is a non-existent folder in my 'music' folder. so favorites comes up empty in the IE menu. somehow it got changed. how do i tell IE7 (IE8 would not install on this computer) where it's 'favorites' folder is? this should be the default location, but where can i set it to that?i -- musicman toronto In what operating system? Try this and see if it helps: You can chang...

Windows cannot open Microsoft Outlook.lnk
I have just recovered from a major windows fault but when trying to open Outlook I get the message in the title above. I have lost my shortcut mechanism! Can anyone help please -- kjd http://forums.slipstick.com ...

Minimize/Maximize, Restore Window buttons do not work
Buttons do appear in title bar of Excel program and in the individual worksheet, but clicking on any of them does not work. ...

IE keep saying "Opening page..." for ActiveX with async property
I tried posting this question to microsoft.public.vc.mfcole, but apparently that is an area only suitable for getting answers to simplistic questions. I've not gotten one response for questions I've posted there. I'm hoping there is some knowledgeable, sharing guru in this area that can help... I have a problem that is related to having an asynchronous property in a an ActiveX control that is used on a web page. If you build the MFC ActiveX Control App Wizard project and put it on a page, no problem--IE will load up and the "Opening page..." message wil...

OWA and Windows 98
Dear Sir or Madam: I have a question for you. I can't seem to find an answer. Our Outlook Web Access works fine, except for computers that are running Windows 98. Is there a setting that you need to change on Exchange Server 2003 to let it access OWA? If you have any ideas, please let me know. Thanks for your time! Brenda What version of IE are you using? The recommendation is for version 5.01 or later. -- Michael Bell Bell Consulting Services, Inc. No emails please. "Brenda" <brenda@capitaltracer.com> wrote in message news:6a9001c47598$49e1f380$a401280a@...

Windows Media Player error
While i am playing music through windows media player,the music will stop when i alternet tab to warcraft III. Can anyone help me solve my problem? My other friends does not have this problem. -- cleve23 ------------------------------------------------------------------------ cleve23's Profile: http://forums.techarena.in/members/167947.htm View this thread: http://forums.techarena.in/media-player/1286618.htm http://forums.techarena.in On Sun, 27 Dec 2009 18:16:18 +0530, cleve23 <cleve23.43utd8@DoNotSpam.com> wrote: > >While i am playing music through w...

[W2K8 R2]Unable to install Microsoft Windows Mobile Device Center 6.1
Hi there, we are unable to install Microsoft Windows Mobile Device Center 6.1 on our Windows Server 2008 R2 server. The error message tells us that a component is missing but which one, we don't know :-( Best regards Philippe Le Page You may want to ask them here. http://social.microsoft.com/Forums/en-US/windowsmobileactivesync/threads -- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "Oriane wrote: > Hi there, > > we ...

Show Window
I am currently developing a MFC SDI application. I want to integrate a tray icon with it. When the application is minimized it hides by ShowWindow(SW_HIDE) and then when double clicked on tray icon shown by ShowWindow(SW_SHOWNORMAL). But the problem is if some other application is activated after my application is minimized, ShowWindow shows it but it's behind some screen. I have tried with SetFocus didn't work. Please help me to solve this problem. Thank you. Varuna Try BringWindowToTop. ---- Ajay Kalra ajaykalra@yahoo.com In addition to Ajay's idea you can also use SetFor...

Where can I find a VAT book keeping template?
Help! I want to do my VAT for the year in excel but I cant be bothered to make a template. Any Ideas where I can get one, checked templates online but couldnt see any suitable! ...

Crerating docking windows
Hello, How to create docking windows, similar to what we have in Visual Studio (Solution explorer, resource view, Propterites......) using MFC? Regards Ravi > How to create docking windows, similar to what we have in Visual Studio > (Solution explorer, resource view, Propterites......) using MFC? Look at CSizingControlBar at http://www.datamekanix.com/ . Same code is available at codeguru/codeproject but the one at datamekanix is the latest. -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com You have to pay for this one, but it works and it's pretty slick: http://www.codejoc...

Brother MFC 8420 compatibility with Windows XP
I have a Brother MFC 8420 which serves as my printer. I am running Windows XP 2002 Home Edition and whenever i try to turn my computer off, it gets as far as "Windows is shutting Down" and stops. It does not shut down unless I have turned my MFC off before starting the shut down. any one have any ideas? Thanks. That is the wrong kind of MFC. This MFC group is for programming using Microsoft Foundation Classes. Try here: http://www.brother.com/library/websites/www.com/top_new/support/index.htm AliR. "Sam Goodbaum" <SamGoodbaum@discussions.microsoft.com>...

Determining public folder server from Windows Outlook
In short, is there a way to determine the name of the public folder server from Windows Outlook? The main Exchange mail server is easy, but what about the public folder server? Up until a few days ago, my Entourage scheduling functions worked okay because long ago, someone in IT told me the name of the public folder server. But the company changed all of their servers -- it was hard enough finding out the Exchange Mail server, and no one seems to know the public folder server name (my old contact left the company). LDAP servers were not changed. I have Outlook 2002 and also 2000 for Window...

Visio 2002 EA Tool Windows are extremely frustrating
Every time I open a tool window it opens in its default location on the screen. I use a dual-monitor setup so that I can avoid having all the tool windows of a program on the same screen as the main document. Microsoft must not want me to do this because they are working against me. What is so hard about making a simple function to read/write window positions from/to the registry or a file??? As a standard, I do this when developing even the simplest of applications. Does anyone know how to fix this or do I have to write my own freakin plugin to do it myself??? Which tool window are yo...

I cannot seem to send a page or link. It keep telling me its blo.
I can't seem to send a page or link. I keep getting a message stating is is blocked. What can I do to perform this action? ...

Outlook 2007 Shared Calendars In Windows Live Mail
I just shared my work calendar in Outlook 2007 and subscribed to it in Windows Live Mail. The name of the calendar is showing up, but none of the calendar items display in Live Mail. When I view the calendar online using the calendars.office.microsoft.com link the data is there. Is there something I need to do in either Outlook or Live Mail to complete the process? Thank you, Robert I have been doing some additional investigating and in the web calendar it is giving me the following error: This calendar wasn't updated because of a problem contacting the publisher. We'll ...

problem with contact folder from windows 7
I am with the following problem When I try to send an email from a contact in the Contacts folder windows 7 64 bit says it's necessary configure office outlook as default email client but the strange thing is that I have this program already configured Outlook 2007 to do so and in fact is the single e-mail client installed on my computer any ideas for a possible solution??? State more precisely the steps that produce this message. State what you specified as your default email client for your OS. State how you configured your mail transports and address book service in ...

AppleScript to keep Office 2004 or X from opening files and database on wrong drive?
I've noticed that immediately after I've cloned volumes to the backup internal hard drive with Retrospect's "Duplicate" feature, the first time I click on a Word or Excel file alias, it leads to the wrong drive. It seems that that the files on the backup drive at that point might be seen by OS 10.3.x (and Office) as newer/more recent than what's on the primary drive from which they've been cloned.. I was told that there "always" have been "minor issues" with Retrospect and aliases. Unfortunately, I learned from experience that "minor&qu...