I know this has probably been answered already, but the Search did not find any results. I am looking for a simple way to find out if an exe file is running (VB6 NT4-SP6). Any help is greatly appreciated.
have you tried the FindWindow() API command? you can find a window using either the caption on the program, or it's classname, then it'll return a handle to that window, from there you can modify anything, if it returns null(or false) Then that caption, or classname is not running. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href=
</a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
Unfortunately, the application that I am looking for does not have a constant caption. The application I am trying to pin down is another VB utility that I have written for our 3-D modeling software. It is just a standard exe program. How would I find it using the classname? I have done this before using XLMAIN for Excel, but I am not sure how to go about it with this application.<br><br>Thanks
do you know the classname of the application? (almost all exe have a classname) <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href=
</a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
far as classname goes, like IE when you use Spy++ (comes with Visual Studio) use Find window, and move the target over a unique part of the window, like with IE if I put it over this HTML view part the classname is Internet Explorer_Server, the classname of the frame is IEFrame., your program might have something similiar. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href=
</a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
That would be too easy. I do not have the complete Visual Studio package. When making a standard exe program, can you specify/define the classname? I can see the process in Task Manager. I have found code to list all of the running processes. It just seems a bit long for my needs. I will keep pecking around for something simpler like: IsThisDarnAppRunning("something.exe"<br><br><A HREF="
nope, the exe name cannot be specified, mainly because the filename has nothing to do with the application itself, you could have the same application with different filenames, still wouldnt make a difference. you might have it under /visual studio 6 tools , you may have spy++ , if not I can write you can application that shows you the classname of whatever your mouse is over. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href=
</a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
No, I do not have spy*.* on my machine. I do appreciate the offer to help me out, but I do not think that is required. The routine I found requires psapi.dll which I do not have either. I can just have the one app set up a flag which the other app can read. I was just trying to avoid messing with the other application. I guess it all pays the same! Thanks anyway!
I found a solution in vb-world.net. I was looking for FILENAME.exe and just checked: If TaskName Like "FILENAME". To list all running apps, create a new project, add a command button and a listbox, then insert this code. <br><br>Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long<br>Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long<br>Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long<br>Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long<br>Const GW_HWNDFIRST = 0<br>Const GW_HWNDNEXT = 2<br>Private Sub Command1_Click()<br> LoadTaskList<br>End Sub<br>Sub LoadTaskList()<br> Dim CurrWnd As Long<br> Dim Length As Long<br> Dim TaskName As String<br> Dim Parent As Long<br> List1.Clear<br> CurrWnd = GetWindow(Form1.hwnd, GW_HWNDFIRST)<br> While CurrWnd <> 0<br> Parent = GetParent(CurrWnd)<br> Length = GetWindowTextLength(CurrWnd)<br> TaskName = Space$(Length + 1)<br> Length = GetWindowText(CurrWnd, TaskName, Length + 1)<br> TaskName = Left$(TaskName, Len(TaskName) - 1)<br> If Length > 0 Then<br> If TaskName <> Me.Caption Then<br> List1.AddItem TaskName<br> End If<br> End If<br> CurrWnd = GetWindow(CurrWnd, GW_HWNDNEXT)<br> DoEvents<br> Wend<br>End Sub<br><br>Once again, thanks for your help!<br>
</a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
Cargill's Corporate Web Site</a><br>Please -- Don't send me email questions without posting them in Tek-Tips as well. Better yet -- Post the question in Tek-Tips and send me a note saying "Have a look at so-and-so in the thingy forum would you?"
Add this one to your tool box. It returns the physical path and filename of any EXE or DLL running on a system.<br>You'll need a command button and a list box:<br><br>Public Const TH32CS_SNAPPROCESS As Long = 2&<br>Public Const MAX_PATH As Integer = 260<br>Public Type PROCESSENTRY32<br> dwSize As Long<br> cntUsage As Long<br> th32ProcessID As Long<br> th32DefaultHeapID As Long<br> th32ModuleID As Long<br> cntThreads As Long<br> th32ParentProcessID As Long<br> pcPriClassBase As Long<br> dwFlags As Long<br> szExeFile As String * MAX_PATH<br>End Type<br>Public Declare Function CreateToolhelpSnapshot Lib "Kernel32" Alias _<br>"CreateToolhelp32Snapshot" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long<br>Public Declare Function ProcessFirst Lib "Kernel32" Alias "Process32First" _<br>(ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long<br>Public Declare Function ProcessNext Lib "Kernel32" Alias "Process32Next" _<br>(ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long<br>Public Declare Sub CloseHandle Lib "Kernel32" (ByVal hPass As Long)<br><br>Private Sub Command1_Click()<br>Dim hSnapShot As Long<br>Dim uProcess As PROCESSENTRY32<br>Dim r As Long<br>hSnapShot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)<br>If hSnapShot = 0 Then<br> Exit Sub<br>End If<br>uProcess.dwSize = Len(uProcess)<br>r = ProcessFirst(hSnapShot, uProcess)<br>Do While r<br> List1.AddItem uProcess.szExeFile<br> r = ProcessNext(hSnapShot, uProcess)<br>Loop<br>Call CloseHandle(hSnapShot)<br>End Sub<br><br> <p> <br><a href=mailto: > </a><br><a href=
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.