I wonder if anyone know how to activate a window with a given window
handler. I used to do this with the win32 API
static native boolean SetForegroundWindow(int hwnd);
I wonder if there is native support for that within .NET, instead having to
call WIN32 API.
Regards
Michael 3 5062
Michael,
You can try the Form.Activate() method, but I am not sure this is the exact
equivalent to the SetForegroundWindow() API.
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"Michael Wu" <do**************************@my.com> wrote in message
news:ec**************@TK2MSFTNGP09.phx.gbl... I wonder if anyone know how to activate a window with a given window handler. I used to do this with the win32 API
static native boolean SetForegroundWindow(int hwnd);
I wonder if there is native support for that within .NET, instead having
to call WIN32 API.
Regards
Michael
Still Win32.
Are you looking to just bring a window up?
Does ShowWindowAsync work for what you are doing? This will bring it to
the top of the z-order and restore it if minimized.
Public Const SW_RESTORE = 9
Public Const HWND_TOP = 0
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Declare Function ShowWindowAsync Lib "user32" (ByVal hwnd As Integer, ByVal
nCmdShow As Integer) As Integer
Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Integer, ByVal
hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, ByVal cx
As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
ShowWindowAsync(temphwnd, SW_RESTORE)
'bring it to the top of the z-order
SetWindowPos(temphwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
'unlock it where it is
SetWindowPos(temphwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
//Win32APIs.ShowWindowAsync(whdl.ToInt32(), Win32APIs.SC_RESTORE);
doen'st work, but the following 2 lines did work. Any idea why?
Win32APIs.SetForegroundWindow(whdl.ToInt32());
Win32APIs.SendNotifyMessage(whdl.ToInt32(), Win32APIs.WM_SYSCOMMAND,
Win32APIs.SC_RESTORE, 0);
"smith" <rc********@smithvoiceTAKEOUT.com> wrote in message
news:yv*****************@newsread2.news.pas.earthl ink.net... Still Win32.
Are you looking to just bring a window up? Does ShowWindowAsync work for what you are doing? This will bring it to the top of the z-order and restore it if minimized.
Public Const SW_RESTORE = 9 Public Const HWND_TOP = 0 Public Const HWND_TOPMOST = -1 Public Const HWND_NOTOPMOST = -2 Public Const SWP_NOMOVE = &H2 Public Const SWP_NOSIZE = &H1
Declare Function ShowWindowAsync Lib "user32" (ByVal hwnd As Integer,
ByVal nCmdShow As Integer) As Integer
Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Integer, ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, ByVal
cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
ShowWindowAsync(temphwnd, SW_RESTORE) 'bring it to the top of the z-order SetWindowPos(temphwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE) 'unlock it where it is SetWindowPos(temphwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or
SWP_NOSIZE) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Milon |
last post by:
Hi all,
I am new to Python, and I just wrote a simple script to launch an
application from the windows's start menu's run command. (see code as
follow) There is an "OK" button on the new...
|
by: James Spibey |
last post by:
Hi,
I have an MDI application which has aboout 10 child windows. The way
the app needs to work is that only one window should be visible at a
time and it should be maximized within the parent...
|
by: Earl Teigrob |
last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
|
by: SJ |
last post by:
Is it possible to pop-up a window from the code-behind
aspx.cs file on an OnClick event?
If so, how?
I've tried something like the following, but it doesnt seem to work.
private void...
|
by: Michael Wu |
last post by:
I wonder if anyone know how to activate a window with a given window
handler. I used to do this with the win32 API
static native boolean SetForegroundWindow(int hwnd);
I wonder if there is...
|
by: Dave Booker |
last post by:
I have a Windows form application that I generally run minimized. When a
critical event occurs it instantiates another "Alert" form which I want to
grab the user focus.
In the Alert constructor...
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - I have window.status="Moomin"; why doesn't the statusbar change?...
|
by: pearturtle123 |
last post by:
Hi,
I am new to Python and I am using PAMIE to manipulate IE browser. Currently, I have IE window 1 launched, after I clicked on a link on window 1, a second IE window 2 isopened. Then, I want...
|
by: =?ISO-8859-1?Q?Une_B=E9vue?= |
last post by:
i'd like to intercept the window.onload event in order to distribute it,
as needed, to several methods.
example :
suppose i have several methods doing unlinked initialisations:
...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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...
|
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,...
|
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...
| |