Position of Control in Dialog Box ?

Hi guys,

How do I get the top-left position of a control in a dialog box ? I tried
GetWindowRect() but it's in screen coordinates. I want to create a static
frame then go like this:

(pseudo code)
rect = client rect of static control
fill rect

If I use GetClientRect it's at 0,0, so I need the top-left position so I can
offset the rect.

Thanks.


0
2/24/2004 7:22:58 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
519 Views

Similar Articles

[PageSpeed] 57

You can use ScreenToClient to convert it to client coordinates.

-- 
Ajay Kalra [MVP - VC++]
ajaykalra@yahoo.com


"Robert A." <invalid@invalid.org> wrote in message
news:mwN_b.75089$ac.17794820@news4.srv.hcvlny.cv.net...
| Hi guys,
|
| How do I get the top-left position of a control in a dialog box ? I tried
| GetWindowRect() but it's in screen coordinates. I want to create a static
| frame then go like this:
|
| (pseudo code)
| rect = client rect of static control
| fill rect
|
| If I use GetClientRect it's at 0,0, so I need the top-left position so I can
| offset the rect.
|
| Thanks.
|
|

0
ajaykalra (6842)
2/24/2004 7:26:18 PM
"Robert A." <invalid@invalid.org> wrote in message
news:mwN_b.75089$ac.17794820@news4.srv.hcvlny.cv.net...
> Hi guys,
>
> How do I get the top-left position of a control in a dialog box ? I tried
> GetWindowRect() but it's in screen coordinates. I want to create a static
> frame then go like this:
>
> (pseudo code)
> rect = client rect of static control
> fill rect
>
> If I use GetClientRect it's at 0,0, so I need the top-left position so I
can
> offset the rect.

Follow GetWIndowRect with a call to either ScreenToClient or
MapWindowPoints.
-- 
Jeff Partch [VC++ MVP]


0
jeffp (1711)
2/24/2004 7:30:55 PM
Reply:

Similar Artilces:

IE8 Instant search box
Hi All I finally succumbed to the temptation to download IE8. I have spent the last 3/4 of an hour trying to regain control of my browser :-) I have switched off all accelerators and all that other stuff - even figured out how to stop the browser popping up the accelerator icon EVEN though I'd switched them off . . . I am happy to use the instant search box. (It's in a convenient place...). I DO NOT WANT any kind of suggestion from IE8 about what I'm looking for. I KNOW what I'm looking for - and the computer hasn't got a clue . . . So managed to sw...

disable reports daterange dialog to show up twice
Hi, I created a report with daterange parameters. Everythings works fine but when I want to print some report, the report asks the user again for the date parameters. Having installed the CRM update CRM1.2-KB834913-Server.exe which should repair this bug, I noticed no change. The reports always asks twice for the parameters. Is there any secret for this mystery... Greetings Thomas Ott are all these parameters in a single report or are you using sub reports as well? -- John O'Donnell Microsoft CRM MVP http://www.microsoft.com/BusinessSolutions/Community/CRMFaqLanding.aspx "Th...

Need an unbound text box and command button (Search)
I need to create an unbound text box with a command button (Search) on my form which will enable the user to find the current record for a space no. I would like the user to only have to type in the space no. My fields are: SpaceNo Current "Yes" I am not experienced at writing code. Thanks so much. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200911/1 On Wed, 25 Nov 2009 23:09:36 GMT, "Uschi via AccessMonster.com" <u25116@uwe> wrote: If you don't write code, it may be easier to instruc...

Want Input boxes to accept unicode strings on Standard Windows XP
I have a MFC application that is currently built with MBCS mode. If I run the program on a Chinese OS (Windows XP), the input boxes (Edit Controls) can accept Chinese chars and display correctly. If I run it on a standard English XP, the input boxes won't accept Chinese chars (display as "????") -- please note that I have already installed CKJ on the system and IE and Outlook can display Chinese correctly. Is this just because of different MFC libraries used for the application? Can I force the application running on Standard XP to use the unicode libraries so ...

How to display mfc control in new look style?
Hi, anybody knows how to show mfc controls like button or other controls in new look style? Please see below link to know about what i mean by new look style is. http://www.geocities.com/henky_arektc97/question/ I want to make my controls in dialog shown as Picture 2, not as Picture 1 (look at the button). Are there lack of some defines or codes or something else, because when I create new project again, the dialog will be displayed as I want in Picture 2. I use MFC 9 (vs2008). Thank you for any help! "Saitama" <Saitama@discussions.microsoft.com> wrote in message ne...

Tabbing into continuous subform ignores the first control
When I tab into the subform, from the last position in the main form, the focus moves to the second control in the continuous subform except on the first record entered in a session. I shift+tab back to the first control and the tabbing is normal from then on until the next record gets to the subform. The order of the controls on the subform is the same as the fields in the underlying table and the effect is the same in Datasheet view (of the subform). This first control on the subform is a combo box if that effects anything. Is there a way to get the tabbing right? ern. No, I thought the...

Selecting Text Box
Is there a keyboard command that one can use with the mouse to select the text box (frame) rather than trigger the Edit Text mode? When there are many objects on the page, getting the mouse to click on the right frame can be a real problem. But if the cursor is in the right box, some keyboard command (with or without the mouse) should help select the right object. Thanks! ...

Can I display the current date in a text box?
I know how to display the current date in a cell, but can I display it in a text box? And how would I do that? You would have to have some code to load it, such as Textbox1.Text = Format(Date,"dd mmm yyyy") or link the texbox to a cell with the formula =TODAY() -- HTH RP (remove nothere from the email address if mailing direct) "stephiebrady" <stephiebrady@discussions.microsoft.com> wrote in message news:C78C4C78-C12C-4A8F-9121-E377ACAE3B5B@microsoft.com... > I know how to display the current date in a cell, but can I display it in a > text box? And ...

Condition navigating between Controls
I have a form in access 2007, with several controls. I used the On Exit Event Procedure for navigating among controls. Example: If Method of Payment = “Check” Then Check No.Set Focus End If If Method of Payment = “Credit Card” Then Credit Card Name.Set Focus End If End Sub And so on for all controls. Form functioned well for months, however today went wild. Navigation order does not execute Event Procedure it follows exactly the order of TAB ORDER DIALOG BOX. Please advice -- Bardia It sounds like the On Exit event is not firing for some reason. Put these two lines of co...

Control Supported Device List for Active Sync
Hi I want to restrict what devices can connect to Active Sync - there is a built in list of supported devices which the service packs keep updating but is there a way to control this list yourself i.e. to only include two devices in the list? I want to control which devices meet the company standard and stop any which don't! More Info: Overview of mobile devices that are supported by Outlook Mobile Access in Exchange Server 2003 http://support.microsoft.com/Default.aspx?kbid=821835 Thanks Clive ...

check boxes
I downloaded and worked on a template on someone elses computer using check boxes. I sent that template to my laptop to complete working on the template and the check boxes now show up like this: {form check box} How do I get this to go back to a check box? Hi JOLOJO58, Simple: Press Alt-F9 to toggle the field code view. -- Cheers macropod [Microsoft MVP - Word] "JOLOJO58" <JOLOJO58@discussions.microsoft.com> wrote in message news:9C83A55C-B768-43BE-A171-762EEA78DEAC@microsoft.com... >I downloaded and worked on a template on someone elses computer...

False Positives in Outlook 2003 Junk Mail
I am the network engineer of a company. The mail server is running Exchange 2003 on a Windows 2003 platform. My clients are running Outlook 2003 on an XP platform. In addition I have Semantec MS for Microsoft Exchange running on the server. I have it set up the server so that Semantec blocks email that has a SCL greater then 7 (which is very lax). Everything 7 or less gets through to the server. Then Exchange 2003 dishes all the mail to the users. The problem I am having is for some reason I get mail delivered to my Junk E-Mail folder in Outlook. But WHY? I have disabled it completely in Out...

Combo box #18
Hi I'd like to have a drop-down list in one cell and based on the selection in this cell, there needs to be another list of drop downs in an adjacent cell. How do i do this? Eg - first cell would have drop down - A, B , C If A is selected, the drop-down needed in anotehr cell is AA, AB, AC, AD. And if B is selected, the second cell should drop down BA, BB, BC, BD. Pls help. thanks > I'd like to have a drop-down list in one cell and based on > the selection in this cell, there needs to be another list > of drop downs in an adjacent cell. How do i do this? See here h...

Access 2007-Table not displaying the values from a combo box
I have built a database to schedule senior/disabled transportation appointments. I have created two tables and associated forms for data entry. I placed a combo box in the Schedule form so end users choose a client and fields complete on the form with client name, address, city, and home phone number. I did instruct Access to store the data in the SeniorIntakeID field in the Schedule table. I wrote a report that staff execute to see what is scheduled for a given date, for each driver. On the report I want to see the actual client's name, address, city, and home phone n...

How can I pull out position 4 in a string?
Column A contains a string MyString aaaaaa bbbbbb cccccc dddddd eeemee fffmff gggmgg I want the value of B1 to be the value of A1 unless the 4th character in A1 is a "m". So column B would be B1=aaaaaa B2=bbbbbb B3=cccccc B4=dddddd B5 = empty cell B6 = empty cell B7 = empty cell What's the simplest way to do this? =IF(MID(A1,4,1)="m","",A1) -- Regards, Peo Sjoblom "Stephanie" <nowhere@microsoft.com> wrote in message news:OjT2P9s2DHA.2528@TK2MSFTNGP10.phx.gbl... > Column A contains a string > > MyString > aaaaaa > b...

Formating, paragraph marks, boxes etc, how do I get rid of them?
One day I opened up excel and it had all these marks for formating in my form. This also happened in word. How do I get rid of them? Josh: In Word, paragraph marks can be turned on/off by clicking the paragraph icon (looks like a capital P but with two, vertical strokes instead of one). I just finished wandering through Excel 2000 looking for the same icon and the only mention of the paragraph mark is related to object linking and embedding. I've also done a lot of forms in Excel and don't remember ever running into paragraph marks. Are you using OLE in the spreadsheet...

Confirm dialog and ajax call
Hi, I have a asp.net ajax enabled. I need to post back the form using ajax after user confirmation (dialog box), how can i achive this? 1. On the 'Save ' button (runat=server) , I want to display confirmation message 'do you want to save ?" (yes/no) 2. if the user has selected 'yes', i want to post the form using ajax script and call code behind method for saving Regards, Naheed On Sun, 31 Jan 2010 05:49:01 -0800, Mohd Ebrahim <MohdEbrahim@discussions.microsoft.com> wrote: >Hi, > >I have a asp.net ajax enabled. I need to pos...

Controls resize when clicked
In Excel 2002, activeX controls such as command buttons, combo boxes, check boxes and option buttons will display inaccurately until they receive focus. Fonts and symbols used in the control often appear distorted until clicked. For example, with the combobox, the dropdown arrow appears scrunched. With command buttons it looks like the height and width are both increased by 1 when clicked and then the button returns to the wrong size when another control receives the focus. This occurs on multiple machines running Office XP, with and without service packs 1 and 2 installed. The probl...

How to create a static derived class with controls inside it
I want to create a CStatic derived class(eg. CMyStatic), which has some controls inside it. At first I want to add these controls at "CStatic::PreSubclassWindow", but if I want to create the CMyStatic programmically, error will appear. So I'm asking when should I add these controls to my class. Thank you. The way I personally got around this problem was to put my creation function in a Function by itself. override the Create method and the PreSubclassWindow methods. From the Create function set a flag that says it is being created using the create function, rather than be...

Control for nested XML Data
I want to show the content of the xml with a control which allows to show the nodes in a nested way. I don't want to use DataGrid which shows the nodes in a tabular form. Is there any suitable control for me? Thanks. -- My C++ and C# ( Traditional Chinese ) Web Site : www.franzwong.com/Home.php Can you elaborate on your requirements? Is this for a web application or a desktop application? If it is for the web, then one way might be to display the XML in an IFRAME. The XML will appear just as it does when you load up an XML document using IE. You might also bind the XML to a treevi...

Using combo boxes
I am trying to use a combo box control to access a list of data. i am having problems 'pointing' the combo box to the list of data I would like to use. Where do I tell the box where to look ??? thanks PS I cannot use the 'forms' combo box as this has does not allow me to type in the combo box. Look at the Listfillrange property. On Thu, 28 Aug 2003 "Disco" <stuart_langan@yahoo.co.uk> wrote: >I am trying to use a combo box control to access a list of >data. >i am having problems 'pointing' the combo box to the list >of data I would l...

HowTo: generate Application using new XP-Controls
Hi, when I generate a new Dialog application with the MFC wizard I get an application that does not show the new XP-Controls although I have checked the "Genrate Manifest" checkbox and the startup code also includes the call to InitCommonControlsEx() (with dwICC = ICC_WIN95_CLASSES | ICC_STANDARD_CLASSES). What is wrong? Why don't I see the control styles of ComCtl32.dll Version 6 ??? (My env: VS2005 SP1, WinXP SP2) Thanks for your help! Regards, hd >when I generate a new Dialog application with the MFC wizard I get an application that does not show the new XP-Controls altho...

changing colour of individual items of control created through CListCtrl
Hello, How can I change the colour of individual items inserted in a area, created by using CListCtrl class.Can somebodyguide me? Thank inadvance -- Sadi ----------------------------------------------------------------------- Sadia's Profile: http://www.msusenet.com/member.php?userid=252 View this thread: http://www.msusenet.com/t-187057967 You have to use a owner draw list control. Here is an example http://www.codeproject.com/listctrl/xlistctrl.asp AliR. "Sadia" <Sadia.1rhwgj@no-mx.msusenet.com> wrote in message news:Sadia.1rhwgj@no-mx.msusenet.com... > > He...

Inventory/Stock Control
Does anyone know of a free, simple inventory control spreadsheet/template. All it needs to do is have a list of items (up to 100) with a stock on hand, transfer in and issue out option. Obviously, the transfer in and issue out out must update the stock on hand and then self zero. Any suggestions? Thanks Mike Microsoft has plenty of templates for documents, worksheets, etc on its web site. Several deal with inventory. "Mike Langensiepen" wrote: > Does anyone know of a free, simple inventory control spreadsheet/template. > All it needs to do is have a list of items...

relative references when copying Sheets containing form controls
I've been given a spreadsheet that I need to take copy various sheets from, the sheets contain form controls, when I copy the sheet to a new workbook, named ranges and so on come across fine, but the references to the input ranges of for example the drop down box controls become hard coded to the original sheet, I don't want this.. Is there anyway to alter the way excel copies so that the references remain relative rather than absoloute???? What did you include in the addresses for those references? I put a listbox from the forms toolbar on a worksheet. If I used a range like: $b$...