Re: SystemParametersInfo(SPI_GETWORKAREA,0,&o_Rect,0);
There seems to be some kinda of miscommunication between you and the rest of
us. I think your last three posts are related to same topic, so please post
related items in the same thread.
You might be going about what you want to do the wrong way. At this point
I don't even know what it is you are trying to do.
But you don't have to go through all that trouble to but a button on the
bottom right of your view. Lets start with this statement, every window in
the windows operating system is positioned with respect to its parent
window. So the fact that your button is on the bottom right of the view has
nothing to do with screen resolution, but has everything to do with the size
of the view (the parent of the button).
So in order to get it there (to the bottom right corner) you would something
like this:
CRect WinRect;
CRect ButtonRect;
GetClientRect(WinRect);
o_Verwijderen.GetWindowRect(&ButtonRect);
o_Verwijderen.SetWindowPos(NULL,WinRect.Width()-ButtonRect.Width(),WinRect.Height()-ButtonRect.Height(),0,0,SWP_NOZORDER|SWP_NOSIZE);
What this code is doing is gets the rect of the button, and the view, and
calculates an offset from the bottom right of the view based on the size of
the button, and moves the button there.
Now for the fullscreen problem, what is it that you are trying to do with
your application? Is it an MDI application or SDI application? Is the main
frame maximized, if it is a MDI application is the child frame also
maximized? Do you disable the restore button so that the user can't restore
it back down? Do you want your application go to cover the windows task
bar?
And I am sorry for being a little blunt about something. I have looked at
your past 40 posts (posted within the last 30 days) and if you were to apply
yourself a little more you would be able to solve most of the problems
without jumping to the newsgroup for answers. By trying to spend some time
solving a problem you will not only get a better understanding of what might
be causing a problem, but you might actually be able to explain things a
little clearly.
And if an answer doesn't satisfy your needs then reply to it and that it
doesn't work because such and such, instead of starting a new thread about.
This way the person answering you can either find a better solution and also
won't waste time posting the same solution over and over!
AliR.
"RAN" <nijenhuis@wish.nl> wrote in message
news:1188335480.667115.56090@g4g2000hsf.googlegroups.com...
Hi,
Im trying to make my GUI controls monitor display format settings
independant. I put a CButton control on the so called "work area"
using SystemParametersInfo().
I do :
void CTBURView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
ShowWindow(SW_SHOWMAXIMIZED);
long x,y;
CRect o_Rect;
SystemParametersInfo(SPI_GETWORKAREA,0,&o_Rect,0);
x = o_Rect.Width ();
y = o_Rect.Height ();
o_Verwijderen.GetClientRect(o_Rect);
o_Verwijderen.MoveWindow(10,(int)(y * 0.82),o_Rect.Width
(),o_Rect.Height ());
My CButton is called o_Verwijderen and i put it on 82% of the y value
generated in o_Rect by calling SystemParametersInfo(). So this must be
on the work area and visible.
SPI_GETWORKAREA :
Retrieves the size of the work area on the primary display monitor.
The work area is the portion of the screen not obscured by the system
taskbar or by application desktop toolbars. The pvParam parameter must
point to a RECT structure that receives the coordinates of the work
area, expressed in virtual screen coordinates.
But the button sits under the statusbar and if i remove the toolbar by
using the View menu option (for SDI standard apps) it is visible
again. I read the documentation for the SPI_GETWORKAREA option used by
SystemParametersInfo() saying the working area is without the
statusbar and the toolbar. But apperantly this is not true !?. Or what
do they mean ??