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
650 Views

Similar Articles

[PageSpeed] 52

>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 (15972)
6/7/2005 1:58:29 AM
Reply:

Similar Artilces:

GP v10 - windows
Just upgraded to v10 - how can we get the windows we are working in to stay visible on the screen? we often have to work with more than one window at a time and to have them all "hide" at the bottom is a nuisance. The bad news is you can't. The good news is that it grows on you after a while. I still don't like it, but it doesn't drive me crazy anymore. "Pam" <Pam@discussions.microsoft.com> wrote in message news:88C98232-7189-475A-A73B-D3A83B6BAF04@microsoft.com... > Just upgraded to v10 - how can we get the windows we are working in to stay &g...

MFC for windows Vista
will the MFC be extended for Windows Vista. I mean will there be new MFC specific APIs introduced to MFC for windows Vista? If so, will we have to wait for Orcas or will the be some sort of vs 2005 "addon" ? I believe there will be MFC wrappers for new controls, but we won't know for sure until after Vista is released (I think a year away) if history proves out. There may be controls from 3rd party vendors earlier, but I wouldn't count on Microsoft adding stuff into MFC to support a beta version of the OS. I've heard that there are some new controls in Vista, bu...

Outlook keeps prompting for logon..
User is on Outlook 2k3, latest service packs, updates, etc. Mailbox lives on Exchange 2007 (SP1). Everytime the user starts Outlook they're prompted to logon. I've disabled the logon prompt at startup option (and enabled it and then disabled it again), but it's still happening. I've tried it with cached mode on and cached mode off. I've tried it with offline mode enabled and disabled. I've tried deleting his profile and recreating it. I've tried switching to an RPC/HTTPS connection. Finally, i completely uninstalled Outlook 2k3 and installed Outlook 2k7. Not...

Remove items from "Update Price" window
My uncle uses Money 2006 and has been trying to figure out how to prevent old investments from showing up in the "Update Price" window when he wants to update an investment manually. It's really just an annoyance and makes it take longer to search through the list to find the one he needs. In microsoft.public.money, N1tr0 wrote: >My uncle uses Money 2006 and has been trying to figure out how to prevent old >investments from showing up in the "Update Price" window when he wants to >update an investment manually. It's really just an annoyance and mak...

Windows xp / avast
Hello , Might someone be able to tell me if you have Avast 5.0 free , does it allow scheduled tasks . I've had NO luck in trying to get any info from them and I've tried google with no success . xp pro i.e 7 oe 6 The error is : " ox80070005 - access denied ! Try using the task page browse button to locate the application " . I've tried this but I see no mention of Avast . TIA , D. Sp 3 "D." <wdstk@sover.net> wrote in message news:eS8UMA75KHA.3656@TK2MSFTNG...

Confirmation of receipt keeps trying to send and fails
Help! I received an email message that requested a confirmation that it had been received. I told it to send confirmation, but it failed when attemtping to send it and produced an error. I tried deleting the email message and everything in the draft items and Outbox, but every time I switch on Outlook the darn thing tries to send this email confirmation. It seems there is nothing I can do to stop it, even though I cannot see it! I have tried uninstalling Office 2003 and reinstalling it, but all of my settings are remembered as are all the old emails. I just cannot seem to get rid of it! ...

Help Old addresses keep coming up
When I go to send an email to some people their old email addresses keep popping up together with their current ones. I do not have them listed in contacts or in an address book. It is a minor annoyance. I am using Outlook 2003. It is a minor annoyance. How do I delete these old addresses? Where they show up is where I am entering the e-mail address on the item being e-mailed. Thanks You did not specify how you were entering the addresses. Presumably you are using autocompletion and they are...

Windows update problem. Clueless
Here is my windowsupdate.log for today, I cannot connect to windowsupdate website period. Not sure what is going on. Can someone help me decode this nonsense? 2010-05-25 17:20:51:671 1484 b98 AU ############# 2010-05-25 17:20:51:671 1484 b98 AU ## START ## AU: Search for updates 2010-05-25 17:20:51:671 1484 678 DnldMgr *********** DnldMgr: Regulation Refresh [Svc: {9482F4B4-E343-43B6-B170-9A65BC822C77}] *********** 2010-05-25 17:20:51:671 1484 678 DnldMgr Contacting regulation server for 20 updates. 2010-05-25 17:20:51:671 1484 b98 AU ######### 2010-05-25 17:20:51:687 1484 ...

alternative application to Windows Live Mail?
Hey folks, can someone recommend me a 'mail client' application that will work with my free hotmail live account in any of pop3 or imap protocol,.. besides Windows Live Mail?... I can't use this application because it's minimal requirements are twice the RAM and a faster processor than what I have on my old box... I've tried some 6-7 applications that should supposedly make Outlook Express access my hotmail free account but none have worked, so I hope someone has solved this little problem. Thing is, I could cancel that account and move on to another mail pro...

Changing Location of Templates
I'm running Excel 2002 on XP Pro. I want to change the location of my templates directory. "Help" says to go to Microsoft Shortcut Bar, but of course, in XP, there's no such thing. In Word, there's a tab under Tools/Options/File Locations, but not in Excel. What do I do? Thanks, Bill Hi Bill See the page from MS about Office 2002 Templates http://support.microsoft.com/default.aspx?scid=kb;EN-US;290232 ** Posted via: http://www.ozgrid.com Excel Templates, Training, Add-ins & Business Software Galore! Free Excel Forum http://www.ozgrid.com/forum *** Thanks, D...

using money on windows nt
I have been trying to install the trial version of money on windows nt. However, the installation is never completed. The message I get is this: money requires either windows 1998 second edition, 2000 service pack3, or xp. Can I run money on windows nt? To use Microsoft� Money Deluxe 2005 you need: a.. Windows� 98 SE or later, Windows 2000 SP3 or later, or Windows XP operating system b.. Multimedia PC with Pentium 166 or higher processor (or compatible); Pentium II 266 (or compatible) required for Windows XP; Pentium II 300 (or compatible) recommended c.. 32 M...

Windows 2000 domain/ Exchange 2003 servers, need to change domain/org name.
Hi all, Our company has been acquired by another company and we have a need to change our internal domain name from org1.local to org2.local and change our (2) Exchange 2003 server's external domain name to @org2.com. I see that there are many different ways to do this, my question especially from those who have gone through this is, which do you feel is the best way to do this and why? We don't have a problem with buying additional hardware but the less the better. Notes: We will need to keep the original email domain name @org1.com active for at most 6 months. Both domain and excha...

Excel 2003 for Windows XP
Does anyone know if it's possible to run a simple macro automatically when an Excel file is opened? Thanks Yes in the Workbook_Open() event "Richard" wrote: > Does anyone know if it's possible to run a simple macro automatically when an > Excel file is opened? > > Thanks have a look in vba help (alt f11) index for workbookopen -- Don Guillett SalesAid Software donaldb@281.com "Richard" <Richard@discussions.microsoft.com> wrote in message news:51958458-AF71-43F9-AF12-52E06249EE0C@microsoft.com... > Does anyone know if it's possible ...

Keep Lines Together; Keep with Next
I'm working in Vista. When I select lines and click on "Keep Lines Together," the lines do not stay together. They stay together if I also click "Keep with Next," but I'm working on a booklet in which the pages are 1/4 of a letter-sized page, and a lot of space (4 lines) is left at the bottom and wasted if I also click "Keep with Next." Why won't "Keep Lines Together" keep the lines together? The project is a small, bound country club booklet, with names, addresses, phones, etc. Each entry might be 2, 3, or 4 lines. Any h...

Name Conflict window pops up, when I try to open a saved worksheet
I keep getting this window and no matter how i try to rename it , it wont let me, but it wont open -- w ...

Windows XP error code 0x80240022
Hi I need someones help please!! I downloaded Windows Defender and i keep getting the error message so cannot download the updates. I also accidentally deleted security files and lost the entire SYSTEM RESTORE FACILITY ( please don't shout, i know i am an idiot!) 2 Questions. 1~ Is there a way of installing system restore again without buying a new disc? as mine was already installed on my computer when i bought it ( i already tried the typing in the black box thing and had no joy- i also spent 2 3 days exploring Windows and cannot work out if it can be done) 2~ How on e...

inbox window format
in the Inbox window ... at the top is: From Subject Received etc The Receive column disappeared? How do I get it back? What is this group of columns called? Thank you Bill Billy wrote: > in the Inbox window ... at the top is: > From Subject Received etc > The Receive column disappeared? > How do I get it back? > What is this group of columns called? > Thank you Bill Right-click on the column header, pick Field Chooser, add whatever fields you want, drag the fields around to position them wherever you want. "Billy" <Billy@discussions....

why do my pictures keep disappearing?
Although I have checked the box in 'pictures' any form of graphic or word art that I have inserted into my publication keeps disappearing! If I click in the general direction of the insertion the bounding dots appear, but no picture Are you sure you have view, pictures, detailed display checked? If so try updating your graphics driver... -- Mary Sauer MS MVP http://office.microsoft.com/ http://www.msauer.mvps.org/ news://msnews.microsoft.com "JG" <JG@discussions.microsoft.com> wrote in message news:57E101AC-A758-400A-9269-3B68B754CA0E@microsoft.com... > Altho...

windows xp profesional OEM
Hi i need to know what i need to do if my pc is broken and i need change my montherboard or all my pc with new one.. I can use my Xp again with my new pc or montherboard with same cd or i need new cd key and how do i proceed tnx mihai <mihai@discussions.microsoft.com> wrote: > Hi i need to know what i need to do if my pc is broken and i need change >my montherboard or all my pc with new one.. > > I can use my Xp again with my new pc or montherboard with same cd >or i need new cd key and how do i proceed ...

Outlook 2003 keeps asking for password for POP3 account
I am running WinXP Pro and Office 2003. My Outlook 2003 keeps popping up intermittently a pop-up box requesting me to re-enter the POP3 account password. Now, there is nothing wrong with the password already entered (check box to save password), so all i am having to do is click OK, but it is really annoying. Does anyone know what i can do to stop Outlook from doing this? Thanks for your help. ...

Windows Mail Calender
when ever i add an event in windows live its automatically going to wrong date at the time of saving Windows Live Solution Center FAQS http://windowslivehelp.com/solution.aspx?solutionid=e2b2292c-2f10-4c7e-8785-e1d898ece45d Windows Live Calendar http://windowslivehelp.com/product.aspx?productid=16 Windows Live Calendar Forums http://windowslivehelp.com/forums.aspx?productid=16 Windows Live Calendar Solutions http://windowslivehelp.com/solutions.aspx?productid=16 -- ...winston ms-mvp mail "Faisal Habeeb" <Faisal Habeeb@discussions.microsoft.com>...

how can I keep a tab in place?
I have workbooks with multiple worksheets. I would like to keep the summary tab in a fixed (first) position so that the user can easily, quickly find it without using the l<, <, >, >l (arrow) tabs. I use hyperlinks to get from the summary tab to the other tabs, and I know I can hyperlink tab back... but I'd rather not use the hyperlinks too much. Tools - Protection - Protect workbook (for structure) Or, create a custom button/macro that navigates to the summary sheet. -- Best Regards, Luke M "missy8892" <missy8892@discussions.microsoft.com>...

Suggestion: Refresh current window mode
It would be nice if there were an option in CRM to refresh the window that you're in rather than open a new window. e.g. When you are on an contact associated view in an account and you double click on the contact, the contact window replaces the account window so that the number of windows open is minimized. Lee Adler ...

How do I keep the home tool bar on top
An hour ago the home tool bar stoped being displayed. I can restore it but every time i hit a key the tool bar disapers. How do I keep the tool bar on top while I am typing. You've minimized the Ribbon. Double-click any tab on the Ribbon to restore it. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "RobertTaylor" <RobertTaylor@discussions.microsoft.com> wrote in message news:081A95C4-76B9-47E2-A4E6-83A080233AD0@microsoft.com... > An hour ago the home tool bar stoped being displayed. I can rest...

Reestablishing Outlook Files from a Different Location
Just recovering from a crash with a new hard drive. Using XP with Outlook 2003 and need to change from the default path to c:\exchange for the location of all Outlook Files, Mail Boxes, Address Book, Contacts, Folders, etc. Managed to change path for Address Book, but not the rest. Not on network Need to recover old e-mail, folders, etc. Any and all assistance gratefully appreciated. -- Les Les <Les@discussions.microsoft.com> wrote: > Just recovering from a crash with a new hard drive. Using XP with > Outlook 2003 and need to change from the default path to c:\excha...