English 中文(简体)
视像福克斯福思通信服务器将物体退回甚氯苯并
原标题:Error returning objects to VBA from Visual Foxpro COM server

I am getting the following message when trying to return a new object to VBA from my Visual Foxpro COM server. "Run-time error -2147417851 (80010105) :

A. 标语

如果我删除“Dim ......作为”线,那么错误就会消失,但我就失去了对COM物体的干涉。

它是万国邮局法典:

Sub Test()

   Removing the following line gets rid of the error but loses intellisense for the COM object
Dim objTest As testcom.TestClass

Set objTest = CreateObject("TestCOM.TestClass")
Set objNew = objTest.ReturnObject      This is the line that causes the error

End Sub

我与测试委员会的工具和参考资料的类型图书馆建立了联系。

Here is the Visual Foxpro (VFP) code: The COM server is being built as an out of process EXE. If I build it as an inprocess .DLL then the VBA code causes Excel to crash.

DEFINE CLASS ObjectToReturn AS SESSION OLEPUBLIC

ENDDEFINE

DEFINE CLASS TestClass AS SESSION OLEPUBLIC

FUNCTION ReturnObject

    RETURN CREATEOBJECT("ObjectToReturn")

ENDFUNC

ENDDEFINE

我试图将RETURN CREATEOBJECT(“Object ToReturn”)改为ReTURN CREATEOBJECT(“CUSTOM”),但问题依然存在。

请就如何避免这一错误而不失去在武革委标的旁听器提出建议。 增 编

最佳回答

我不知道你为什么会经历这种困难。 这应能帮助你...... 你们可以把我们的类别定义为OlegPublic,并将某些特性如顶样。 你们可以通过不是丹麦荷兰语的其他功能,在任何地方确定这些财产。

如果你要试图掌握其他一些“目标”的某些内容,则试图制造一个物体的事例,将其保留在OlePublic类的财产中。

DoSomethingElse

这是一种简单的非农产品市场准入要求“SomeObject”这一类财产。 尽管你没有明确地返回,但从你从VB.创立起就应该看到这一点。

DEFINE CLASS VFPClassForVB as Session  OLEPublic
  cTmpFiles  = ""
  cCOMUser  = ""
  SomeObject  = ""

  FUNCTION Init()
    */ Who is user...  always ignore the machine....
    This.cCOMUser  = SUBSTR( SYS(0), AT( "#", SYS(0)) +1 )
    This.cTmpFiles  = "somepath"

    */ Unattended mode... any "MODAL" type dialog will throw error / exception
    SYS(2335, 0 )

    */ ALWAYS HAVE EXCLUSIVE OFF FOR COM!!!
    SET EXCLUSIVE OFF

    */ ALWAYS HIDE DELETED RECORDS!!!
    SET DELETED ON
  ENDFUNC 

  */ Error handler at the CLASS level will always be invoked
  */ instead of explicit ON ERROR or TRY/CATCH handlers...
  FUNCTION xError(nError, cMethod, nLine)
    lcMsg  = "User: " + SYS(0) + "  Tmp:" + SYS(2023);
        + "  Method: " + cMethod + "  Error: " + STR( nError,5);
        + "  Line: " + STR( nLine, 6 )
    STRTOFILE( lcMsg, This.cTmpFiles + "COMLog.txt" )

    */ NOW, throw the COM Error...
    COMReturnError( cMethod +    Error:  + str(nError,5);
        +    Line:  + str(nline,6);
        +    Msg:  + message(), _VFP.ServerName )
  RETURN 


  HIDDEN FUNCTION SomeOtherFunction( lcWhat String,;
                     lnThing as Integer ) as String

    */ Do something
    RETURN 1
  ENDFUNC 

  */ Another completely visible function direct form VB
  FUNCTION DoSomethingElse( SomeParameter as String ) as String
    USE SomeTable
    */ Now, this object should be visible as a direct property in VB
    SCATTER MEMO NAME This.SomeObject
  ENDFUNC 

ENDDEFINE 

页: 1

Sub Test()
Set objTest = CreateObject("MySampleProject.VFPClassForVB")
objTest.DoSomethingElse( "I dont care" )
dim Something as objTest.SomeObject.ColumnFromTable  
End Sub

你可以在你想要揭露和在必要时制造这些事例的密码级图书馆中开设尽可能多的OlegPublic课程。 让我知道,这是否有助于你更接近,我们却试图让它停止工作。

我曾尝试过各种样本,但审视了你在VFP OleObject条目下拥有的物体,每个条目都暴露,可以单独制作。 你们不需要创造另一种东西。

难道有某种原因,你试图从另一个物体中制造一个物体? 你们可以有一个物体,暴露出一刀切的方法和财产,以履行世贸联合会所需要的一切。

如果你想要接触多个目标类别,并且处于中央控制之下,那么你就能够永远为通信创造主要目标,并且拥有信息技术为每一“其他”类别树立了榜样。 然后,暴露在你的主要班子上处理他们之间的通信的方法,以便消除你所需要的一切。

问题回答

暂无回答




相关问题
How can i add a button to all windows explorer instances?

I am trying to add a button to one of the existing tool bars in any windows explorer instance. After much research i figured out that BHO (browser helper objects) are the best way to hook to ...

Hunting memory leaks

I m finding leaked heap blocks by using the following command in WinDbg !heap –l With each leaked heap block I get, I m running to following to get the stack trace. !heap -p -a leakedheapblock The ...

Why use CComBSTR instead of just passing a WCHAR*?

I m new to COM. What exactly is the advantage of replacing: L"String" with CComBSTR(L"String") I can see a changelist in the COM part of my .NET application where all strings are replaced in this ...

IThumbnailProvider and IInitializeWithItem

I am trying to develop an IThumbnailProvider for use in Windows 7. Since this particular thumbnail would also be dependant on some other files in the same directory, I need to use something other than ...

Getting a byte array from out of process C++ COM to C#

What s the best way to get a chunk of memory (i.e. void*) from a COM server to C#? We have been using an IStream (using CreateStreamOnHGlobal) and passing that back, which worked. However when we ...

COM Basic links

folks can you provide me the tutorial link or .pdf for learning basic COM?. i do google it.. still i recommend answers of stackoverflow so please pass me.. Thanks

热门标签