Positioning Dialog To Desktop

Using VC++, I have a dialog-based app.  I want to put the window in
the lower right corner of a desktop.  It seems I can't override the
positioin of the window set in the resource editor (where the window
coordinates are set).  How can I override this initial window position
to put it in the corner?

I've found how to get a pointer to the desktop, its width and height,
but using that to position the window in OnPaint didn't work.

Also SetPosition in the App InitInstance doesn't work.

The coordinates to my dialog are sitting in a resource file, so how
can I program to change that?

Thanks,

Matt
0
bonmatt10 (51)
12/30/2003 6:37:47 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
428 Views

Similar Articles

[PageSpeed] 26

Do the repositioning in your CDialog::OnInitDialog

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

    CRect DRect;
    GetWindowRect(::GetDesktopWindow(),&DRect);
    CRect WRect;
    GetWindowRect(&WRect);
    //you will also need to include the height of the taskbar in the
subtraction

SetWindowPos(NULL,SRect.right-WRect.Width(),SRect.bottom-WRect.Height(),0,0,
SWP_NOSIZE);

    return TRUE;
}

Ali R.
"matt" <bonmatt10@cs.com> wrote in message
news:c2838b8f.0312301037.68212ee3@posting.google.com...
> Using VC++, I have a dialog-based app.  I want to put the window in
> the lower right corner of a desktop.  It seems I can't override the
> positioin of the window set in the resource editor (where the window
> coordinates are set).  How can I override this initial window position
> to put it in the corner?
>
> I've found how to get a pointer to the desktop, its width and height,
> but using that to position the window in OnPaint didn't work.
>
> Also SetPosition in the App InitInstance doesn't work.
>
> The coordinates to my dialog are sitting in a resource file, so how
> can I program to change that?
>
> Thanks,
>
> Matt


0
nospam7515 (2086)
12/30/2003 7:44:52 PM
Ali,

I had to modify the GetWindowRect line, but otherwise it worked. 
Thanks!

ANy idea how to figure out the width of the taskbar at the base of the
screen (or even if someone running this programeven has one)?

Thanks,

Matt

"Ali R." <nospam@nospam.com> wrote in message news:<UAkIb.292$qv3.217904262@newssvr11.news.prodigy.com>...
> Do the repositioning in your CDialog::OnInitDialog
> 
> BOOL CMyDialog::OnInitDialog()
> {
>     CDialog::OnInitDialog();
> 
>     CRect DRect;
>     GetWindowRect(::GetDesktopWindow(),&DRect);
>     CRect WRect;
>     GetWindowRect(&WRect);
>     //you will also need to include the height of the taskbar in the
> subtraction
> 
> SetWindowPos(NULL,SRect.right-WRect.Width(),SRect.bottom-WRect.Height(),0,0,
> SWP_NOSIZE);
> 
>     return TRUE;
> }
> 
> Ali R.
> "matt" <bonmatt10@cs.com> wrote in message
> news:c2838b8f.0312301037.68212ee3@posting.google.com...
> > Using VC++, I have a dialog-based app.  I want to put the window in
> > the lower right corner of a desktop.  It seems I can't override the
> > positioin of the window set in the resource editor (where the window
> > coordinates are set).  How can I override this initial window position
> > to put it in the corner?
> >
> > I've found how to get a pointer to the desktop, its width and height,
> > but using that to position the window in OnPaint didn't work.
> >
> > Also SetPosition in the App InitInstance doesn't work.
> >
> > The coordinates to my dialog are sitting in a resource file, so how
> > can I program to change that?
> >
> > Thanks,
> >
> > Matt
0
bonmatt10 (51)
12/31/2003 1:44:39 AM
    You can get the work area size  ( without the taskbar ) using
SystemParametersInfo(SPI_GETWORKAREA... ) API.

    If you want to find the size of the taskbar, then take a look at the
SHAppBarMessage(ABM_QUERYPOS,...) API.


-- 
Cheers
Check Abdoul [VC++ MVP]
-----------------------------------

"matt" <bonmatt10@cs.com> wrote in message
news:c2838b8f.0312301744.6951f3de@posting.google.com...
> Ali,
>
> I had to modify the GetWindowRect line, but otherwise it worked.
> Thanks!
>
> ANy idea how to figure out the width of the taskbar at the base of the
> screen (or even if someone running this programeven has one)?
>
> Thanks,
>
> Matt
>
> "Ali R." <nospam@nospam.com> wrote in message
news:<UAkIb.292$qv3.217904262@newssvr11.news.prodigy.com>...
> > Do the repositioning in your CDialog::OnInitDialog
> >
> > BOOL CMyDialog::OnInitDialog()
> > {
> >     CDialog::OnInitDialog();
> >
> >     CRect DRect;
> >     GetWindowRect(::GetDesktopWindow(),&DRect);
> >     CRect WRect;
> >     GetWindowRect(&WRect);
> >     //you will also need to include the height of the taskbar in the
> > subtraction
> >
> >
SetWindowPos(NULL,SRect.right-WRect.Width(),SRect.bottom-WRect.Height(),0,0,
> > SWP_NOSIZE);
> >
> >     return TRUE;
> > }
> >
> > Ali R.
> > "matt" <bonmatt10@cs.com> wrote in message
> > news:c2838b8f.0312301037.68212ee3@posting.google.com...
> > > Using VC++, I have a dialog-based app.  I want to put the window in
> > > the lower right corner of a desktop.  It seems I can't override the
> > > positioin of the window set in the resource editor (where the window
> > > coordinates are set).  How can I override this initial window position
> > > to put it in the corner?
> > >
> > > I've found how to get a pointer to the desktop, its width and height,
> > > but using that to position the window in OnPaint didn't work.
> > >
> > > Also SetPosition in the App InitInstance doesn't work.
> > >
> > > The coordinates to my dialog are sitting in a resource file, so how
> > > can I program to change that?
> > >
> > > Thanks,
> > >
> > > Matt


0
CheckAbdoul
12/31/2003 2:03:33 AM
On 30 Dec 2003 17:44:39 -0800, matt wrote:

>ANy idea how to figure out the width of the taskbar at the base of the
>screen (or even if someone running this programeven has one)?

Well (a) the taskbar doesn't have to be at the botom of the screen,
and (b) I guess you could compare the work area (see Check's posting)
with the screen size to see if any appbars are present - the taskbar
is just a special case of an appbar, and there may be more than one
hanging around.

-- 
Bob Moore [WinSDK MVP]
http://www.mooremvp.freeserve.co.uk/
(this is a non-commercial site and does not accept advertising)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do not reply via email unless specifically requested to do so.
Unsolicited email is NOT welcome and will go unanswered.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0
bobm (116)
12/31/2003 1:15:35 PM
Reply:

Similar Artilces:

change horizontal header position in excel
Anyone know how to change the horizontal position of the HEADER or FOOTER in EXCEL???? I would greatly appreciate any help. Thank you for your time. pico Wrote: > Anyone know how to change the horizontal position of the HEADER o > FOOTER in > EXCEL???? I would greatly appreciate any help. Thank you for your time. Pico, Can't you go into View/Header-Footer and use the "Left-Center-Right" catagories? You could use spaces in front of your data to move back an forth. Dav -- Piranh ----------------------------------------------------------------------- Piranha's Profi...

Automaticall move pointer to the default button in a dialog box
I have the option in the Control Panel for Mouse/ Pointer Options/ Snap To set So that the mouse pointer automatically moves to the default button in a dialog box. If have a dialog box with no button in it and I add the line: Create("Yes",WS_VISIBLE|WS_CHILD|WS_TABSTOP|WS_GROUP|BS_DEFPUSHBUTTON,CRect(5,5,50,30),this,IDYES); The mouse will not be moved the Yes Button But if I have the line Create("OK",WS_VISIBLE|WS_CHILD|WS_TABSTOP|WS_GROUP|BS_DEFPUSHBUTTON,CRect(5,5,50,30),this,IDOK); I will move to the button Why and how do I get the mouse to move to the “Yes” button....

Google Desktop index dates?
Just noticed - while trying to sort a problem with other user's Outlook not indexing after Dec16 - that on 'my side' (XP Pro) GD says my OE email was indexed up to July 2012! My pc definitely says this is Feb 2010 so what is going on? (Nobody seems to be answering postings on 'google desktop/somethingsbroken') Cheers, S I think you can uninstall it via Add / Remove Programs. steve "spamlet" <spam.morespam@invalid.invalid> wrote in message news:eBd%23TFCpKHA.3948@TK2MSFTNGP06.phx.gbl... > Just noticed - while trying to sort a pr...

How to change content in dialog box?
I started a dialog-based project and want to change the pages of control sets in the dialog like using tab control. But I don't want the tab control apperance. I just want the whole page change to another page like install wizards. How can I achieve this? Thx a lot "Alex" <alexcheung@perceptiondigital.com> wrote in message news:%23z5JI10JEHA.3924@tk2msftngp13.phx.gbl... > I started a dialog-based project and want to change the pages of control > sets in the dialog like using tab control. But I don't want the tab control > apperance. I just want the whole pa...

Show desktop.scf appears in Outbox
Every now and then, I will see an email in my outbox with this subject "Show Desktop" and an attachment named "Show Desktop.scf." What is this (a virus)? How do I fix it??? Thanks. Tim ...

Position Transfers with GP 10 SP3 HR Position Control?
Is there anyone out there using GP 10 SP3 HR Position Control who knows how to do Employee Transfers? I'm trying to define the proper workflow for transferring/promoting an employee from one position seat to another and I think that I may have been missing something because at the end, even though I set an end date, I see 2 assigned positions: the old one and the new one; this includes Employee Seats, Position History, Organization Explorer, etc. Here are my steps at a high level: 1. With the Employee ID to be transferred, open Position Seats (Cards >> Human Resources >>...

Subtracting positive amts from negative and positive from positive
I have a problem with a spreadsheet that SOMETIMES would result in subtracting positive amounts from negative where I would want the result to show negative but only the difference between the negative and the positive. In other words, if B9 is negative and B31 is positive then I want the negative in B9 to be reduced by the positive in B31 and reflect a negative amount (ie. -900 minus +200 = -700) but sometimes the amount in B9 is positive and B31 is positive and so then I just want B31 subtracted from B9 to reflect a positive (i.e. +900 minus +200 = +700). I found another an...

Changing the view on the convert dialog
Hi, Anyone out there know where to change the view of Convert Lead dialog box i.e. 1.) Created a new Lead 2.) Clicked on Convert Lead 3.) Convert lead popup dialog appears and I want to change the Potential Customer label to Customer/Partner. Thanks in advance. Kim. You can modify this page, but it's not a supported change. Take a look at the \SFA\leads\dialogs\conv_lead.aspx page. Matt Parks MVP - Microsoft CRM ---------------------------------------- ---------------------------------------- On Thu, 13 Jan 2005 21:43:02 -0800, Kim <Kim@discussions.microsoft.com> wrote: Hi,...

Extending XmlDocument and associated classes to provide character positions.
OK here's is what I wish to do. I have an XML file that I want to read into an XmlDocument. I then want to be able to interrogate the XmlNodes to find both their start AND end character positions within the original file. So e.g. <tagA><tagB>sometext</tagB></tagA> ^ ^ ^ ^ ^ ^ 0 6 12 19 26 33 tagA: start=0, end=33 tagB: start=6, end=26 sometext: start=12, end=19 I have seen the LineInfo example within the .net docs, see: "Extending the DOM" ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconextendingdom.htm and ...

Which one do I position?
I am displaying a formview object called CVendorView in a childFrame called CVendorCF. I display this on the screen and resize the childframe to fit the view. I would like to place my different views in various spots on the desktop when the user clicks on the appropriate menu item. Which one do I move or set a position for the childframe or the formview? William Gower wrote: > I am displaying a formview object called CVendorView in a childFrame called > CVendorCF. I display this on the screen and resize the childframe to fit > the view. I would like to place my different views...

CListCtrl: want to be able to select a row at any position along it's length in report-view
I've set up a basic CListCtrl in the dialog editor (with headings) and i've noticed that i can only select the items in the first column to select a particular row and that only the item in the first column is highlighted when selected. Most other software with a similar display (e.g. outlook express) actually allows a row to be selected by clicking anywhere on a particular row and also highlights the entire row when selected. Is there some kind of special "style" setting for this type of behaviour - has anyone else out there noticed/fixed this problem? Regards, Kar...

how do i change the color of a dialog box in Vc++.net
Iam new to Vc Environment. Please help me to change the color of a dialog box in SDI application in Vc++.net. Thanks in Advance. Mahinder. You should handle OnCtlColor if you are using MFC. Take a look at codeguru for sample code. -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "Mahender" <mahinder_gudur@yahoo.com> wrote in message news:69f916df.0401192216.317d4e8d@posting.google.com... | Iam new to Vc Environment. | | Please help me to change the color of a dialog box in SDI | application in Vc++.net. | | Thanks in Advance. | | Mahinder. ...

Desktop has rotated 90 degrees ccw!
I have a Dell desktop, using a Vista 64-bit platform. I accidentally hit the keyboard with my hand, which caused the desktop to rotate 90 degrees ccw. How do I go about rotating the screen back to normal? Gordon Biggar Houston, Texas Look in your system tray for a screen properties icon, probably either ATI or nView. That will include the screen rotation option. Your Dell manual may tell you what the relevant keyboard shortcuts are. On 25/11/2009 20:11, Gordon Biggar wrote: > I have a Dell desktop, using a Vista 64-bit platform. I accidentally > hit the keyboa...

Axapta Positions! CRM Positions!
Hello Everyone, I thought to get in touch with you all in regards tomy Axapta Positions We now have several Permanent and Contract positions available throughout the United States that require NO relocation. We are looking for the following candidates: Axapta Developers/Programmers, Systems Administrators, Project Managers, Functional Consultants with experience in the following modules: Trade and Logistics, Financials, Production, Manufacturing/Warehouse Management, etc. Our Contract positions require 70 percent travel and also allow for remote work. Contract length can start at 3 or 6...

Cursor position?
I would like that when I open workbook, cursor and view appears from first cell (A1). I have put in workbook open event Range("A1").Select , but workbooks open in the middle (vertical) of worksheet, depending where is cursor when I exit workbook. I hope I explained well, I want that I can see cell A1 when I open workbook, and that workbook doesn't open in middle of worksheet. If someone can help? Thank you Marc, Try this - add the macro to the ThisWorkbook module of your workbook. Save the workbook, close it and reopen it. All sheets should open up to cell A1. Private...

how to use DirectUIHWND in a Dialog Box
Hi all, There is a DirectUIHWND control that you see in the left pane of "my computer" window in XP. It looks like >> vertically positioned. I need to use it in a chat program like yahoo messanger. Please suggest how to use this control. Regards Shoeb "shoeb" <shoeb@octro.com> ha scritto nel messaggio news:Oi95g0a5IHA.832@TK2MSFTNGP05.phx.gbl... > There is a DirectUIHWND control that you see in the left > pane of "my computer" window in XP. It looks like >> vertically > positioned. > I need...

Set position into a worksheet using vba
I created a chart as an object in a worksheet, but can't set the position inside it. Any help? Thanks in advanced How did you create the chart object? This allows you to define the position exactly: Worksheets("Sheet1").ChartObjects.Add(100,150,300,225) where the numbers are left, top, width, and height of the chart object in points with respect to the top left of the sheet. For an existing chart, again you should adjust the chart object, which is the parent object of the chart: With ActiveChart.Parent .Left = 100 .Top = 150 .Width = 300 .Hei...

Vc.Net member variables for dialog in MFC extension DLL not available ?
I have an application with MFC extension DLL's with dialog's both in the main app and in the DLL's. Apart from care in the resource Id specification it works fine using classwizard in Vc 6, allowing me to define member variables in the min app and the dll's However on converting to Vc.Net the Add Member Variable wizard is unavailable for the dialogs in the DLL's, but seems to work normally in the main app. Why is this so ? and is there a work-around ? Is this related to resource issues. All the code and variables generated by Vc 6 work fine,I just can't see or modify t...

Load a toolbar with Bitmaps and menu in a Dialog Box
How to load a tool bar and menu in a Dialog Box. I did create a Dialog box when abutton is clicked . 1)I guess we need to create a variable of CToolBar and use this in Create,Right !!! 2) For Menu... Viewer = new CCVDlg(); //Check if new succeeded and we got a valid pointer to a dialog object if(Viewer != NULL) { BOOL ret = Viewer->Create(IDD_DLG_VIEWER,this); if(!ret) //Create failed. AfxMessageBox("Error creating Dialog"); Viewer->ShowWindow(SW_SHOW); } else AfxMessageBox("Error Creating Dialog Object"); Pls guid...

Need a Position in CHtmlView #2
Hello. I need to get a position of tag in Chtmlview. I found 'AbsolutePosition' in CWebBrowser2, but I don't know to use it. Please help me. Thanks. ...

Number position
I would like to count the Lottery position as a total per number . Such as Sheet2 would have the base data: Date 1 2 3 4 5 6 12/22/2006 40 3 38 22 25 48 12/23/2006 40 48 1 49 13 14 On Sheet1 the count would occur. Therefore, 6/49 would be the following. Number 1 2 3 4 5 6 1 1 2 1 : 40 2 : 48 ...

Execute shell or open a dialog in a pecific screen in multi-screen enviroment
Hi, How can I open a new dialog (modal or modeless), execute a shell command or do any other visual MFC operation on a specific screen in a multi screens enviroment? Or, how can I get access to the information of how many screens are connected and their ID#? Thanks in advance, Stilgar. ...

SysAdmin Toolset
Hi Folks I am a SysAdmin and to remotely connect to my windows servers I use remote desktop, I was wondering if anyone knows of a free remote connection manager that allows multi-tabs. Meaning connecting to multiple servers. Thanks for any help aluciani <aluciani@gmail.com> wrote: > Hi Folks > > I am a SysAdmin and to remotely connect to my windows servers I use > remote desktop, I was wondering if anyone knows of a free remote > connection manager that allows multi-tabs. Meaning connecting to > multiple servers. > > Thanks for any help Thi...

how to get a dialog resource into a mfc child win?
Aji! i have a question about building a litle app: i'd like to have an mdi app, where i can create child windows from a resource and drag them arround in the main window. how to do this? i tryed it with loadframe and the id of my resource but i only got a new, empty child win :( or is there another way to do this window in window stuff without mdi? mfg timm Abubadabu wrote: > Aji! > i have a question about building a litle app: > > i'd like to have an mdi app, where i can create child windows from a > resource and drag them arround in the main window. > how to d...

When losing focus from dialog, window is not updated.
Hello, I have made a simple example to explain what my problem is. 1. Create a Dialog based application called 'Counter' with the appwizard. 2. Place a Static Text in your dialog. 3. Add a CString member variable 'm_strCounter' to the Static Text with the ClassWizard. 4. Add a button called 'Count' to the dialog. 5. Add an OnCount() function for the BN_CLICKED message (of the 'Count' button) with the ClassWizard. 6. Put the following code in the OnCount() function: void CCounterDlg::OnCount() { // TODO: Add your control notification handler code here BY...