Hi all.
I'm writing a small utility that can move a window from one of my
monitors to the other, when a system hotkey is pressed. I want to keep
the windowstate (maximized or normal) when the window is moved, but I
need to know the windowstate in order to move it properly.
I'm using some P/Invoke calls to get the window handles and the window
placement, which all works well, but I can't find a way to determine if
a window is maximized or minimized. I need to know that so I can know
which bits of the WINDOWPLACEMENT struct to read to get position data.
Thanks.
--
jeremiah(); 4 10173
"jeremiah johnson" wrote:
I need to know the windowstate in order to move it properly.
Hello Jeremiah,
You can use the USER API GetWindowPlacem ent to obtain the current status of
a given window -- the showCmd field of the returned WINDOWPLACEMENT structure
should be equal to SW_MAXIMIZE (3) if the window is maximized.
You can find the P/Invoke signature and structure information at http://www.pinvoke.net/default.aspx/...indowPlacement
--
Best regards,
Stanimir Stoyanov ad***@nospam.st oyanoff.info
Deborah Kurata has an article in the latest CoDe magazine titled "Retaining
Multiple Sets of User Settings" While the topic isn't directly related to
your question, she uses a sample that stores window size and state (max/min)
upon application exit for each user of the system.
Essentially, she uses the Form.WindowStat e, Form.FormSize, and
Form.RestoreBou nds properties to persist a form's state and size.
-- http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"jeremiah johnson" wrote:
Hi all.
I'm writing a small utility that can move a window from one of my
monitors to the other, when a system hotkey is pressed. I want to keep
the windowstate (maximized or normal) when the window is moved, but I
need to know the windowstate in order to move it properly.
I'm using some P/Invoke calls to get the window handles and the window
placement, which all works well, but I can't find a way to determine if
a window is maximized or minimized. I need to know that so I can know
which bits of the WINDOWPLACEMENT struct to read to get position data.
Thanks.
--
jeremiah();
I had found this page before, but oddly I never thought to check
showCmd. Thank you.
One last thing (that I thought I'd figured out already, but haven't) is
how to determine which screen a window is on *when it is maximized*
using the Win32 API. It is easy to figure it out when it is not
maximized, the placement coordinates give that away, but when a window
is maximized, the Win32 API seems to tell me that the window origin is
-1, -1 no matter which screen the window in question is maximized on.
To clarify, I'm not worried about the form for the program I'm writing
now, its every other window on the user's desktop that I'm interested in
moving around, which is why I have to use user32.dll and P/Invoke to
move them around.
Thanks.
Stanimir Stoyanov wrote:
"jeremiah johnson" wrote:
>I need to know the windowstate in order to move it properly.
Hello Jeremiah,
You can use the USER API GetWindowPlacem ent to obtain the current status of
a given window -- the showCmd field of the returned WINDOWPLACEMENT structure
should be equal to SW_MAXIMIZE (3) if the window is maximized.
You can find the P/Invoke signature and structure information at http://www.pinvoke.net/default.aspx/...indowPlacement
--
jeremiah();
I figured it out.
To move a maximized window, you must first restore it to the normal
state (not maximized nor minimized,) move it to the window you want,
then maximize it again.
using a little WINDOWPLACEMENT manipulation I got it all working.
if anyone wants to see my code I'd be happy to share it.
Thanks.
jeremiah johnson wrote:
I had found this page before, but oddly I never thought to check
showCmd. Thank you.
One last thing (that I thought I'd figured out already, but haven't) is
how to determine which screen a window is on *when it is maximized*
using the Win32 API. It is easy to figure it out when it is not
maximized, the placement coordinates give that away, but when a window
is maximized, the Win32 API seems to tell me that the window origin is
-1, -1 no matter which screen the window in question is maximized on.
To clarify, I'm not worried about the form for the program I'm writing
now, its every other window on the user's desktop that I'm interested in
moving around, which is why I have to use user32.dll and P/Invoke to
move them around.
Thanks.
Stanimir Stoyanov wrote:
>"jeremiah johnson" wrote:
>>I need to know the windowstate in order to move it properly.
Hello Jeremiah,
You can use the USER API GetWindowPlacem ent to obtain the current status of a given window -- the showCmd field of the returned WINDOWPLACEMEN T structure should be equal to SW_MAXIMIZE (3) if the window is maximized.
You can find the P/Invoke signature and structure information at http://www.pinvoke.net/default.aspx/...indowPlacement
--
jeremiah(); This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: lkrubner |
last post by:
I've come up with a non-frame version of this site:
http://www.lauradenyes.com/
However, the owner doesn't like my version because the content in the
center sits too high in the center part, which wasn't a problem with
the frames.
The advantage of frames is that you can have a height based on a
percent of the frame, even when the frame takes up less than 100% of
|
by: Beacher |
last post by:
Hi all,
I have a form set to maximize on load (docmd.maximize) but when i open
another form by clicking a button on my main form, it restores itself
to its default window size, is there anyway I can prevent this? thanks
in advanced techies :)
|
by: Yatharth |
last post by:
Its a Web application.
I am developing an application in which my page is refreshing
continuosly.In that there is a textbox which is filled from the
database ,and changed when i changed the value from database.
Now suppose if i minimize my window and work on other browser and
suppose there is a textchange in my textbox,i want an alert like msn
uses (Blinking) or window maximize automatically.
|
by: JohnJohnUSA |
last post by:
I am new to Python. How do I get the following program to appear
initially with the window maximized? Thanks for your help!
from Tkinter import *
# set up the window itself
top = Tk()
F = Frame(top)
F.pack()
# add the widgets
lHello = Label(F, text="Hello")
|
by: gimme_this_gimme_that |
last post by:
I want to disable scrolling when a window is maximized on IE...
Is there a way to tell if the window is maximized?
Thanks.
| |
by: Bill Nguyen |
last post by:
This has been posted before but received no response:
I need to arrange window screens on the total area of a mulitple-mopnitor
desktop.
As an example, below is the bound info for my 2-monitor PC:
Device Name: \\.\DISPLAY1
Bounds: {X=1152,Y=0,Width=1152,Height=864}
Primary Screen: False
|
by: arajunk |
last post by:
In Firefox this opens a full size window (maximized) . In IE it opens
the partial window requiring user to click restore (upper right) to
maximize. What am I missing ?
var
infoWindow=window.open('usgsMain.html','USGSwindow','status=no,resizable=yes,scrollbars=yes');
|
by: Samuel |
last post by:
The application is MDI, as soon as the application loads I create a new
child window (maximized), within the child window there is a tab control
almost the size of the child window
The problem is that when the application first loads the top of the tab
control is hidden and it seems as though the header part of the tab control
is not taken into account as far as location or sizing the control (the
control is anchored on all sides). It is...
|
by: Thom Little |
last post by:
Using C# 3.5 (including using System.Runtime.InteropServices) ...
.... if the window is Minimized (IsIconic) ... I would like to ...
If the window was Normal and then Minimized I would like to return it to
Normal.
If the window was Maximized and then Minimized I would like to return it to
Maximized
How can I determine for any window that is minimized if it was previously
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |