-
Hi, if you use ADO or OLEDB, you will need to have your service run with an NT account, you can set the account and password with the OCX, or by the configuration pannel -> services, select your service, and instead of using system account, use user account with the full form: if your user account is balajigr1214, use the form SERDIV/balajigr1214
For VB.Net, I don't know really about, there is a vb.net forum here, and I think that this is not much requirement, it is more the developper computer that will need to be better than the one that run the compiled exe.
JeffB - have a nice day (night...)
-
.NET Framewrork will be needed on the client PCs. It better to have the service run on the server and the client query that server for data ...
-
Reading this thread in its totality I think Jeff has some good knowledge about exe. I want to know if there is a way to dettect that a exe is not running and if it is not running then to activate it ... Activating is not a problem actually .. The only thing is how to detect that a exe is activated ...
thanks.
-
[QUOTE]Originally posted by JeffB
Hi, if you use ADO or OLEDB, you will need to have your service run with an NT account, you can set the account and password with the OCX, or by the configuration pannel -> services, select your service, and instead of using system account, use user account with the full form: if your user account is balajigr1214, use the form SERDIV/balajigr1214
For VB.Net, I don't know really about, there is a vb.net forum here, and I think that this is not much requirement, it is more the developper computer that will need to be better than the one that run the compiled exe.
JeffB - have a nice day (night...) [/QUO
TE]
Hi Jeff,
Thanks,i will be working on the services very soon.All this as helped me a lot.Maybe if any doubt i will get back to you.
Bye
-
That code will allow you to detect, for example, if the process notepad.exe is running. It will only do a msgbox if it find the process. Remember, their can be a lot of process that have the same name, but different PIDS. Try the program while their is many notepad opened, you'll see. You should rearranged all of the code to make a function where you pass a EXE name and that return an array of PIDS number. Oh well, here it is : :)
Code:
Option Explicit
Private Declare Function EnumProcesses Lib "psapi.dll" _
(lpidProcess As Long, _
ByVal cb As Long, _
cbNeeded As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Private Declare Function EnumProcessModules Lib "psapi.dll" _
(ByVal hProcess As Long, _
lphModule As Long, _
ByVal cb As Long, _
lpcbNeeded As Long) As Long
Private Declare Function GetModuleBaseName Lib "psapi.dll" _
Alias "GetModuleBaseNameA" _
(ByVal hProcess As Long, _
ByVal hModule As Long, _
ByVal lpBaseName As String, _
ByVal nSize As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Sub Command1_Click()
Dim lngPIDList() As Long ' The list of the Process (PIDs)
Dim lngNumberOfPID As Long ' Number of PIDs
Dim lngReturnValue As Long ' Return value of Win32 function
Dim lngNumberOfBytesReceived As Long ' Number of Bytes received from EnumProcess()
Dim lngProcessHandle As Long ' Process Handle (OpenProcess)
Dim lngModuleHandle As Long ' Module Handle (EnumProcessModule)
Dim strProcessName As String ' Name of the process
Dim strExe As String
strExe = "notepad.exe" ' Name of the researched process
Dim i As Long ' For...Next i
Dim lngNumberOfProcessFound As Long 'How many notepad.exe have we found?
lngNumberOfProcessFound = 0
lngNumberOfPID = 100
ReDim lngPIDList(lngNumberOfPID)
'Return the list of process (PIDS number)
lngReturnValue = EnumProcesses(lngPIDList(0), lngNumberOfPID * 4, lngNumberOfBytesReceived)
If lngReturnValue = 0 Then
MsgBox "RED-ALERT: No PID returned (EnumProcess)"
Exit Sub
End If
'How many process do we receive???
lngNumberOfPID = lngNumberOfBytesReceived / 4
If lngNumberOfPID = 0 Then
MsgBox "No process corresponding to :" & strExe
End If
For i = 0 To lngNumberOfPID - 1
' Process 0, 2, and 28 are special process we don't want to analyse them
If lngPIDList(i) = 0 Or lngPIDList(i) = 2 Or lngPIDList(i) = 28 Then GoTo NextProcess
' Retrieve an handle on the process
lngProcessHandle = OpenProcess(&H400 Or &H10, 0&, lngPIDList(i))
If lngProcessHandle = 0 Then GoTo NextProcess
'Retrieve an handle on the fist module of the process (first module is always
'the EXE)
lngModuleHandle = 0
lngReturnValue = EnumProcessModules(lngProcessHandle, lngModuleHandle, 4&, lngNumberOfBytesReceived)
If lngReturnValue = 0 Then GoTo NextProcess
' Get the name of the module
strProcessName = String$(256, 0)
lngReturnValue = GetModuleBaseName(lngProcessHandle, lngModuleHandle, strProcessName, Len(strProcessName))
If lngReturnValue = 0 Then GoTo NextProcess
strProcessName = Replace(strProcessName, Chr(0), "")
' Is that the name we are searching?
If UCase$(strProcessName) = UCase$(strExe) Then
lngNumberOfProcessFound = lngNumberOfProcessFound + 1
MsgBox strProcessName & " " & lngPIDList(i), vbOKOnly, "Result"
End If
NextProcess:
' Close the handle of the process
If lngProcessHandle > 0 Then CloseHandle (lngProcessHandle)
Next i
If lngNumberOfProcessFound = 0 Then
MsgBox "No process ---" & strExe & "--- founded.", vbOKOnly, "Result"
End If
End Sub
sorry for misaligned text ... :(
JeffB