|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
CreateObject( )... :(I have developed a module in VB6 and now I want to redevelop it into ..NET . VB6 Dim cat as Object Set cat =GetObject("","ABC.Application") Dot NET Dim cat as Object Set cat =GetObject("","ABC.Application") I don't have deep knowledge of Dot NET so I use this code and its working. It runs smoothly when the application is running. But in VB6 if the application is not working then it shows an error "ActiveX component can not create object". But in Dot NET I don't get this error message?. But I need the error message so that I can find out whether the application is working or not? Or how can I know that ABC application is running or not. Thanks in Advance. u can use "System.Diagnostics" namespace to get all the processes
running on your machine and thus u can find out whether your app is running or not. by the way what u got in your object when you call the GetObject() function and the abc application is not running?
Show quote
Hide quote
"Pauras Desani" <Pauras.Des***@gmail.com> schrieb: Untested:> VB6 > Dim cat as Object > Set cat =GetObject("","ABC.Application") > Dot NET > Dim cat as Object > Set cat =GetObject("","ABC.Application") > I don't have deep knowledge of Dot NET so I use this code and its > working. > > It runs smoothly when the application is running. But in VB6 if the > application is not working then it shows an error "ActiveX component > can not create object". But in Dot NET I don't get this error > message?. But I need the error message so that I can find out whether > the application is working or not? \\\ Dim cat As Object = GetObject(...) If cat Is Nothing Then MsgBox("Application not working!") Else ... End If /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> when i did some testing with our VB6 activex app ( a verry long time ago
:-) ) i was told to do it like this'Import Reflection Namspace which supports COM interoperability Imports System.Reflection private HBSObject as object in the method to start the component Dim HBSCOM As Type 'Get the object HBSCOM = Type.GetTypeFromProgID("Hbase.clsHbase") 'Create instance of HBSCOM Addtekst("Creating instance ") HBSObject = Activator.CreateInstance(HBSCOM) If Not (HBSObject Is Nothing) Then do your stuff here End If in the close / cleanup method System.Runtime.InteropServices.Marshal.ReleaseComObject(HBSObject) HBSObject = Nothing regards Michel Posseth [MCP] Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:eBiowjrEGHA.3100@tk2msftngp13.phx.gbl... > "Pauras Desani" <Pauras.Des***@gmail.com> schrieb: >> VB6 >> Dim cat as Object >> Set cat =GetObject("","ABC.Application") >> Dot NET >> Dim cat as Object >> Set cat =GetObject("","ABC.Application") >> I don't have deep knowledge of Dot NET so I use this code and its >> working. >> >> It runs smoothly when the application is running. But in VB6 if the >> application is not working then it shows an error "ActiveX component >> can not create object". But in Dot NET I don't get this error >> message?. But I need the error message so that I can find out whether >> the application is working or not? > > Untested: > > \\\ > Dim cat As Object = GetObject(...) > If cat Is Nothing Then > MsgBox("Application not working!") > Else > ... > End If > /// > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> |
|||||||||||||||||||||||