הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Question
Thursday, October 24, 2013 5:48 AM
Hi
i am using Widnows Forms and VB.Net .
I need to get and object from running process list and add it to GetObject method.
I have done it successfully using the following code.
Dim CATIA As Object
CATIA = GetObject("", "CATIA.Application")
But unfortunately client installed an old version of the Catia Software also. So when i get object it will get object of the old version.
So i decided to take the GetObject from runtime (from the proces list. ) .
but when the two versions are running at the same time . How will i identify the process .
I tried the following method.
Dim CATIA As Object
CATIA = System.Runtime.InteropServices.Marshal.GetActiveObject("CATIA.Application")
but there are two process running i need to identify the version or caption (i succesfully read the catpion of the
window) .
my Question is
1)How should i assign the process to the GetObject method in vb.net
2) If i have accessed the process.MainWindowTitle method and get the name of the window then how should i
assign to GetObject .(that specific object where the windowtitle is "something..." )
please help
MSDN Forum
All replies (3)
Friday, October 25, 2013 6:53 AM ✅Answered
Hi,
Welcome to MSDN.
I need to get and object from running process list and add it to GetObject method.
I have done it successfully using the following code.
Dim CATIA As Object
CATIA = GetObject("", "CATIA.Application")
But unfortunately client installed an old version of the Catia Software also. So when i get object it will get object of the old version.
If possible, I suggest you try this way which is used to get the specific version AutoCAD object.
It codes like this:
GetObject(, "xxx.Application.the version number")
1)How should i assign the process to the GetObject method in vb.net
2) If i have accessed the process.MainWindowTitle method and get the name of the window then how should i
assign to GetObject .(that specific object where the windowtitle is "something..." )
In my opinion, I am afraid we could not use GetObject via the process, according to this link.
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.
Saturday, October 26, 2013 8:07 AM ✅Answered
Hi
i am using Widnows Forms and VB.Net .
I need to get and object from running process list and add it to GetObject method.
I have done it successfully using the following code.
Dim CATIA As Object
CATIA = GetObject("", "CATIA.Application")
But unfortunately client installed an old version of the Catia Software also. So when i get object it will get object of the old version.
So i decided to take the GetObject from runtime (from the proces list. ) .
but when the two versions are running at the same time . How will i identify the process .
I tried the following method.
Dim CATIA As Object
CATIA = System.Runtime.InteropServices.Marshal.GetActiveObject("CATIA.Application")but there are two process running i need to identify the version or caption (i succesfully read the catpion of the
window) .
my Question is
1)How should i assign the process to the GetObject method in vb.net
2) If i have accessed the process.MainWindowTitle method and get the name of the window then how should i
assign to GetObject .(that specific object where the windowtitle is "something..." )
please help
MSDN Forum
I don't know how the GetObject method works. But this works and maybe it will help you. Or maybe not.
Option Strict On
Imports System.Runtime.InteropServices
Public Class Form1
<DllImport("User32.dll")> _
Private Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
End Function
Dim P As Process = Process.GetProcessById(4040) ' I already have Notepad running and this is its process I.D.
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.CenterToScreen()
Me.Text = FindWindow("Notepad", Nothing).ToString
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim AccessNotepad As Object = CType(P, Object)
Label1.Text = AccessNotepad.ToString & vbCrLf & P.MainWindowTitle.ToString & vbCrLf & FindWindow(Nothing, P.MainWindowTitle.ToString).ToString
End Sub
End Class
Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.
Monday, October 28, 2013 12:27 PM ✅Answered
See my answer at the below link. You should be able to use the window title to fetch the instance.
Paul ~~~~ Microsoft MVP (Visual Basic)