473,508 Members | 2,327 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

First parameter to the FindWindow API

kd
Hi All,

I need to check whether an application is executing. I do not know the class
name of the application; however, I know the window caption of the
application. What would be the first parameter that I should be passing to
the FindWindow API, in order to check whether the application is executing?

Thanks.
kd
Nov 21 '05 #1
3 3086
"kd" <kd@discussions.microsoft.com> schrieb:
I need to check whether an application is executing. I do not know the
class
name of the application; however, I know the window caption of the
application. What would be the first parameter that I should be passing to
the FindWindow API, in order to check whether the application is
executing?


Simply pass 'vbNullString' to the first parameter and pass the window title
to the second parameter.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
Just extending what Mr MVP said:

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As String) As Integer

' Find Window passing the class name only
Dim intHandle As Integer = FindWindow("[Class Name Here]",
vbNullString)
' Show the handle in a messagebox
MessageBox.Show(intHandle, "Find Window Handle via class name")
' Find Window passing the Window caption only
Dim intHandle2 As Integer = FindWindow(vbNullString, "[Window
Caption Here]")
' Show the handle in a messagebox
MessageBox.Show(intHandle2, "Find Window Handle via Window caption")
Nov 21 '05 #3
Crouchie,

"Crouchie1998" <Cr**********@discussions.microsoft.com> schrieb:
Just extending what Mr MVP said:
:-)

I would be glad if you don't always call me "Mr MVP" :-). My name is
Herfried...
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA"
(ByVal
lpClassName As String, ByVal lpWindowName As String) As Integer

' Find Window passing the class name only
Dim intHandle As Integer = FindWindow("[Class Name Here]",
vbNullString)


Although your code works, I'd use 'IntPtr' for the handle returned by
'FindWindow' instead of 'Integer'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4

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

Similar topics

0
1607
by: James Hu | last post by:
Hi, For the simple code: from wxPython.wx import * class MyApp(wxApp): def OnInit(self): frame = wxFrame(NULL, -1, "Hello App") frame.Show(true)
5
3158
by: Ronny Sigo | last post by:
Hello all, I try to open and close a webpage (when timer ticks) The problem is that it won't close ... Can anybody see what I am doing wrong? I'll paste the code here ... Any help very much...
17
3037
by: lauren quantrell | last post by:
I have an Access application with the name: MyAppName® It has the "®" symbol (ChrW$(&H00AE)) at the end of it. If I remane the application without the "®" symbol, I can use FindWindow to close the...
4
2893
by: Olex Malko | last post by:
How to manage FindWindow() function working properly in ASP.NET application? In Windows Forms application it works fine. But in ASP.NET it returns NULL :( Probalby this is because of different...
0
558
by: TonyG | last post by:
I need to send a message to a window in another application. The name of the window is known at design time and set in the constant App2_MONITOR_CAPTION. The message is defined as X_GenerateEvent....
5
7042
by: victor | last post by:
Help .... This is my situation: I've made two apps, a Managed C# and an Unmanaged MFC. The C# app communicates with the MFC-app via (Win32-API) PostMessage, done with the P/Invoke method. One...
0
1535
by: Jim S | last post by:
Is looping FindWindow() ok? We have a simple little c# 2.0 app that’s sole purpose is to look for a dialog box from another app to pop up and then click it’s OK button. To do this we use a...
1
4292
by: musai | last post by:
Hi Members how to use findwindow API for outlook application let us example For excel we use to find excel FindWindow("XLMAIN", vbNullString)
2
7414
by: MegaOctet | last post by:
Hello, Here is my script import win32gui as w HWND= w.FindWindow("Document - WordPad",None) and here is the traceback: Traceback (most recent call last): File "C:\Python26\essai1.py",...
0
7120
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
7380
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...
1
7039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5626
agi2029
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,...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.