开发者

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 wor开发者_如何学JAVAking 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜