|
-
Jan 10th, 2001, 08:20 AM
#1
Thread Starter
Lively Member
i have a program that works as an nt task and i want to check if the program is working before nt starts it again
-
Jan 10th, 2001, 08:31 AM
#2
Frenzied Member
You mean if a program is running?
You can check if the classname already exists by using FindWindow API call.
If you need help, ask!
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Jan 10th, 2001, 09:06 AM
#3
Thread Starter
Lively Member
Before i Check this problem i have another problem
maybe you know what is "error 67 too many files" in VB
-
Jan 10th, 2001, 09:18 AM
#4
Lively Member
-
Jan 10th, 2001, 10:58 AM
#5
PowerPoster
reckus, that doesn't good enough. You should use the FindWindow as Jop mention. "coz you need to restore the running application to be active window.
Here juz a sample code. Assume your main form is call Form1 with caption set to Form1 as well.
Code:
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_SHOWNORMAL = 1
Private xhwnd As Long
Public Sub Main()
Dim xAppName As String
If App.PrevInstance Then
xAppName = "Form1"
xhwnd = FindWindow(0&, xAppName)
If xhwnd <> 0 Then
AppActivate xAppName
xhwnd = ShowWindow(xhwnd, SW_SHOWNORMAL)
End
End If
End If
Load Form1
Form1.Show
End Sub
-
Jan 10th, 2001, 11:03 AM
#6
Thread Starter
Lively Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|