Solved

Show window without focus vb.net

Posted on 2007-04-02
6
1,552 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
 

Author Comment

by:nuberun
ID: 18836243
0
 
LVL 85

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 85

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to line 23 74
Change to file doesn't show up 16 76
How to force output to ascii 2 36
Check only one toolstripmenu item 12 24
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

756 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