473,386 Members | 1,706 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,386 software developers and data experts.

A window on top of another window

Hi,

Say that I have 2 windows A and B.
If I want A to be always on top of B, how can I do this in
C# WITHOUT having to set the TopMost property of A to TRUE.
Thank you very much in advance.

regards,
Sean
Nov 16 '05 #1
4 8311
Hi,

"Sean" <an*******@discussions.microsoft.com> wrote in message
news:0d****************************@phx.gbl...
Hi,

Say that I have 2 windows A and B.
If I want A to be always on top of B, how can I do this in
C# WITHOUT having to set the TopMost property of A to TRUE.
When showing A specify B as the owner, eg:

FormB:
void ShowA()
{
FormA a = new FormA();
a.Show( this );
}

HTH,
greetings



Thank you very much in advance.

regards,
Sean

Nov 16 '05 #2
Hi,

"Sean" <an*******@discussions.microsoft.com> wrote in message
news:0d****************************@phx.gbl...
Hi,

Say that I have 2 windows A and B.
If I want A to be always on top of B, how can I do this in
C# WITHOUT having to set the TopMost property of A to TRUE.
When showing A specify B as the owner, eg:

FormB:
void ShowA()
{
FormA a = new FormA();
a.Show( this );
}

HTH,
greetings



Thank you very much in advance.

regards,
Sean

Nov 16 '05 #3
You can use,

[DllImport("user32")]
public static extern int SetWindowPos(int hwnd, int hWndInsertAfter, int x,
int y, int cx, int cy, int wFlags)

you have to set

hWndInsertAfter = HWND_TOPMOST

--
Shak
(Houston)
"Sean" <an*******@discussions.microsoft.com> wrote in message
news:0d****************************@phx.gbl...
Hi,

Say that I have 2 windows A and B.
If I want A to be always on top of B, how can I do this in
C# WITHOUT having to set the TopMost property of A to TRUE.
Thank you very much in advance.

regards,
Sean

Nov 16 '05 #4
Hi Shak,

Thank you for your reply.

However, I cannot use TopMost property because after I
show Form A, I want another window to be always on top of
Form A (at the sametime I also want Form A to be always on
top of Form B).

(top)
Another Form (always on top of A)
|
Form A (always on top of B)
|
Form B
(bottom)

That's why if I use TopMost, I can't get the above to work.
I tried setting
A.Owner = B
but still I can click any button on Form B.

Any help would be greatly appreciated.
Thank you in advance.
regards,
Sean
-----Original Message-----
You can use,

[DllImport("user32")]
public static extern int SetWindowPos(int hwnd, int hWndInsertAfter, int x,int y, int cx, int cy, int wFlags)

you have to set

hWndInsertAfter = HWND_TOPMOST

--
Shak
(Houston)
"Sean" <an*******@discussions.microsoft.com> wrote in messagenews:0d****************************@phx.gbl...
Hi,

Say that I have 2 windows A and B.
If I want A to be always on top of B, how can I do this in C# WITHOUT having to set the TopMost property of A to TRUE.

Thank you very much in advance.

regards,
Sean

.

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Barry Svee | last post by:
I'm struggling with the JavaScript blur event. I have an activex control that I need to interact with when a window loses focus, namely to instruct it to give up control of a barcode scanner so...
9
by: Christopher Benson-Manica | last post by:
In some old Javascript we have, we try to determine whether the client is IE or Netscape (assume for the purposes of this question that the question can be resolved satisfactorily) and tailor the...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
4
by: bbass | last post by:
thanks to all that replyied to my previous post with the following code in question: <a href="merc.htm" target="_new_merc" onfocusout=window.close class="left_link"> i understand that the...
7
by: multicherry | last post by:
Hi, Having searched for a way to fetch a window object by name, all I came across were answers along the line of... "All you have to do is say windowObj = window.open("blah", "name");" which...
2
by: KC | last post by:
Hi, Every JavaScript executive context has a top-level window and we can use window.open() to open another window ... Does this related to Windows created by click on "File"->"New Window" or...
2
by: Torilyn73 | last post by:
Is it possible to have a combo box and when you make a selection from the choices in that box, that a pop up box opens to show the results... AND (here is the tricky part) have that pop up box...
3
by: Jimmy | last post by:
Is it possible to open a pop-up browser window (modal-style) inside another browser? e.g. // assuming something is calling this function inside the html as some event got triggered function...
4
by: MichaelK | last post by:
Hello. I have all data already collected on the current page? I want to open another window with the form, fill the fields and submit that form. So basically the question is how can I fill all...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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...

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.