Can't access the COM interface - com

I am working with the scantest of application documentation (shocker), and what there is seems to be misleading/contradicting. I will ask the software company as well, but their last reply took weeks. In the meantime....(thanks).....
I am trying to access the [alledged] COM interface of a GUI application we'll call: Xyz
My Question: Would the results below imply to you that there IS no COM interface available, that it needs to be registered, etc...
USER MANUAL STATES:
Here are the only two quotes related to the app's COM Interface ability:
"Since Xyz is a 32 bit application using COM (Component Object Model) components,
running Xyz from a network......".
"You can access the Xyz.Interface COM object to query for information and present it in a format you like".
CODE EXAMPLE 1:
Dim xyz_com
Set xyz_com= CreateObject("Xyz.Interface")
xyz_com.Visible=false
RESULT 1:
"Object doesn't support this property or method: 'Visible'"
CODE EXAMPLE 2:
Dim xyz_com
Set xyz_com= CreateObject("Xyz.Interface")
RESULT 2:
The initial application screen appears which - if I AM starting the application in 'server mode' as they say - I wouldn't think I would have the screen showing.
CODE EXAMPLE 3:
Dim xyz_com
Set xyz_com= CreateObject("Xyz.Interface")
xyz_com.QueryInterface()
RESULT 3:
"Object doesn't support this property or method: 'QueryInterface'"

Would the results below imply to you
that there IS no COM interface
available, that it needs to be
registered, etc..
The CreateObject call succeeds, so the COM interface exists and is registered.
Some comments:
You can't directly call QueryInterface like that from VB
You need to cast the object to the correct interface before setting the Visible property. Try Dim xyz_com as Xyz.Interface instead of just Dim xyz_com

Related

Determine Documentum host name when using Documentum.Interop.DFC C# assembly

I'm working on some rather old C# code that uses Documentum DFC (Documentum.Interop.DFC.dll 6.5.0.18). The Documentum server settings are stored within the dfc.properties file stored on my local machine, for example:
dfc.docbroker.host[0]=xyzserver.xyzdomain.net
dfc.docbroker.port[0]=5432
I would like to be able to determine, and write to a log file, the Documentum "docbroker" host and port number whenever the Documentum COM objects are instantiated. Here's what I have so far:
DfClientX xClient = new DfClientXClass(); // <=== This xClient should have the host in there somewhere... right?
IDfLoginInfo login = xClient.getLoginInfo();
login.setUser( localUserName );
login.setPassword( localUserPassword );
xClient is an interface of type DfClientX, it is instantiated as a COM object.
Looping through all of the properties of the object suggested by this post looks promising.
I've searched on the Documentum boards with no luck so far. I realize this question will be difficult to answer without having access to the Documentum software, but it seems like it should be a rather simple task... perhaps someone with more general COM knowledge can help out?
Thanks in advance!
So after checking out the object in the Visual Studio watch window (not within the "tooltip" watch), I was able to use Intellisense to examine the properties available to the COM object and its properties. Here is how I am now able to determine the host name:
DfClientX xClient = new DfClientXClass();
IDfClient client = xClient.getLocalClient();
const string HOST_ATTRIBUTE = "dfc.docbroker.host";
var hostSetting = xClient.getLocalClient().getClientConfig().getString( HOST_ATTRIBUTE );
Logging.WriteLog( TraceEventType.Verbose, "*** {0} = {1}", HOST_ATTRIBUTE, hostSetting.ToString() );
Maybe this will help somebody else in the future.

How to consume a referenced webservice in visual studio 2012

I have added a reference of a soap webservice in my visual studio 2012. Working for the first time with is a little bit hard because it gave an error and I don't know how to resolve it. Any hints? Below is my code:
Dim obj() As MobileApp.ClaimsDetails
Dim respClaimsDetails As MobileApp.BAMobileAppSoap
Dim a As New MobileApp.MVGetClaimsDetailsAllRequest
a.strVisaID = 123
Dim b As New MobileApp.MVGetClaimsDetailsAllResponse
b = respClaimsDetails.MVGetClaimsDetailsAll(a)
obj = b.MVGetClaimsDetailsAllResult
MobileApp is the name of my webservice. The exception thrown is a null reference in respClaimsDetails.MVGetClaimsDetailsAll(a).
I know that MobileApp.BAMobileAppSoap is an interface that needs a Concrete Implementation to complete my work, but I have at least 50 interfaces, I cannot concrete them all... I am sure there is another way to call webservice and resolve this issue ... any help, any links or documentation concerning added webservices in visual studio 2012 are appreciated.
Regards.
OK finally I could solve it :
Instad of using an interface there a class for client that takes a parameter "BAMobileAppSoap" which is the enpoint name in web.config, and then I could call my methods easily:
Dim respClaimsDetails As New MobileApp.BAMobileAppSoapClient("BAMobileAppSoap")
Dim res = respClaimsDetails.MVGetClaimsDetailsAll(claimNum)

XMLHTTP40 type not defined

I'm trying to use HTTP in VB6 project
Dim httpCnct As XMLHTTP40
Set httpCnct = CreateObject("Msxml2.XMLHTTP.4.0")
but when i run the code, the compiler highlight the above line and show me an error: type not defined
Do I need to add some reference and, how to use it ?
C:\Users>reg query hkcr /f xmlhttp
HKEY_CLASSES_ROOT\Microsoft.XMLHTTP
HKEY_CLASSES_ROOT\Microsoft.XMLHTTP.1.0
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP.3.0
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP.4.0
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP.5.0
HKEY_CLASSES_ROOT\Msxml2.ServerXMLHTTP.6.0
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP.3.0
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP.4.0
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP.5.0
HKEY_CLASSES_ROOT\Msxml2.XMLHTTP.6.0
End of search: 12 match(es) found.
Also be aware there is a limit on how many times you can call any particular XMLHTTP object before a lockout occurs. If that happens, and it does when debugging code, just change to a different xmlhttp object
It is probably wiser to change
Set httpCnct = CreateObject("Msxml2.XMLHTTP.4.0")
to (if I remember my vb6 syntax)
Set httpCnct = New Msxml2.XMLHTTP.4.0
This would give you fast early binding rather than slow late binding. Changing the Dim to object will slow things down.

VB.NET-Trying to populate vss files in tree view

I am trying to replicate the tree style view in Source Safe into my application in vb.net... I have already added the COM objects and connected to Source Safe database successfully... What i need is the method to populate the tree view with Source Safe files.... The logic to populate it and other necessary info... Can anyone HELP me???
I have inserted the tree view in my form
I have added the COM object for source safe
I have connected to source safe 'srcsafe.ini' file for database connection
I know i can use recursive program to fetch all the files in source safe
The only problem is i don't know about source safe functions. I have tried the MSDN website and read about all the properties of source safe. But how i use them, need some example.
And about flags in source safe, what i need to do to those flags when i perform the source safe functions from my application .
And how can i make the user restrictions like in source safe to my application
]
Here is documentation on VSS Automation. I had another link but it appears to be broken now.
http://msdn.microsoft.com/en-us/library/bb509341(v=vs.80).aspx
To work with VSS you would first create an instance of the VSSDatabaseClass class and call its Open method:
Dim vssDatabase As String = "\\server\somepath\srcsafe.ini"
Dim ssdb As new VSSDatabaseClass()
ssdb.Open(vssDatabase, userName, password)
The two methods that you will use most often are get_VSSItem() and get_Items(). These will return a singile VSSItem (which is a file or project) or a collection of items. So to get the root project of the database, you would use code such as this:
Dim root As IVSSItem = ssdb.getVSSItem("$/", False)
The Type property of a VSSItem indicates if the item is a project or file. If it is a project, you can get its child items using get_Items:
If root.Type = 0 Then 'Type = 0 means it's a project
Dim items As IVSSItems = root.get_Items(False)
For Each item As IVSSItem In items
If item.Type = 0 Then
'item is a project
Else
'item is a file
End If
Next
End If
I hope this gets you started.

Using COM object from PowerBuilder - error 36: name not found accessing external object

I'm trying to access a third-party COM server from within Powerbuilder. I can instantiate the object but whenever I try to call a method or a property on the object I get error 36: "name not found accessing external object".
OLEObject PNSession
PNSession = CREATE OLEObject
ll_status = PNSession.ConnectToNewObject("PNSrv9.PNSession")
if ll_status = 0 then
// Set the session printer
try
PNSession.SetSessionPrinter('TIFF Image Printer 9.0', 1, g_pfapp.null_string, False)
catch (oleruntimeerror lole_error2)
messagebox('Set Error', lole_error2.description)
end try
// Turn job tracking on
PNSession.TrackingOn = True
end if
The ConnectToNewObject call succeeds and I see the COM server in my Task Manager, but subsequent calls fail. The above looks correct based on all the COM automation code samples for Word, Excel that I looked at.
The COM server is a C++ ATL COM Server, not a .NET COM object if that makes any difference.
Does anyone have an idea why this isn't working or what I am missing?
Thanks.
You probably don't have the parameter types correct. Looking at SetSessionPrinter, I would try passing 0 for PortsPreCreated. For PortBaseName try a string initialized to "" and also try 0.
Similarly, try PNSession.TrackingOn = 0.