Controls coordinates

Hi everyone,
Could somebody give me a simple example of getting a controls
coordinates and then using them to put the control back where it was.
So basicaly the control hasn't moved.

Here's what I'm doing:
	m_cQuality.GetWindowRect(&qualityRC);
	ClientToScreen(&qualityRC);
//	int temp=qualityRC.Height();
//	qualityRC.top=unyteRC.bottom-temp;
//	qualityRC.right=qualityRC.Width();
//	qualityRC.left=0;
//	qualityRC.bottom=qualityRC.top+temp;

//	m_cQuality.MoveWindow(&qualityRC);
	m_cQuality.SetWindowPos(this, qualityRC.left, qualityRC.top,
qualityRC.Width(), qualityRC.Height(), SWP_SHOWWINDOW|SWP_NOZORDER);


Please help, I feel like I'm trying to pick a lock at this point.
Thank you

0
8/1/2006 10:31:41 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
561 Views

Similar Articles

[PageSpeed] 47

On 1 Aug 2006 15:31:41 -0700, "Andrian" <andrian_gorohovschi@hotmail.com>
wrote:

>Hi everyone,
>Could somebody give me a simple example of getting a controls
>coordinates and then using them to put the control back where it was.
>So basicaly the control hasn't moved.
>
>Here's what I'm doing:
>	m_cQuality.GetWindowRect(&qualityRC);
>	ClientToScreen(&qualityRC);

GetWindowRect returns screen coordinates, so that's backwards. What you
need is:

ScreenToClient(&qualityRC);

>//	int temp=qualityRC.Height();
>//	qualityRC.top=unyteRC.bottom-temp;
>//	qualityRC.right=qualityRC.Width();
>//	qualityRC.left=0;
>//	qualityRC.bottom=qualityRC.top+temp;
>
>//	m_cQuality.MoveWindow(&qualityRC);
>	m_cQuality.SetWindowPos(this, qualityRC.left, qualityRC.top,
>qualityRC.Width(), qualityRC.Height(), SWP_SHOWWINDOW|SWP_NOZORDER);
>
>
>Please help, I feel like I'm trying to pick a lock at this point.

I saw just the one mistake.

-- 
Doug Harrison
Visual C++ MVP
0
dsh (2498)
8/2/2006 12:40:07 AM
Doug Harrison [MVP] wrote:
> On 1 Aug 2006 15:31:41 -0700, "Andrian" <andrian_gorohovschi@hotmail.com>
> wrote:
>
> >Hi everyone,
> >Could somebody give me a simple example of getting a controls
> >coordinates and then using them to put the control back where it was.
> >So basicaly the control hasn't moved.
> >
> >Here's what I'm doing:
> >	m_cQuality.GetWindowRect(&qualityRC);
> >	ClientToScreen(&qualityRC);
>
> GetWindowRect returns screen coordinates, so that's backwards. What you
> need is:
>
> ScreenToClient(&qualityRC);
>
> >//	int temp=qualityRC.Height();
> >//	qualityRC.top=unyteRC.bottom-temp;
> >//	qualityRC.right=qualityRC.Width();
> >//	qualityRC.left=0;
> >//	qualityRC.bottom=qualityRC.top+temp;
> >
> >//	m_cQuality.MoveWindow(&qualityRC);
> >	m_cQuality.SetWindowPos(this, qualityRC.left, qualityRC.top,
> >qualityRC.Width(), qualityRC.Height(), SWP_SHOWWINDOW|SWP_NOZORDER);
> >
> >
> >Please help, I feel like I'm trying to pick a lock at this point.
>
> I saw just the one mistake.
> 
> -- 
> Doug Harrison
> Visual C++ MVP

Thank you Doug

0
8/2/2006 3:54:48 PM
Reply:

Similar Artilces:

why won't word 2007 release control of a .rtf file after exiting w
I AM HAVING TROUBLE WITH ACCESS TO RICH TEXT FILES BY PROGRAMS OTHER THAN WORD------ AFTER THE FILE OPEN IN WORD IS CLOSED AND EVEN AFTER WORD HAS BEEN SHUT DOWN (EXITED) ---------- I GET THE ERROR MESSAGE THAT THE FILE IS "IN USE" BY WORD WHEN (FOR EXAMPLE) AN ATTEMPT IS MADE TO DELETE IT ---- SOMETIMES WHEN RE-OPENING THE FILE AFTER RE-STARTING WORD THE FILE CANNOT BE SAVED BECAUSE IT IS IN "READ ONLY" MODE ------- AFTER MUCH FIDDLING AROUND I FINALLY MANAGED TO DELETE THE PROBLEM FILE ONLY TO HAVE THE SAME PROBLEM RETURN WITH A DIFFERNT FILE ----- WORD 200...

RE: Control
Can some one point me right direction to achive this following. Need to dispaly a data in a table format. some of the column data may have to display a image/icon based on a value from the table (1 :- Red color icon, 2:-yellow color icon...) Once the data is loaded and displayed on the format , able to search particular row by column index and update the values including the images(change different image). I tried with Listview control, with the report view I am not able to search row and update the columns with the List vew I am not able to show the image/icon. do not want to use ...

bound control or inbound control
Hi Katherine, There are differences between using bound versus unbound controls. Where on the form do you want to use an unbound control? Jeanette Cunningham "Katherine" <Katherine@discussions.microsoft.com> wrote in message news:23BBC192-0A74-4B9F-9513-5E5923A76658@microsoft.com... > ...

MSCRM login and the Users Control Panel
Is anyone aware of any way that the settings stored under Control Panel - Users - Password Management might interfere with the process of Single Sign On into MSCRM? It seemed to have somehow cached someones login and prevented logging in as the logged in user, until cached credentials had been "deleted". However I have never seen this mentioned as being relevant. I am not too sure what the architecture model is there, but it appears to be a single domain. If this area has any relevance, it would be useful to know....thanks ...

Adding a control variable
Hello all, Under VC++ 7.1, I've added a checkbox to a dialog. Using the dialog editor, I am not trying to add a control variable for this check box. However, when I right-click on the check box and select "Add Variable", the resulting wizard dialog does not allow me to select "Control Variable" (it is grayed out). What do I need to do to get a control variable for this check box added to my class? Thanks, Dave I've never seen that before - are you able to duplicate this problem with other projects too? -- Regards, Nish [VC++ MVP] "Dave" <bett...

Releasing memory after creating OCX control
Hi, I try to create an instance of an activex control in my MFC dialog based app. Though my application works with out any error, if i check the memory after calling "delete pMyControl" it keeps on occupying the same memory it occupied when the control was alive. Could anyone help me where I am missing to clear the memory? Thank you. My Code here ---------------m_pxWmp= new CWMPPlayer4();if( m_pxWmp->Create("replay", WS_CHILD | WS_BORDER | WS_VISIBLE , CRect(100, 100,320,240), this, 2)){ m_replay = true; m_pxWmp->SetUrl("C:\\video.avi"); m_pxWmp->Set...

Spam control - MS Outlook
Hi! I am using MS Outlook 2000 and use 2 profiles. I recently installed a firewall package (Fsecure = Telia S�ker Surf), including Spam control. After install, MSO hangs and I cannot change to the other profile (if I not removed MSO by ctrl/alt/del) Somebody want to comment this? /Sven-Erik Intergrated AV/Spam is the cause of frequent issues in Outlook Is the FSecure you installed compatible with this old version of Outlook? "Storfille" <storfille@ebrev.net> wrote in message news:b1Ixm.11987$U5.164765@newsb.telia.net... > Hi! > > I am using MS Outlook 200...

stock control system
trying to see up a 'basic stock control sytem' for a warehouse that contains building materials. -- Thank you. You can use multiple ways of doing, there's 3 ways to come to m head... 1) Use a worksheet as database an save all the information on the cell of that worksheet using some macros to access it and handle. 2) You might want to use Access instead of Excel, I think would b easier to handle the database portion and you still have the Macro available. 3) You can use VB with an Access to create an application -- fanay ------------------------------------------------------...

Creating dialog controls at run-time
I've been researching how to do this, but whenever I try what other people do, I get very bad results. But my challenge doesn't end there. The number of controls I want to create is only known at run-time. The problems I face are manifold: 1. The code most people use fails badly. Not only is the font unconventionally big, but when I click the checkbox I create, the whole dialog disappears. If that's not enough, the pointer to the control is NULL when the dialog's destructor is called, so I can't delete the instance, and get a memory leak message when the program ends: CADi...

what control can display characters from txt files in a dialog?
I want to read lines from txt files and display them on a dialog.I wonder which control can be put into the dialog to hold the characters from txt? Something like :- while(m_file.ReadString(tmpstr)) { str += tmpstr; } m_edit.SetWindowText(str); -- Regards, Nish [VC++ MVP] "liao_xf" <sclxf@sina.com> wrote in message news:001401c3652f$177b9830$a001280a@phx.gbl... > Thanks first! > I know that Edit control can receive and edit input. > and I know the filestdio can read lines from txt. > but can you tell me how to attatch the lines to the edit? > Thanks!...

MDI support in ATL composite control
Hi, I have components created in ATL. The components are ATL composite controls. Entire work has been done till now using ATL, however I now need to give MDI type of work area (based o doc-view architecture) within the control. I have class derived from CMDIFrameWnd. However when I try to initialize instance of this class by calling "Create" method of CFrameWnd (base class in CMDIFrameWnd), I get error and creation fails. Tracing the code, I found that base class create method calls "AfxGetInstanceHandle" to get handle to the DLL. Now since this is ATL Composite control, ...

View Filtering and Access Controls for Business Units
I am trying to implement MS-CRM for my company. We have multiple Business Units . I need to give views to each Business Units so that they see only their own Contacts/Accounts/Opp lists. How do I accomplish this ? Also, If I gave inter business unit acesses , how do I make sure that the one business unit users can not modify any fields on other's Business Unit's records ? Thanks in advance for any help, Kishore This is quite easy to do with CRM. Assuming you have already created your Business Units in CRM, you can view a security role within one of the Business Units and a...

Tab Control Problems
I previously worked in VC++ 6.0, and have several applications that have either custom shadebox controls, or tab controls or group boxes. In all cases, when I moved the applications over to VS.NET 2003, everything was fine, except in the resource editor, I cannot see any of the controls that have been overlayed on a tab control, or a custom shadebox control and in some cases group boxes. I can tab to them and see the outline, but I cannot see the actual controls. If I drag a new control onto the tab control, I can see the control, but once it is saved, I can no longer access the cont...

FindRecord Control Button
i built a find record control button so a user can type in the form number and go there but it only searches the field that the cursor is in and the form # is not on the tab order(purposely). How can i specify where the find record function searches? thanks Ryan, usually people use an unbound combo box or an unbound text box for searching. There is a sample download with code of a search form at http://www.allenbrowne.com/ser-62.html If you need help to get it working, post back. You can also use the wizard to put a combo for searching on your form. On the form in design view, click the...

Controls coordinates
Hi everyone, Could somebody give me a simple example of getting a controls coordinates and then using them to put the control back where it was. So basicaly the control hasn't moved. Here's what I'm doing: m_cQuality.GetWindowRect(&qualityRC); ClientToScreen(&qualityRC); // int temp=qualityRC.Height(); // qualityRC.top=unyteRC.bottom-temp; // qualityRC.right=qualityRC.Width(); // qualityRC.left=0; // qualityRC.bottom=qualityRC.top+temp; // m_cQuality.MoveWindow(&qualityRC); m_cQuality.SetWindowPos(this, qualityRC.left, qualityRC.top, qualityRC.Width(), qualityRC.He...

User Control to Control Other User Control
Has anyone here created a control that controlled the content of other controls? I have my own custom ad control (for displaying space ads). I may have several on a page. What I'd like it to create another control that could determine how many instances of the first control existed on the current page, build a list of ads, and then set each control to show a particular ad. Is this practical? Suggestions? Thanks. Jonathan "Jonathan Wood" <jwood@softcircuits.com> wrote in message news:uQ5stZRnKHA.1552@TK2MSFTNGP05.phx.gbl... > Has anyone...

Controlling drawing objects in Excel . . .
i m trying to do the following. 1) i draw 10 circles, 10 rectangles and 10 ellipses (all are scattering here & there) in excel. 2) i would like to change all the sizes of circles with minimum steps. [Is it possible to control in such a way that a circle is drawn as a master one, and that circle will be copied and copied until required number. When we want to change something to all circles, we will change the master circle, and all other circles will be automatically changed.] If someone knows, kindly explain to me. Thanks & Have a nice day!!! Thaw Htin Oo. Thaw, (Oo?) One...

Need more than 1208 controls per sheet
Hi, Does anyone know how to go around the limitation of MS Excel, which doesn't let the user, through automation, to create more than 1208 controls (checkboxes, buttons, or combination of two for example) on one sheet?? Thanks much! -- mowali ------------------------------------------------------------------------ mowali's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=20886 View this thread: http://www.excelforum.com/showthread.php?threadid=491476 I don't know whether it is possible to overcome the limit, but I would not use a worksheet where the ...

MFC Table control or similar control
Hi, I have a MFC dialog database application that returns data which i then put into an excel spreadsheet and display onscreen. Due to license issues i would like to write the data to a user defined control. I would like this control to have a similar tabular look like the excel spreadsheet. It should also have the option on control to print out what data is in the control. I would also like to be able to put a bitmap on the control (Showing a logo). Can anyone give me advice on how what control(s) i should use to accomplish this? Thanks In Advance Macca You could buy a third party ...

Unprotection For ActiveX Control
I have a protected sheet but would like others to manipulate Spin Buttons (ActiveX variety) to change some of the data. But if the sheet is protected I can't use the spin buttons even when the cells to be manipulated are unprotected AND the spin buttons are unlocked. Is there ANY way to get around this without having to unprotect the entire sheet every time I use the spin buttons?? Thanks, --Abe Do you have a linkedcell? Is that cell locked? Can you unlock that linkedcell? You could put the linked cell on another sheet (or even in an unlocked hidden cell (hidden column or h...

Metrics are not available
Hi everyone, I get the following error message appear on my homepage when logging into GP9.0: "Metrics are not available because the Microsft Office Chart Control is Missing". This never appeared until we installed IE7 on all our systems, including the Citrix boxes where our users gain access to GP9.0. Following advice from a previous post I installed Office Web Components for Office XP onto the server, but it hasn't helped at all. Does anyone know a fix for this? Thanks all, T S Since the homepage is created and rendered on the individual workstation, I would look at...

Version Control of Database
Anybody have any suggestions for products to do version control of database objects? TIA - Jeff. Pretty much any source control. Source Safe, SCCS, CVS, any Gnu, etc. "Mr. Magic" <Mufasa@NoWhere.Com> wrote in message news:O29A5XnrKHA.1352@TK2MSFTNGP06.phx.gbl... > Anybody have any suggestions for products to do version control of > database objects? > > TIA - Jeff. http://en.wikipedia.org/wiki/Comparison_of_revision_control_software "Mr. Magic" <Mufasa@NoWhere.Com> wrote in message news:O29A5XnrKHA.1352@TK2MSFTNGP06...

Your current security settings prohibit running ActiveX controls on this page
Hello. When i open a certain email in Outlook 2003, i get the attached message. I followed the instructions in article id: 816702 and it still gives the same message. Any help would be greatly appreciated. Thanks, Tony --------------------------- Microsoft Internet Explorer --------------------------- Your current security settings prohibit running ActiveX controls on this page. As a result, the page may not display correctly. --------------------------- OK --------------------------- "Tony Girgenti" <tonylakeside@comcast.net> wrote in message news:u9Z9faRGGHA.64...

dont use XP style control
Is it possible to not use XP styling for one control, but all the others remain using the new style? j "JoeB" <MSforum1@---I-DONT-LIKE-SPAM---Kybert.co.uk> wrote in message news:e9hk4JpHEHA.2556@TK2MSFTNGP12.phx.gbl... > Is it possible to not use XP styling for one control, but all the others > remain using the new style? SetWindowTheme. -- Jeff Partch [VC++ MVP] ...

Can't see calculated control
I have a calculated control on a report called txttotalID with a record source which is =YTDValue("txtMonth","CountofID","qrypurpose",[txtmonth]) The YTDValue refers to a Module taht calculates YTD figures The rpeorts record source is qrypurpose and the query has the fileds txtmonth and CountofID and that works fine and gives me a value.. I have another calculated control called TotalID where the record source is =Sum([txttotalID]), the txttotalID being my first calculated control. However, when I run the report I get a prompt asking for the value of tx...