Solved

Show window without focus vb.net

Posted on 2007-04-02
6
1,558 Views
Last Modified: 2012-05-05
Hello all,

I've a notification window like messenger and I need to show it without losing the focus of the current application. How can I do that in vb.net?
What I'm using to show the window is the ShowWindow api.

Thanks in advance for your assistance.
0
Comment
Question by:nuberun
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18836560
You can do it WITHOUT BringWindowToFront() by using the SW_SHOWNA flag.

Assuming Form7 was the form you wanted to show without losing focus then you would use code like this:

    Private Declare Function ShowWindow Lib "user32" (ByVal handle As IntPtr, ByVal nCmdShow As Integer) As Integer

    Private Const SW_SHOWNA = 8

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim f As New Form7
        ShowWindow(f.Handle, SW_SHOWNA)
    End Sub
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 18836571
See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/WindowsUserInterface/Windowing/Windows/WindowReference/WindowFunctions/ShowWindow.asp

    "SW_SHOWNA = Displays the window in its current size and position. This value is similar to SW_SHOW, except the window is not activated."
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question