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

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.

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.

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.

Errors running Google API calendar example for vb.net

When I try to run this example in VBExpress 2010, I get the following intellisense errors.
scopes.Add(CalendarService.Scopes.Calendar.GetStringValue())
This line generates:
Error 7 Overload resolution failed because no accessible
'GetStringValue' is most specific for these arguments:
Extension method 'Public Function GetStringValue() As String' defined in 'Google.Apis.Util.Utilities': Not most specific.
Extension method 'Public Function GetStringValue() As String' defined in 'Google.Apis.Util.Utilities': Not most specific.
Additionally, these two lines each generate a "not defined" error.
Dim credentials As FullClientCredentials = promptingClientCredentials.EnsureFullClientCredentials()
Dim initializer As New BaseClientService.Initializer()
Error 9 Type 'BaseClientService.Initializer' is not defined.
Error 8 Type 'FullClientCredentials' is not defined.
Finally, this line:
Dim state As IAuthorizationState = AuthorizationMgr.GetCachedRefreshToken(STORAGE, KEY)
generates the error:
Error 15 'AuthorizationMgr' is not declared. It may be inaccessible
due to its protection level.
As to the first error, both google.apis.silverlight.google.apis.util.utilities and google.apis.google.apis.util.utilities has a GetStringValue(system.enum) as String method.
Any ideas about any of these errors?
UPDATE: Excluding Silverlight dll seems to resolve first error ("Not most specific")
We just published a new sample using VB.NET and OAuth2.
It works in VS Professional 2012. Take a look - http://samples.google-api-dotnet-client.googlecode.com/hg/Calendar.VB.ConsoleApp/README.html

Can't access the COM interface

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

"The directory name is invalid" error on Process.Start?

I am writing a launcher program, and when I go to start the process I get the "The directory name is invalid" error. Here is the code that is launching the process:
Const DEBUG_ROOT = _
"Z:\Kiosk_JC\KioskSignIn.root\KioskSignIn\KioskSignIn\KioskSignIn\bin\Debug"
Dim oKiosk As New System.Diagnostics.Process
oKiosk.StartInfo.UserName = oEnc.Decrypt(Username)
oKiosk.StartInfo.Password = oEnc.DecryptSecure(Password)
oKiosk.StartInfo.Domain = oEnc.Decrypt(Domain)
''// The AddBS function appends a '\' to the passed string if it is not present
oKiosk.StartInfo.WorkingDirectory = AddBS(DEBUG_ROOT)
oKiosk.StartInfo.FileName = "KioskSignIn.exe"
oKiosk.StartInfo.UseShellExecute = False
Dim proc As Process = Nothing
proc = System.Diagnostics.Process.Start(oKiosk.StartInfo)
I saw on another question here that I needed to set the WorkingDirectory (before I started searching I was getting the error). Even though I have this property set, I am still getting the error. Any thoughts?
More info
I should also note that my Z:\ is a on my network. I have a function that resolves a path to UNC. When I ran this function on DEBUG_ROOT, I get the same error.
I tried moving the application to c:\kiosk. Same result. I am logged in as the user I am impersonating, so I have access to all shares and files.
Here is the link, for some reason the URL formating wants to consume all the text after the link is designated:
Referred Post
Mapped drives are per-user. You are likely starting the process with a different user.
Sounds like the process can't see the Z: drive or doesn't have security access. What user context does the app run under? Perhaps the Z: drive is not available in that context.
I got the same error as you do. most likely the user you use to run the process does not have access to specified resource (exe file)
try to move your exe to some other location and/or give your user access rights to the file.