Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
V

Vi2

@Vi2
About
Posts
190
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Multiple Inheritance question
    V Vi2

    don't know why cout << pd1, and cout << pd2 are different, they are assigned the same value &s.

    It is surprise of Multiple Inheritance. CSon consist of 2 blocks: CDerive2 block and CDerive1 block, each of them has own address. [CDerive2][CDerive1] or [ C S o n ] Therefore address of CSon instance is equal to address of CDerive2 part of CSon, but is not equal to address of CDerive1 part of CSon.

    With best wishes, Vita

    ATL / WTL / STL oop question

  • Struct with Vector<BYTE> size different in VS2013
    V Vi2

    It's very bad idea to use the complex types from one DLL to another. Firstly your DLLs can use different "packing size". Secondly these STL types can use own allocators which can be different. Thirdly these STL types can be incompatible due to different realizations of STL.

    With best wishes, Vita

    ATL / WTL / STL visual-studio com graphics algorithms help

  • How to create and register two dlls with same name?(VS 2010)
    V Vi2

    [Dynamic-Link Library Redirection] "To use DLL redirection, create a redirection file for your application. The redirection file must be named as follows: App_name.local. For example, if the application name is Editor.exe, the redirection file should be named Editor.exe.local. You must install the .local file in the application directory. You must also install the DLLs in the application directory."

    With best wishes, Vita

    ATL / WTL / STL visual-studio help tutorial question

  • COM Component Late binding trouble
    V Vi2

    nilarya wrote:

    I have also tried to use this property to get the IPicture value like:

    IPicture picture = (IPicture)ComObjType.InvokeMember("Preview", BindingFlags.Default | BindingFlags.GetProperty, null, ComObjLateBound, previewDetails);

    But it also falis with a message that Exception has been thrown by the target of an invocation.

    It's right way, but you should use the reversed order of arguments. previewDetails[6] = viewMinX; and so on.

    With best wishes, Vita

    COM csharp asp-net wpf wcf com

  • Exception during assignment operation to a COM object - "Attempted to read or write protected memory"
    V Vi2

    asr1122 wrote:

    void CApplication::CreateCallInfo(IDispatch** piResult) { CCmdTarget* pTarget = new CCallInfo(); *piResult = pTarget->GetIDispatch(TRUE); }

    Return of IDispatch pointer is not equal to return of _ICallInfo pointer. IDispatch pointer does not have the CallId property (more clearly, the CallId get-property and CallId put-property), presented in _ICallInfo dual interface. You can heal this by: 1) replacing of "interface _ICallInfo: IDispatch" onto "dispinterface _ICallInfo" in IDL file; 2) replacing of "*piResult = pTarget->GetIDispatch(TRUE);" onto "*piResult = GetInterface(&__uuidof(_ICallInfo))" or "InternalQueryInterface(&__uuidof(_ICallInfo), piResult);" with acceptable casts.

    With best wishes, Vita

    COM com sysadmin performance help tutorial

  • CoCreateInstance HResult is failing, getting error -2147221164 stating that Class is not registered.
    V Vi2

    pallaka wrote:

    hRet = CoCreateInstance (Clsid, NULL,CLSCTX_LOCAL_SERVER,iid,(void**)&ppv);

    As a rule, OCX is an in-proc server.

    With best wishes, Vita

    COM help c++ json

  • COM local server
    V Vi2

    Johan.Wade wrote:

    Now to my problem. If one of the components crash I have a problem to shut down the other server. The still running server will have a lock count from the allready dead server. I would be very happy if someone could give me a sugestion how to solve this.

    There is an IExternalConnection interface which can help in your troubles.

    With best wishes, Vita

    COM c++ com sysadmin help tutorial

  • Getting the running instance from PID using COM
    V Vi2

    KTTransfer wrote:

    IS there any way to get it, please give me clue.

    EXCEL registers each of his documents in ROT. Maybe, it's your case: you can enumerate all of EXCEL documents in ROT. PID is wrong way.

    With best wishes, Vita

    COM csharp question c++ com testing

  • Getting the running instance from PID using COM
    V Vi2

    KTTransfer wrote:

    In C#.net we have BindToMoniker to get the object. Is there any such thing in C++(unmanaged).

    AFAIK, BindToMoniker is an equivalent of C++ CoGetObject function.

    With best wishes, Vita

    COM csharp question c++ com testing

  • how to use an interface belong to another library in idl file
    V Vi2

    You should use "importlib" in "library" section instead of "import" or in addition to "import".

    With best wishes, Vita

    COM help com tutorial question

  • Using a COM Server in an Visual Studio .vcproj
    V Vi2

    Juergen_80 wrote:

    Now I need an connection from my .vcproj project to that COM server. Is there anywhere an step by step tutorial with that I can do such something?

    I think that "#import directive" is only what you need if you are simply a client of this COM exe server. Also don't forget about CoInitialize/CoInitializeEx functions before using COM objects and CoUninitialize after.

    With best wishes, Vita

    COM tutorial c++ question csharp visual-studio

  • InvokeHelper
    V Vi2

    VB creates the DLL, which has a TLB inside. Run the "OLE/COM Viewer" and File -> View TypeLib.... Perhaps there is a MFC Wizard which also can import this TLB into code. But I don't know about it, because I use #import directive in C++ client code.

    With best wishes, Vita

    COM help c++

  • InvokeHelper
    V Vi2

    I can only propose that 0x60030002 is not Get_List function. You can look at DLL by "Ole/COM Viewer" and find the declaration of _clsExcel interface. Can you post the direct reference to your DLL?

    With best wishes, Vita

    COM help c++

  • InvokeHelper
    V Vi2

    Sorry, it requires so much time which I don't have. Try to call the simpler function, for example,

    Public Function Get_List(SheetNumber As Long) As String
    Get_List = "aaa"
    End Function

    With best wishes, Vita

    COM help c++

  • InvokeHelper
    V Vi2

    What declaration of method 0x60030002 do you have? What is a "Test objXl"?

    With best wishes, Vita

    COM help c++

  • InvokeHelper
    V Vi2

    No, this is uninitialized variable. But it doesn't help as I see the code of MFC. So, I think that VTS_PI1 is unapplicable here. Use VTS_PUI1 or VTS_PI4.

    With best wishes, Vita

    COM help c++

  • InvokeHelper
    V Vi2

    "result" variable is uninitialized.

    With best wishes, Vita

    COM help c++

  • IPictureDisp to byte array
    V Vi2

    As a rule, the object implemented IPictureDisp implements also IPersist**** interface (IPersistStream, seems) which can help you.

    With best wishes, Vita

    COM data-structures tutorial

  • Question about VARIANT deallocation
    V Vi2

    About memory leaks. VB allocation\dellocation mechanisms are the same with COM.

    p->vt = VT_BSTR | VT_BYREF;
    BSTR *pBSTR = new BSTR;
    *pBSTR = SysAllocString( L"abc" );
    p->pbstrVal = pBSTR;

    There are 2 memory allocations in statements "= new BSTR" and "= SysAllocString". The VARIANT with VT_BYREF|VT_BSTR isn't an owner of its values, so freeing of the VARIANT doesn't free neither pbstrVal nor *pbstrVal. And finally you have memory leaks. The VARIANT with VT_BSTR (without VT_BYREF) is an owner of its values, so freeing of the VARIANT frees bstrVal.

    p->vt = VT_BSTR;
    p->bstrVal = SysAllocString( L"abc" );

    And there are no memory leaks.

    With best wishes, Vita

    COM help question c++ html com

  • Question about VARIANT deallocation
    V Vi2

    STDMETHODIMP CDCSClient::CallService(/*[in,out]*/ VARIANT *p)
    {
    if (V_VT(p) == (VT_VARIANT | VT_BYREF))
    {
    // only here you can change the type of passed variable (see VB example below)
    VARIANT *p2 = V_VARIANTREF(p);
    p2->vt = VT_BSTR;
    p2->bstrVal = SysAllocString( L"abc" );
    return S_OK;
    }
    }

    Dim v As Variant
    v = 1
    Debug.Print TypeName(v) & " " & v
    Call obj.CallService(v)
    Debug.Print TypeName(v) & " " & v

    With best wishes, Vita

    COM help question c++ html com
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups