473,401 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Showing a window from a process

Hello.

I have 2 desktop programms..I will call them P1 and P2.

So, P1 launches P2 as a process. However, at some point I want to be able to show a window in P2.

My problem was that this window, when called, was showing correctly placed, in the middle of the screen, but in the back of P1.

So, in order to show it as the top most window, above all others applications running on my computer, I used the windows API:

Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOACTIVATE = &H10
Const SWP_SHOWWINDOW = &H40

<DllImport("user32.dll", CharSet:=CharSet.Auto, _ CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Boolean
End Function

And then in the form Activated event, I have called my new function:

Dim b As Boolean = SetWindowPos(Me.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE)

Now the window shows on top of all other, but it is placed in the top left corner of the screen, resized to much small dimentions, that I cannot even see the controls on it.

Could you please indicate some tips, some solutions?

Thank you in advance.
May 20 '11 #1
1 985
Hello, Anamaria,

It might be helpful if you could tell us how you are displaying the form (window) from P2.

But, I wonder if instead of SetWindowPos, have you tried using Me.BringToFront?

Cheers,
Randy
May 22 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: serge calderara | last post by:
Dear all, I have an application which is suppose to start another executable process. As soon as that process is running, I need to retrive its handle. The problem of the particular process I am...
19
by: Darren | last post by:
I have a page that opens a popup window and within the window, some databse info is submitted and the window closes. It then refreshes the original window using window.opener.location.reload(). ...
2
by: Wim | last post by:
From my Windows app I would like to open a DOS-window (Process.Start ("cmd", "/k");) and then run a number of processes in that DOS-window. How can I arrange that these processes start in that...
2
by: orekin | last post by:
Hi My program is a C# Windows application and I am using the following code to open an IE window: Process p = new Process(); p.StartInfo.FileName = "iexplore.exe"; p.StartInfo.WindowStyle =...
5
by: Cc | last post by:
hi, is there a way to get form state before resize?
1
by: Roger | last post by:
When looking through the list created by the System.Diagnositc.Process.GetProcesses and verifying it with the Task Manager Process list. There are items in the Task Manager Process list that are...
3
by: Mrozu | last post by:
Hi How I can set my app to be "unkilliable" in taksmanager->processes? I mean that user can't kill it there. Thx Mrozu
0
by: ivanov.andrei | last post by:
Working with Windows 2003 Server. Here's the weird behavior I see. Suppose I want to launch a new process that takes me to some website, http://127.0.0.1/ Now suppose that this website uses Java...
2
by: siddharthkhare | last post by:
Hi All, I am launching a IE using following code. ======================================================================= m_IeProcess = new Process(); m_IeProcess.StartInfo.WindowStyle =...
2
by: SiPex | last post by:
I'm trying to make a program that can hide a process that is running, and then restore it for you. I can successfully Hide the window using private const int SW_HIDE = 0; private const...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
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...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
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...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.