Hello All,
Hope eveyone is having a better morning than me today. Anyway, I know
the .NET framework has classes to obtain process ID's of processes running
in the task manager. My question is; Does .NET have anything in it's bag of
tricks to give me the process ID of an instance I create through code?
Example:
Dim objExcel as Excel.Application
objExcel = New Excel.Application <----- I want to know the process ID
right after I create this instance.
Is there anyway I can get that info? Any guidance would be greatly
appreciated.
-Thanks,
Frank 8 1779
Hi Frank,
Don't know about .NET, but this function gets a process id. Perhaps you can
build into .NET
Function ProcID() As Long
Dim hwnd As Long
Dim idProc As Long
hwnd = FindWindow(vbNullString, "Microsoft Excel")
Call GetWindowThreadProcessId(hwnd, idProc)
ProcID = idProc
End Function
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Frank DeLuccia" <fd*************************@edifice-ims.com> wrote in
message news:%2****************@tk2msftngp13.phx.gbl... Hello All,
Hope eveyone is having a better morning than me today. Anyway, I know the .NET framework has classes to obtain process ID's of processes running in the task manager. My question is; Does .NET have anything in it's bag
of tricks to give me the process ID of an instance I create through code?
Example:
Dim objExcel as Excel.Application
objExcel = New Excel.Application <----- I want to know the process ID right after I create this instance.
Is there anyway I can get that info? Any guidance would be greatly appreciated.
-Thanks, Frank
Hi Frank,
Don't know about .NET, but this function gets a process id. Perhaps you can
build into .NET
Function ProcID() As Long
Dim hwnd As Long
Dim idProc As Long
hwnd = FindWindow(vbNullString, "Microsoft Excel")
Call GetWindowThreadProcessId(hwnd, idProc)
ProcID = idProc
End Function
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Frank DeLuccia" <fd*************************@edifice-ims.com> wrote in
message news:%2****************@tk2msftngp13.phx.gbl... Hello All,
Hope eveyone is having a better morning than me today. Anyway, I know the .NET framework has classes to obtain process ID's of processes running in the task manager. My question is; Does .NET have anything in it's bag
of tricks to give me the process ID of an instance I create through code?
Example:
Dim objExcel as Excel.Application
objExcel = New Excel.Application <----- I want to know the process ID right after I create this instance.
Is there anyway I can get that info? Any guidance would be greatly appreciated.
-Thanks, Frank
Bob,
Thanks for the hint but the Excel visible property is set to false b/c
this is an automated process without interaction, there could be multiple
instances of excel running, and I need the process ID of the instance being
created at runtime. The thought is if there is an error in that instance
running, I can kill that process using the ID while leaving the other
instances alone.
Thanks for your time,
Frank
"Bob Phillips" <bo**********@notheretiscali.co.uk> wrote in message
news:ek**************@TK2MSFTNGP09.phx.gbl... Hi Frank,
Don't know about .NET, but this function gets a process id. Perhaps you
can build into .NET
Function ProcID() As Long Dim hwnd As Long Dim idProc As Long hwnd = FindWindow(vbNullString, "Microsoft Excel") Call GetWindowThreadProcessId(hwnd, idProc) ProcID = idProc
End Function
--
HTH
Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct)
"Frank DeLuccia" <fd*************************@edifice-ims.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Hello All,
Hope eveyone is having a better morning than me today. Anyway, I
know the .NET framework has classes to obtain process ID's of processes
running in the task manager. My question is; Does .NET have anything in it's
bag of tricks to give me the process ID of an instance I create through code?
Example:
Dim objExcel as Excel.Application
objExcel = New Excel.Application <----- I want to know the process ID right after I create this instance.
Is there anyway I can get that info? Any guidance would be greatly appreciated.
-Thanks, Frank
Bob,
Thanks for the hint but the Excel visible property is set to false b/c
this is an automated process without interaction, there could be multiple
instances of excel running, and I need the process ID of the instance being
created at runtime. The thought is if there is an error in that instance
running, I can kill that process using the ID while leaving the other
instances alone.
Thanks for your time,
Frank
"Bob Phillips" <bo**********@notheretiscali.co.uk> wrote in message
news:ek**************@TK2MSFTNGP09.phx.gbl... Hi Frank,
Don't know about .NET, but this function gets a process id. Perhaps you
can build into .NET
Function ProcID() As Long Dim hwnd As Long Dim idProc As Long hwnd = FindWindow(vbNullString, "Microsoft Excel") Call GetWindowThreadProcessId(hwnd, idProc) ProcID = idProc
End Function
--
HTH
Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct)
"Frank DeLuccia" <fd*************************@edifice-ims.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Hello All,
Hope eveyone is having a better morning than me today. Anyway, I
know the .NET framework has classes to obtain process ID's of processes
running in the task manager. My question is; Does .NET have anything in it's
bag of tricks to give me the process ID of an instance I create through code?
Example:
Dim objExcel as Excel.Application
objExcel = New Excel.Application <----- I want to know the process ID right after I create this instance.
Is there anyway I can get that info? Any guidance would be greatly appreciated.
-Thanks, Frank
Hi Frank,
I think you could still use Bob's suggestion. When you create the instance
of Excel, just check the value of the application's Hwnd property. Then
pass that value to the GetWindowThreadProcessId function to get the PID.
In your case:
Public Declare Function GetWindowThreadProcessId Lib "user32" _
(ByVal hwnd As Long, lpdwProcessId As Long) As Long
Sub Test()
Dim objExcel As Excel.Application
Dim lPID As Long
Set objExcel = New Excel.Application
GetWindowThreadProcessId objExcel.hwnd, lPID
Debug.Print "PID: " & CStr(lPID)
objExcel.Quit
Set objExcel = Nothing
End Sub
--
Regards,
Jake Marx
MS MVP - Excel www.longhead.com
[please keep replies in the newsgroup - email address unmonitored]
Frank DeLuccia wrote: Bob,
Thanks for the hint but the Excel visible property is set to false b/c this is an automated process without interaction, there could be multiple instances of excel running, and I need the process ID of the instance being created at runtime. The thought is if there is an error in that instance running, I can kill that process using the ID while leaving the other instances alone.
Thanks for your time, Frank
"Bob Phillips" <bo**********@notheretiscali.co.uk> wrote in message news:ek**************@TK2MSFTNGP09.phx.gbl... Hi Frank,
Don't know about .NET, but this function gets a process id. Perhaps you can build into .NET
Function ProcID() As Long Dim hwnd As Long Dim idProc As Long hwnd = FindWindow(vbNullString, "Microsoft Excel") Call GetWindowThreadProcessId(hwnd, idProc) ProcID = idProc
End Function
--
HTH
Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct)
"Frank DeLuccia" <fd*************************@edifice-ims.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Hello All,
Hope eveyone is having a better morning than me today. Anyway, I know the .NET framework has classes to obtain process ID's of processes running in the task manager. My question is; Does .NET have anything in it's bag of tricks to give me the process ID of an instance I create through code?
Example:
Dim objExcel as Excel.Application
objExcel = New Excel.Application <----- I want to know the process ID right after I create this instance.
Is there anyway I can get that info? Any guidance would be greatly appreciated.
-Thanks, Frank
Hi Frank,
I think you could still use Bob's suggestion. When you create the instance
of Excel, just check the value of the application's Hwnd property. Then
pass that value to the GetWindowThreadProcessId function to get the PID.
In your case:
Public Declare Function GetWindowThreadProcessId Lib "user32" _
(ByVal hwnd As Long, lpdwProcessId As Long) As Long
Sub Test()
Dim objExcel As Excel.Application
Dim lPID As Long
Set objExcel = New Excel.Application
GetWindowThreadProcessId objExcel.hwnd, lPID
Debug.Print "PID: " & CStr(lPID)
objExcel.Quit
Set objExcel = Nothing
End Sub
--
Regards,
Jake Marx
MS MVP - Excel www.longhead.com
[please keep replies in the newsgroup - email address unmonitored]
Frank DeLuccia wrote: Bob,
Thanks for the hint but the Excel visible property is set to false b/c this is an automated process without interaction, there could be multiple instances of excel running, and I need the process ID of the instance being created at runtime. The thought is if there is an error in that instance running, I can kill that process using the ID while leaving the other instances alone.
Thanks for your time, Frank
"Bob Phillips" <bo**********@notheretiscali.co.uk> wrote in message news:ek**************@TK2MSFTNGP09.phx.gbl... Hi Frank,
Don't know about .NET, but this function gets a process id. Perhaps you can build into .NET
Function ProcID() As Long Dim hwnd As Long Dim idProc As Long hwnd = FindWindow(vbNullString, "Microsoft Excel") Call GetWindowThreadProcessId(hwnd, idProc) ProcID = idProc
End Function
--
HTH
Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct)
"Frank DeLuccia" <fd*************************@edifice-ims.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Hello All,
Hope eveyone is having a better morning than me today. Anyway, I know the .NET framework has classes to obtain process ID's of processes running in the task manager. My question is; Does .NET have anything in it's bag of tricks to give me the process ID of an instance I create through code?
Example:
Dim objExcel as Excel.Application
objExcel = New Excel.Application <----- I want to know the process ID right after I create this instance.
Is there anyway I can get that info? Any guidance would be greatly appreciated.
-Thanks, Frank
Thanks, Guys, for all your help!!!
"Jake Marx" <ms****@longhead.com> wrote in message
news:Oa**************@TK2MSFTNGP11.phx.gbl... Hi Frank,
I think you could still use Bob's suggestion. When you create the
instance of Excel, just check the value of the application's Hwnd property. Then pass that value to the GetWindowThreadProcessId function to get the PID.
In your case:
Public Declare Function GetWindowThreadProcessId Lib "user32" _ (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Sub Test() Dim objExcel As Excel.Application Dim lPID As Long
Set objExcel = New Excel.Application GetWindowThreadProcessId objExcel.hwnd, lPID Debug.Print "PID: " & CStr(lPID) objExcel.Quit Set objExcel = Nothing End Sub
-- Regards,
Jake Marx MS MVP - Excel www.longhead.com
[please keep replies in the newsgroup - email address unmonitored]
Frank DeLuccia wrote: Bob,
Thanks for the hint but the Excel visible property is set to false b/c this is an automated process without interaction, there could be multiple instances of excel running, and I need the process ID of the instance being created at runtime. The thought is if there is an error in that instance running, I can kill that process using the ID while leaving the other instances alone.
Thanks for your time, Frank
"Bob Phillips" <bo**********@notheretiscali.co.uk> wrote in message news:ek**************@TK2MSFTNGP09.phx.gbl... Hi Frank,
Don't know about .NET, but this function gets a process id. Perhaps you can build into .NET
Function ProcID() As Long Dim hwnd As Long Dim idProc As Long hwnd = FindWindow(vbNullString, "Microsoft Excel") Call GetWindowThreadProcessId(hwnd, idProc) ProcID = idProc
End Function
--
HTH
Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct)
"Frank DeLuccia" <fd*************************@edifice-ims.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Hello All,
Hope eveyone is having a better morning than me today. Anyway, I know the .NET framework has classes to obtain process ID's of processes running in the task manager. My question is; Does .NET have anything in it's bag of tricks to give me the process ID of an instance I create through code?
Example:
Dim objExcel as Excel.Application
objExcel = New Excel.Application <----- I want to know the process ID right after I create this instance.
Is there anyway I can get that info? Any guidance would be greatly appreciated.
-Thanks, Frank
Thanks, Guys, for all your help!!!
"Jake Marx" <ms****@longhead.com> wrote in message
news:Oa**************@TK2MSFTNGP11.phx.gbl... Hi Frank,
I think you could still use Bob's suggestion. When you create the
instance of Excel, just check the value of the application's Hwnd property. Then pass that value to the GetWindowThreadProcessId function to get the PID.
In your case:
Public Declare Function GetWindowThreadProcessId Lib "user32" _ (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Sub Test() Dim objExcel As Excel.Application Dim lPID As Long
Set objExcel = New Excel.Application GetWindowThreadProcessId objExcel.hwnd, lPID Debug.Print "PID: " & CStr(lPID) objExcel.Quit Set objExcel = Nothing End Sub
-- Regards,
Jake Marx MS MVP - Excel www.longhead.com
[please keep replies in the newsgroup - email address unmonitored]
Frank DeLuccia wrote: Bob,
Thanks for the hint but the Excel visible property is set to false b/c this is an automated process without interaction, there could be multiple instances of excel running, and I need the process ID of the instance being created at runtime. The thought is if there is an error in that instance running, I can kill that process using the ID while leaving the other instances alone.
Thanks for your time, Frank
"Bob Phillips" <bo**********@notheretiscali.co.uk> wrote in message news:ek**************@TK2MSFTNGP09.phx.gbl... Hi Frank,
Don't know about .NET, but this function gets a process id. Perhaps you can build into .NET
Function ProcID() As Long Dim hwnd As Long Dim idProc As Long hwnd = FindWindow(vbNullString, "Microsoft Excel") Call GetWindowThreadProcessId(hwnd, idProc) ProcID = idProc
End Function
--
HTH
Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct)
"Frank DeLuccia" <fd*************************@edifice-ims.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Hello All,
Hope eveyone is having a better morning than me today. Anyway, I know the .NET framework has classes to obtain process ID's of processes running in the task manager. My question is; Does .NET have anything in it's bag of tricks to give me the process ID of an instance I create through code?
Example:
Dim objExcel as Excel.Application
objExcel = New Excel.Application <----- I want to know the process ID right after I create this instance.
Is there anyway I can get that info? Any guidance would be greatly appreciated.
-Thanks, Frank This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Frank DeLuccia |
last post by:
Hello All,
Hope eveyone is having a better morning than me today. Anyway, I know
the .NET framework has classes to obtain process ID's of processes running
in the task manager. My question is;...
|
by: ME |
last post by:
How would one obtain the parameter VALUES of a method that has already run?
I can find the method using the StackTrace and StackFrame classes but once I
find the method I would like to obtain the...
|
by: ME |
last post by:
How would one obtain the parameter VALUES of a method that has already run?
I can find the method using the StackTrace and StackFrame classes but once I
find the method I would like to obtain the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |