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
S

soptest

@soptest
About
Posts
81
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to get CLSID for the underlying object.
    S soptest

    In order to get CLSID of running COM instance that object must have at least IPersist to be implemented. --or-- To read CLSID from TypeLib (If you TypeLib has more then one coclass and some of those coclasses have implemented the same interface you can not say which coclass is instantiated):

    #include #include #include "comdef.h"
    #include "atlbase.h"

    void main()
    {
    CoInitialize(0);
    {
    CComPtr p;
    HRESULT hr;

    	hr = p.CoCreateInstance(L"TestObj.Test");
    	if(S\_OK == hr)
    	{
    		
    		::ITypeInfo \*pti;
    		::ITypeLib \*ptl;
    		UINT ui;
    
    		hr = p->GetTypeInfo(0, LOCALE\_SYSTEM\_DEFAULT,&pti);
    		
    		if(S\_OK == hr)
    		{
    			hr = pti->GetContainingTypeLib( &ptl, &ui);
    			pti->Release();
    			if(S\_OK == hr)
    			{
    				ui = ptl->GetTypeInfoCount();
    				
    				for(UINT i = 0; i < ui; ++i)
    				{
    					hr = ptl->GetTypeInfo(i, &pti);
    					
    					
    					if(S\_OK == hr)
    					{
    						
    						::TYPEATTR \*patr = 0;
    						hr = pti->GetTypeAttr( &patr);
    						if(patr->typekind == TKIND\_COCLASS)
    						{
    							printf("OK - TKIND\_COCLASS\\n");
    							OLECHAR \*wsz;
    							hr = ::StringFromCLSID(patr->guid, &wsz);
    							
    							if(S\_OK == hr)
    							{
    								printf("CLSID = %s\\n",(char\*) \_bstr\_t(wsz));
    								::CoTaskMemFree(wsz);
    							}
    						}
    						pti->Release();
    					}
    				}
    				ptl->Release();
    				
    			}
    		}
    	}
    }
    CoUninitialize();
    

    }

    soptest

    COM com tutorial question

  • Web Services Implementation Guide
    S soptest

    spam soptest

    COM wcf xml tutorial com design

  • Now why doesn't this COMPILE!?!?!?
    S soptest

    go ot project setting and remove _ATL_MIN_CRT macro soptest

    COM help question announcement workspace

  • How to get address of an instance
    S soptest

    If you "don't believe" try this:

    class _A
    {
    public:
    _A()
    {
    m_this = this;
    };
    _A *m_this;
    void f()
    {
    printf("instance: %p\n",m_this);
    }
    };

    void main()
    {
    _A a1,a2, *pa1,*pa2 ;

    a1.f();
    a2.f();
    pa1 = new \_A();
    pa2 = new \_A();
    pa1->f();
    pa2->f();
    delete pa1;
    delete pa2;
    

    return;
    }

    soptest

    C / C++ / MFC tutorial question

  • Anyone with experience in out-of-proc COM servers?
    S soptest

    Your CLSID_CObject and IID_ICObject are different (EXE_Project::CLSID_CObject == DLL_Project::CLSID_CObject AND EXE_Project::IID_ICObject == DLL_Project::IID_ICObject). Read my previous post. soptest

    COM c++ com sysadmin help question

  • why do have to restart to get excel/ word application. every time
    S soptest

    What is the error (HRESULT value)? soptest

    COM c++ com question testing tools

  • Anyone with experience in out-of-proc COM servers?
    S soptest

    Are you sure CLSID_CObject and IID_ICObject are the same in .DLL and .EXE COM implementation? Check .IDL files they have to be the same for both types of projects (.EXE and .DLL) or just use one .IDL file for both projects. soptest

    COM c++ com sysadmin help question

  • HELP ME TO FIND AN ERROR
    S soptest

    You got E_ACCESSDENIED COM exception, because of IE security design.

    try{
    	spFrameDoc = spFrame->document;
    } catch(\_com\_error e)
    {
        TRACE("Äîêóìåíò íåäîñòóïåí!\\n");
    }
    

    Cross-Frame Scripting and Security


    With Dynamic HTML (DHTML), content in different windows and frames can interact in powerful ways by scripting with the object model. However, since a browser can simultaneously display unrelated documents in its various windows and frames, certain rules must be enforced to protect data integrity and privacy of information.

    This article describes how and why these restrictions apply in the DHTML Object Model. All rules about script interaction apply equally to windows, dialog boxes, FRAMESETs, FRAMEs, and IFRAMEs.

    For most content, only interactions with content from the same domain are allowed. For example, a typical page on www.microsoft.com can freely script content on any other page on www.microsoft.com, but cannot script to pages that are located on a different Web domain. The DHTML Object Model uses the document.domain property to enforce this restriction: only pages with identical domain properties are allowed free interaction. The protocol of the URL must also match. For instance, an HTTP page cannot access HTTPS content.

    The range of permissible access for a page can be expanded when a script assigns the document.domain property to a suffix of the site name space, up to the second-level domain. For example, a page on www.microsoft.com can assign the document.domain property—initially www.microsoft.com—as microsoft.com to broaden access to include pages in home.microsoft.com or any other site, as long as the other pages also set the document.domain property to the identical value. Since only pages from a site whose name ends with microsoft.com will permit this domain to be set, it is assured that content from the same provider mutually agrees to interact and is free to do so. Domain suffixes shorter than the second-level domain (such as just "com") are not allowed, because they expose beyond a single provider. For international site names, such as www.microsoft.co.jp, the second-lev

    COM help com debugging

  • HELP ME TO FIND AN ERROR
    S soptest

    I run it, and nothing happens, just beeps. Can you give me more details what to do? P.S. in void CIEEnumWindowsDlg::OnVs() after you initialize smart pointer MSHTML::IHTMLDocument2Ptr spHtmlDocument(spDisp); add this line to check if wrapped pointer is vaid: if(spHtmlDocument == NULL) return; Samething is here

    MSHTML::IHTMLWindow2Ptr spFrame;
    //...
    spFrame = varFrame;//assignment , spFrame may be NULL if
    //varFrame.pdispVal interface can not be queryed for MSHTML::IHTMLWindow2 interface.

    . Make sure after you initialize typed smart pointers by assigning an interface pointer or in constructor check it fo NULL. soptest

    COM help com debugging

  • Inheritence & Virtual functions with COM/ATL
    S soptest

    Component Categories

    As this chapter has emphasized, the basic COM activation primitives require the caller to know the precise class name in order to create new instances. However, it is sometimes useful simply to request that any class that adheres to some semantic constraint is suitable. In addition, it could be useful to know what services a class requires from its clients prior to issuing an activation request to avoid creating objects that the client is not prepared to support properly. These problems motivate the concept of component categories.

    COM allows implementors to group related COM classes into logical groups or component categories. Often, all classes within a category will implement the same set of interfaces. However, simply partitioning the class space based on which interfaces each class implements does not provide the proper granularity for many applications. Component categories act as metainformation that indicates which classes are compatible with particular semantic constraints.

    A component category is a group of logically related COM classes that share a common category ID or CATID. CATIDs are GUIDs that are stored in the Registry as attributes of a class. Each class can have two subkeys: Implemented Categories and Required Categories. Assume that there are two categories of components: Simians and Mammals. These two categories would each have a unique CATID (CATID_Simians and CATID_Mammals, respectively). Assuming that the class Chimp is a member of each of these categories, the Chimp’s Implemented Categories registry key would contain each GUID as an individual subkey:

    [HKCR\CLSID\{CLSID_Chimp}\Implemented Categories\{CATID_Mammals}]

    [HKCR\CLSID\{CLSID_Chimp}\Implemented Categories\{CATID_Simians}]
    

    These registry entries are typically added at self-registration time. Each known component category on a system has an entry under

    HKEY_CLASSES_ROOT\Component Categories

    Each category has its own unique subkey named by its CATID. Underneath its subkey, each category has one or more named values that contain the human-readable description of the category. For example, the two categories shown would require the following registry entries:

    [HKCR\Component Categories\{CATID_Mammals}]
    409="Bears live young"
    
    [HKCR\Component Categories\{CATID_Simians}]
    409="Eats Bananas"
    

    Not

    COM question c++ com regex

  • Can somebody please answer this?
    S soptest

    Use "oleview" to open type library. From "File" menu you can "Save as" *.IDL, *.H or *.C file. If you save it as *.IDL file then compile it with MIDL compiler to generate proxy/stub files. soptest

    COM com question windows-admin help tutorial

  • Kill a non-responsive COM Object
    S soptest

    will not work in MTA. soptest

    COM mobile com sysadmin performance help

  • Overwriting COM
    S soptest

    Implement interface you want to overwright. 1. You can use ATL to implement Interface. 2. Or see this example:

    #include "stdafx.h"
    #include "windows.h"
    #import "testObj.dll"
    /*
    // testObj.idl : IDL source for testObj.dll

    import "oaidl.idl";
    import "ocidl.idl";
    [
    object,
    uuid(C795331D-0C56-11D6-A0FD-00B0D0C3D9BD),
    dual,
    helpstring("Itest Interface"),
    pointer_default(unique)
    ]
    interface Itest : IDispatch
    {
    [id(1), helpstring("method f")] HRESULT f();
    [id(2), helpstring("method In")] HRESULT In([in] BSTR wsIn);
    };

    [
    uuid(C7953311-0C56-11D6-A0FD-00B0D0C3D9BD),
    version(1.0),
    helpstring("testObj 1.0 Type Library")
    ]
    library TESTOBJLib
    {
    importlib("stdole32.tlb");
    importlib("stdole2.tlb");

    \[
    	uuid(C795331E-0C56-11D6-A0FD-00B0D0C3D9BD),
    	helpstring("test Class")
    \]
    coclass test
    {
    	\[default\] interface Itest;
    	interface Itest2;
    };
    

    };

    */

    #include "comdef.h"
    class MyNew: public ::TESTOBJLib::ItestPtr
    {
    public:
    MyNew()
    {
    ::CoInitialize(0);
    ::TESTOBJLib::ItestPtr p;
    (*((::TESTOBJLib::ItestPtr*)this)).CreateInstance(L"TestObj.test");

    }
    ~MyNew()
    {
    	this->Release();
    	::CoUninitialize();
    }
    
    HRESULT In( \_bstr\_t wsIn )
    {//call default function
    	(\*((::TESTOBJLib::ItestPtr\*)this))->In(wsIn);
    	return S\_OK;
    };
    
    HRESULT f()
    {//overwritten function
    	::OutputDebugString("this my function.");
    	return S\_OK;
    }
    

    };

    int main(int argc, char* argv[])
    {
    MyNew p;

    p.f();
    p.In("test");
    
    return 0;
    

    }

    soptest

    COM question com

  • Ref to ActiveX control using C
    S soptest

    Yes, you have to use MIDL compiler to generate those files, because #import directive is C++ specific. soptest

    COM com tutorial question design

  • Ref to ActiveX control using C
    S soptest

    Example how to work with COM in "C":

    /* main.c */
    //other headers here ...
    //...
    #inluce "windows.h"
    #include "objx\\objx.h"
    //"objX" is a test object

    int main(int argc, char* argv[])
    {
    IObj *pObj;
    HRESULT hr;
    BSTR wsIn;

    CoInitialize(0);
    
    hr = CoCreateInstance( &CLSID\_Obj, 0, CLSCTX\_SERVER, &IID\_IObj, (void\*\*) &pObj);
    
    if(S\_OK == hr)
    {
    	
    	wsIn = SysAllocString(L"Test string.");
    	//all calls made using vtbl 
    	hr = pObj->lpVtbl->Test(pObj,wsIn);
    	//see objX.h file for declaration of IObj interface	
    	pObj->lpVtbl->Release(pObj);
    
    	SysFreeString(wsIn);
    }
    
    
    CoUninitialize();
    

    }

    must link with "ObjX_i.c" . This is my test object header file:

    #pragma warning( disable: 4049 ) /* more than 64k source lines */

    /* this ALWAYS GENERATED file contains the definitions for the interfaces */

    /* File created by MIDL compiler version 5.03.0280 */
    /* at Mon Jun 24 10:55:15 2002
    */
    /* Compiler settings for C:\TEMP\tt\objX\objX.idl:
    Oicf (OptLev=i2), W1, Zp8, env=Win32 (32b run), ms_ext, c_ext
    error checks: allocation ref bounds_check enum stub_data
    VC __declspec() decoration level:
    __declspec(uuid()), __declspec(selectany), __declspec(novtable)
    DECLSPEC_UUID(), MIDL_INTERFACE()
    */
    //@@MIDL_FILE_HEADING( )

    /* verify that the version is high enough to compile this file*/
    #ifndef __REQUIRED_RPCNDR_H_VERSION__
    #define __REQUIRED_RPCNDR_H_VERSION__ 440
    #endif

    #include "rpc.h"
    #include "rpcndr.h"

    #ifndef __RPCNDR_H_VERSION__
    #error this stub requires an updated version of
    #endif // __RPCNDR_H_VERSION__

    #ifndef COM_NO_WINDOWS_H
    #include "windows.h"
    #include "ole2.h"
    #endif /*COM_NO_WINDOWS_H*/

    #ifndef __objX_h__
    #define __objX_h__

    /* Forward Declarations */

    #ifndef __IObj_FWD_DEFINED__
    #define __IObj_FWD_DEFINED__
    typedef interface IObj IObj;
    #endif /* __IObj_FWD_DEFINED__ */

    #ifndef __Obj_FWD_DEFINED__
    #define __Obj_FWD_DEFINED__

    #ifdef __cplusplus
    typedef class Obj Obj;
    #else
    typedef struct Obj Obj;
    #endif /* __cplusplus */

    #endif /* __Obj_FWD_DEFINED__ */

    /* header files for imported files */
    #include "oaidl.h"
    #include "ocidl.h"

    #ifdef __cplusplus
    extern "C"{
    #endif

    void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
    void __RPC_USER MIDL_user_free( void __RPC_FAR * );

    #ifndef __IObj_INTERFACE_DEFINED__
    #define __IObj_INTERFACE_DEFINED__

    /* interface IObj */
    /* [unique][helpstring][dual][uuid][obje

    COM com tutorial question design

  • Excel events inside a DLL
    S soptest

    must do:

    while(GetMessage())
    DispatchMessage();

    soptest

    COM c++ com question csharp visual-studio

  • lock-up catching excel events
    S soptest

    Try :

    while(GetMessage())
    DispatchMessage();

    in your thread. soptest

    COM testing tools help question announcement

  • C/C++ forum
    S soptest

    Say it to M$. BUG in IE. soptest

    The Lounge c++ question

  • How to pass out an array from a com+ object?
    S soptest

    You must produce a proxy-stub DLL by compiling and linking the C files produced by MIDL. The ATL AppWizard produces a make file called projectps.mk to do this. You must make sure that your server does not register its component's interfaces as type library marshaled with the automation marshaler because automation does not recognize the array attributes. (marshaling done by custom marshaler in your proxy/stub DLL) soptest

    COM c++ com sysadmin data-structures help

  • COM+ object loses state, why?
    S soptest

    You call "obj.EOF". Is "EOF" defined in your object. soptest

    COM help com sysadmin debugging business
  • Login

  • Don't have an account? Register

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