Newbie How to : Move a control's position on a dialog

Hi All
I have a control on a Dialog which I need to have displayed
in a different position in different circumstances.
....................................................................................................................
Control Id                    : ID_My_DTP
Control Variable type   : CDateTimeCtrl
Control Variable name :  m_ctrlDTP

In the .rc file it is defined as

CONTROL         "DateTimePicker1",ID_My_DTP,"SysDateTimePick32",
                    DTS_RIGHTALIGN | NOT WS_VISIBLE | WS_TABSTOP,262,49,56,
                    13,WS_EX_TRANSPARENT
 ...................................................................................................................I would like to be able to change the co-ordinates & size to 203,265,76,13I have tried,   1/    m_ctrlDTP.SetWindowPos(NULL,203,265,76,13,WS_VISIBLE)   2/    m_ctrlDTP.SetWindowPos(&CWnd::wndBottom,203,265,76,13,WS_VISIBLE);I am not sure that I am using SetWindowPos is the correct fashion (or if Ishould be using it all !!) as it says I should be using const CWnd*pWndInsertAfter as the first parameter but I dont know how to go aboutgetting this.A simple example would be much appreciated,Jay

0
3/22/2005 2:43:42 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
676 Views

Similar Articles

[PageSpeed] 11

Look at [ MoveWindow ] Api buddy


--

With Regards
Alok Gupta
Visit me at http://alok.bizhat.com

                           "I Believe this will Help"
"Jay" <itsjayceecee.NoSpam@hotmail.com> wrote in message
news:uPzj$2uLFHA.656@TK2MSFTNGP14.phx.gbl...
> Hi All
> I have a control on a Dialog which I need to have displayed
> in a different position in different circumstances.
>
.............................................................................
........................................
> Control Id                    : ID_My_DTP
> Control Variable type   : CDateTimeCtrl
> Control Variable name :  m_ctrlDTP
>
> In the .rc file it is defined as
>
> CONTROL         "DateTimePicker1",ID_My_DTP,"SysDateTimePick32",
>                     DTS_RIGHTALIGN | NOT WS_VISIBLE |
WS_TABSTOP,262,49,56,
>                     13,WS_EX_TRANSPARENT
>
.............................................................................
........................................I would like to be able to change the
co-ordinates & size to 203,265,76,13I have tried,   1/
m_ctrlDTP.SetWindowPos(NULL,203,265,76,13,WS_VISIBLE)   2/
m_ctrlDTP.SetWindowPos(&CWnd::wndBottom,203,265,76,13,WS_VISIBLE);I am not
sure that I am using SetWindowPos is the correct fashion (or if Ishould be
using it all !!) as it says I should be using const CWnd*pWndInsertAfter as
the first parameter but I dont know how to go aboutgetting this.A simple
example would be much appreciated,Jay
>


0
thatsalok1 (226)
3/22/2005 3:26:21 PM
Thanks Alok

Much better !!

Jay



"thatsalok" <thatsalok@NO_gmail.com_I_DONT_NEED_SPAM> wrote in message 
news:OdgbJOvLFHA.2132@TK2MSFTNGP14.phx.gbl...
> Look at [ MoveWindow ] Api buddy
>
>
> --
>
> With Regards
> Alok Gupta
> Visit me at http://alok.bizhat.com
>
>                           "I Believe this will Help"
> "Jay" <itsjayceecee.NoSpam@hotmail.com> wrote in message
> news:uPzj$2uLFHA.656@TK2MSFTNGP14.phx.gbl...
>> Hi All
>> I have a control on a Dialog which I need to have displayed
>> in a different position in different circumstances.
>>
> ............................................................................
> .......................................
>> Control Id                    : ID_My_DTP
>> Control Variable type   : CDateTimeCtrl
>> Control Variable name :  m_ctrlDTP
>>
>> In the .rc file it is defined as
>>
>> CONTROL         "DateTimePicker1",ID_My_DTP,"SysDateTimePick32",
>>                     DTS_RIGHTALIGN | NOT WS_VISIBLE |
> WS_TABSTOP,262,49,56,
>>                     13,WS_EX_TRANSPARENT
>>
> ............................................................................
> .......................................I would like to be able to change 
> the
> co-ordinates & size to 203,265,76,13I have tried,   1/
> m_ctrlDTP.SetWindowPos(NULL,203,265,76,13,WS_VISIBLE)   2/
> m_ctrlDTP.SetWindowPos(&CWnd::wndBottom,203,265,76,13,WS_VISIBLE);I am not
> sure that I am using SetWindowPos is the correct fashion (or if Ishould be
> using it all !!) as it says I should be using const CWnd*pWndInsertAfter 
> as
> the first parameter but I dont know how to go aboutgetting this.A simple
> example would be much appreciated,Jay
>>
>
> 


0
3/22/2005 3:55:34 PM
SetWindowPos give you alot of flexablity.

You can move windows around without having to worry about the their size.
m_Wnd.SetWindowPos(NULL,10,10,0,0,SWP_NOSIZE|SWP_NOZORDER);

You can change their size without having to worry about their current
position
m_Wnd.SetWindowPos(NULL,0,0,200,100,SWP_NOMOVE|SWP_NOZORDER);

You can also change the ZOrder of the window using the InsertAfter
parameter, in case of a child control this will change the tab order

m_Wnd.SetWindowPos(&m_OtherWnd,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);

And obviously you can do all of this in a single call

m_Wnd.SetWindowPos(&m_OtherWnd,10,10,100,200,0);

AliR.

"Jay" <itsjayceecee.NoSpam@hotmail.com> wrote in message
news:uPzj$2uLFHA.656@TK2MSFTNGP14.phx.gbl...
> Hi All
> I have a control on a Dialog which I need to have displayed
> in a different position in different circumstances.
>
.............................................................................
........................................
> Control Id                    : ID_My_DTP
> Control Variable type   : CDateTimeCtrl
> Control Variable name :  m_ctrlDTP
>
> In the .rc file it is defined as
>
> CONTROL         "DateTimePicker1",ID_My_DTP,"SysDateTimePick32",
>                     DTS_RIGHTALIGN | NOT WS_VISIBLE |
WS_TABSTOP,262,49,56,
>                     13,WS_EX_TRANSPARENT
>
.............................................................................
........................................I would like to be able to change the
co-ordinates & size to 203,265,76,13I have tried,   1/
m_ctrlDTP.SetWindowPos(NULL,203,265,76,13,WS_VISIBLE)   2/
m_ctrlDTP.SetWindowPos(&CWnd::wndBottom,203,265,76,13,WS_VISIBLE);I am not
sure that I am using SetWindowPos is the correct fashion (or if Ishould be
using it all !!) as it says I should be using const CWnd*pWndInsertAfter as
the first parameter but I dont know how to go aboutgetting this.A simple
example would be much appreciated,Jay
>


0
AliR1 (391)
3/22/2005 4:33:26 PM
Reply:

Similar Artilces:

Still a problem- loss of Office print dialog window
Problem as described in this thread: 'Loss of standard print dialog box in Office 2004 11.2.1' http://groups.google.com/group/microsoft.public.mac.office/browse_thread/thread/ba72ff609a1b7c4/7dd92e881c05837d?lnk=gst&q=print+dialog&rnum=1#7dd92e881c05837d I would really like to see an actual answer to this problem because it is STILL happening to me, Office 2004 v.11.3.4. Happens in all Office apps, but is particularly frustrating not having it in PowerPoint. Uninstalling and re-installing MS Office several times does eventually fix the problem but when you are rolling out ma...

help with threaded control on slider?
Hi I have a slider control written in MFC. Its thumb position is constantly updated in one background work thread; end-users can also move the thumb position by dragging the thumb or use arrow key to move the position. I would like to have the end-user's action to override the work thread's update so that the position of the thumb for the slider should be kept where the end user intend to move. How can I do this Many thanks in advance James In article <0BFAF6FE-ECB9-4E6D-B258-DB9CC405EDB7@microsoft.com>, anonymous@discussions.microsoft.com says... > Hi, > > I have ...

dialog box for axis minimums, maximums, and major units
I am using the macro below to set the axis minimums, maximums, and major units for a series of charts. I would like to tie this macro to RefEdit controls, so that when I enter the keyboard shortcut Ctrl+Shift+A in the active chart, a dialog box opens with three RefEdit controls in it, which I can then use to set the MinimumScale, MaximumScale, and MajorUnit. I can get as far as creating the dialog box in the VBE editor with the three RefEdit controls. However, I'm clueless as to how to tie the dialog box to the macro. Any suggestions? (By the way, I know there is a Tushar Mehta...

Moving Tabs Apart??
Instead of having all the Tabs go from left to right is it possible to move just one of them to the right-hand side??? Anyone know how?? I know you can change the size of the tabs I just want to try and move one away from the others. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200704/1 You can turn off the tabs from the control and create your own where ever you want. evilcowstare wrote: >Instead of having all the Tabs go from left to right is it possible to move >just one of them to the right-hand side??? > >Anyone know ...

Paste and automatically move cells
I am creating an Excell spreadsheet. I have not used Excell in a long time, so I cannot remember if what I am asking is possible. Is there a way to paste data into a group of cells and have Excell move the existing cells down instead of having the new data write over it? -- Have a nice day! ~Paul Express Scripts, Charting the future of pharmacy Hi Paul Copy the selection (Ctrl V) Move to the insertion point Press<Ctrl><Shift><+> Select option to move cells down "Paul (ESI)" wrote: > I am creating an Excell spreadsheet. I have not used Excell in a long ...

move calender between public folder trees
Here is my situation I have two public folder trees in exchange 2003. I have a calendar with 1500 entries and I want to move it from one public folder store to another or from one public folder tree to another. How can i don this and preserve all the entries? This all hosted on 1 exchange 2003 server. ...

Exchange 2003 newbie quesiton
I'm hoping the answer here will be a simple yes, but... Is it possible to set-up two Exchange 2003 servers to replicate one and other? Both servers would be in the same domain on the LAN, one of the servers would be Windows SBS 2003 and the other just Windows Server 2003. The client concerned has recently suffered a few days of down time which has resulted in a high loss of business. To prevent this we want to set-up a live fall-back exchange server that we can swap over in a matter of minutes should the worst happen again to their SBS 2003 server. Cheers, Paul. No. At least n...

How To Open Chart Wizard Dialog on Excel 2003
Hi All, I need to open the Chart Wizard Dialog by c# code my code is the follow excel.Dialogs[mode].Show(missing x30); where excel = new Excel.Application mode = xlDialogChartWizard missing = System.Type.Missing; show has 30 args so i repeat missing 30 times this code works for the xlDialogPivotTableWizard dialog Help me pls Thx in Advance Hi, I don't know a thing about C#, but why not exclude the Show arguments? -- Cheers, Shane Devenshire "VeNoMiS" wrote: > Hi All, > I need to open the Chart Wizard Dialog by c# code > > my code is the follow > >...

How to insert a ani-gif in richedit control ??? thanks #2
How to insert a ani-gif in richedit control ??? thanks ...

? Modeless Dialog: No OnInitDialog, No Template (No Controls)
Hi, I've got an MFC dialog app which spawns a modeless dialog. I laid out the other dialog with the resource editor and created a class for it. I've got some controls in it and have it set up to draw a graphic in a static in OnPaint (I'm using CxImage). The problem is that when I use DoModal to spawn the dialog, it works (but is modal), however when I use CreatEx to spawn it modeless, the dialog's controls are not created. I even tried to create them (just a couple as a test) dynamically, but it's OnInitDialog is not called at all. I'm sure I'm missing somethi...

Multiple Dialogs of the Same Application(SDI) in the Task bar
Hai Iam using a SDI Application where in whenever i click on a Button in View it creates and displalys DialogBoxs and all those Dialog boxes should be shown in the taskbar and do u have any idea about that Thanks and Regards suresh ...

Help please
I screwed something up and need help big-time. Somehow the default position of the cursor when I start a new document - or Outlook mail message - is in the right center part of the page. In fact, if I even open a document, it's formatted with everything scrunched over to the right. I can backspace and get the cursor to the right and it's not a big problem on documents with simple formatting, but for some complex documents, simply backspacing makes the formatting even worse. HELP PLEASW. -- rpbilleaud For a start, see http://word.mvps.org/FAQs/AppErrors/BlankDo...

Listbox to control listbox
I have a list box with all phone numbers in it. I would like to be able to filter the listbox phone numbers by category. In other programs, I have seen two listboxes side by side and one be clickable to filter the results of the other listbox. How can I accomplish this result? Any suggestions on this would be helpful. NDClark wrote: > In other programs, I have seen two listboxes side by side and one be > clickable to filter the results of the other listbox. How can I accomplish > this result? You need: 2 tables: one containing the categories and on...

mfc, dynamically creating ActiveX controls
I am creating a GUI application using MFC. I need to create and place ActiveX controls at run time on a dialog box. I want to trap the mouse click events happening on the control. I would like to register an event handler so that whenever a mouse event occurs my callback function is called. Thanks nextgen78@gmail.com wrote: > I am creating a GUI application using MFC. I need to create and place > ActiveX controls at run time on a dialog box. I want to trap the mouse > click events happening on the control. I would like to register an > event handler so that whenever a mou...

Custom Task Form
I'm using O2003 and I created a new task form and had a few questions. 1. I added the DTPicker custom control for my date picker. When I expand the calendar, it seems to always pick a date around 30 days in the future. For example, I just clicked on it and it defaulted to January 7, 2010. Is there a way to have it default to today's date at 5:00 AM? 2. Currently I am using the Notes and including attachments. Is there another control I can use to also add attachments (in addition to the notes control) as Outlook will only allow one Notes / Message box? 3. Is there a w...

Are there any control containers (besides Tabs) in Access?
Are there any control containers (besides Tabs) in Access? Option Groups can contain radio buttons or check boxes. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Steve Horth" <SteveHorth@discussions.microsoft.com> wrote in message news:EFA8602E-7F7D-416B-B81C-AD3B514BF35F@microsoft.com... > Are there any control containers (besides Tabs) in Access? "Steve Horth" <SteveHorth@discussions.microsoft.com> wrote in message news:EFA8602E-7F7D-416B-B81C-AD3B514BF35F@microsoft.com... > Are there any c...

Copy/Delete Dialogs
Windows has common dialogs like CComboBox, CFileDialog, AfxMessageBox......But I can't find anything for the file copy/delete animated dialog that shows the file going from one folder to the other or being deleted into nothing. How is it done? I've looked in MSVC 2.0 4.0 6.0. Do I have to make the animation class from scratch or can it be called as easy as a MessageBox. Sample code would help. Mike D. SHFileOperation can show such a dialog if you want. To get a more customized one I think you need to make one yourse...

how to close dialog box?
when i want to sent mail or make new contact ,the box come upo and it say "dialog box is open.try to close and open again'.i try everything and couldn't find dialog box.i don't know what to do? "papawadi" <papawadi@discussions.microsoft.com> wrote in message news:165D93CE-27AB-40AF-B569-E8DEB452662E@microsoft.com... > when i want to sent mail or make new contact ,the box come upo and it say > "dialog box is open.try to close and open again'.i try everything and > couldn't find dialog box.i don't know what to do? See thi...

Adding a control line to excel chart without showing up in the leg
How can I add a control line, (such as average, ucl, lcl), to an excel bar or line chart and not have the control line series show up in the chart legend, or data table? Any sugestions would be greatly appreciated. -- thanks tweaver On Sat, 15 Sep 2007, in microsoft.public.excel.charting, TWeaver <TWeaver@discussions.microsoft.com> said: >How can I add a control line, (such as average, ucl, lcl), to an excel bar or >line chart and not have the control line series show up in the chart legend, >or data table? Single-click twice on the legend entry for the control line, and ...

Custom User Control Databinding...
I have a custom user control that has a Rich Text Box as one of its elements. I need to "link" the custom controls "Databindings" to the Rich Text Box contents. I'm totally lost as to how to accomplish this other than passing the Datasource and data element name through custom properties but I'd like the normal "Advanced" property "ellipsis" box to do it. Any guidance is appreciated! Perry Perry Ogletree wrote: > I have a custom user control that has a Rich Text Box as one of its > elements. I need to "link"...

Pasting in Tab Control pages
Hi. I use Access 2003. I have a couple wide rectangles I need to duplicate. I do copy and when I do paste they are pasted almost outside the page area stretching the page and creating a mess. Looks like it takes the rectangles width and pastes horizontal shifted by that width. Is there a way to have pasts vertically shifted only? Thanks Henry ...

how to stop escape from closing a dialog box?
I have a large MFC program (not my code) and I need to change it so that a particular CDialog derived dialog no longer closes when you press the escape key. I have "System Menu" disabled (and the close box is gone) but the escape key still closes it. Is there a dialog style, CDialog function or operation in the code that I should look for that might be making this happen? Or something I should add or call that will stop this from happening? Hi, By pressing ESC, you invoke CDialog::OnCancel virtual function. So, if you override OnCancel in the CDialog derived class and remove ...

How to release a CWebBrowser2 control? #3
Dear everyone: I have a CWebBrowser2 control on my dialog and navigate to url by the following code: CComVariant sNull,sFrame; sNull=""; sFrame=""; m_ctlWeb.Navigate("http://www.microsoft.com", &sNull, &sFrame,&sNull,&sNull); When I close the dialog and try to release the control by the following code: m_ctlWeb.DestroyWindow(); The control is destroyed, but when I check the task manager for the memory usage, I found that a memory of over 11 megebytes still remained! Can anyone tell me how to release the memo...

Change "dialog" box size?
In Outlook 2002, when I click the "To:" line to add addresses to the message, the "Select Names" dialog box which appears is very small. I'm sure it's the default size, but the pick list of names and email addresses is so truncated horizontally that it is impossible to see all the fields easily. The horizontal scrollbar is a pain! Can this box be resized? Nope. However it can be resized in Outlook 2003. -- Patricia Cardoza Outlook MVP www.cardozasolutions.com Author, Special Edition Using Microsoft Outlook 2003 ***Please post all replies to the newsgroup...

Move to match cells
A B C D E 1 000801025-8 009601025-3 2007 000801025-8 2007 2 000801026-9 009601026-4 2004 000801026-9 2004 3 000801028-1 009601028-6 2006 000801028-1 2006 4 000801036-8 009601036-3 2008 000801036-8 2008 5 000801044-5 009601044-0 2007 000801044-5 2007 6 000801044-5 009601055-0 2004 000801055-5 2004 7 000801055-5 009601064-8 2001 000801064-3 2001 8 000801055-5 009601091-2 2006 000801091-7 2006 9 000801064-3 009601095-6 2002 000801095-1 2002 10 000801091-7 009601097-8 1998 000801097-3 1998 11 000801091-7 009601098-9 2004...