is both a transport filter and a component that implements the interface Ichangecolor. The implementation of all Ichangecolor functions is defined and implemented in Ccolorfilter, so it is interesting to call the Ichangcolor interface in Cprop, and the related action is done in Ccolorfilter. //IChangeColor implement STDMETHODIMP Get_RGBColor(BYTE *r,BYTE *g,BYTE *b); STDMETHODIMP Put_RGBColor(BYTE r,BYTE g,BYTE b);these two methods are completed.
2. In the Cprop through the Ichangcolor ca
registers an instance of the class, which provides the implementation of the receiver interface. The hosting client registers a single event Delegate and creates a single receiver based on each event notification method. For details, refer to the interoperability section of C.
I. Programming of connection points
1. Use ATL to create a component program.
2. Add ATL simple object and support connection point events.
NOTE: If there is no current connection point event, you can manually add it in
COM (5) -- inherit from the idispatch Interface
(1) ObjectivesThis article uses a simple example to describe how to make our COM Object accessible to the scripting language.
(2) IDL filesTo use COM components in the script language environment, the COM specification specifies that the COM to be used in the script language environment must implement the idispatch interface.The itimebeijing interface is defined below. Note the differences between this file and our previous file:
Import "oaidl. IDL
parameter is preprocessed and the actual call is provided to the object. Then, the call return values returned by the component and the [In, out] and [out] parameters on the call Stack are passed to the party for post-processing.
As a COM ObjectIn our AOP framework, we implement the com class of the iaspect interface, as shown in 3.
Interface iaspect: iunknown {Hresult preprocess ([in] iunknown * punkdelegatee,[In] BSTR riid,[In] BSTR strmethodna
It seems that Microsoft Source reader is still quite difficult to use because of its needs. In fact, according to the example provided by Microsoft, You can normally debug the program.
The following example shows the source reader code. At the same time, the pointer is used in the hresult createvideodevicesource (imfmediasource ** ppsource) function to correctly export the ppsource, not null. Before debugging, use
COM object createdAnd then how to call the COM component. Here is the method for calling the COM Object in C ++.
There are generally three methods to create a COM object. You can create an object normally and use the cocreateinstance function. If you create an object in a remote system, use the cocreateinstanceex function. The cogetclassobject function is used to create multiple objects with the same clsid.
1. Use the cocreateinstance function to create a COM object.
// Load the generated file
some more details on what does with the? HRESULTs returned from COM methods. An ?HRESULT?is a 32-bit signed integer, with nonnegative values indicating Success, and negative values indicating failure. An? hresult ?has three fields:the severity bit (to indicate success or failure), the facility code, and the status Co De. The "facility" indicates what's component or program the?
function to obtain the function of this interface. You can implement this function by yourself.
Generally, we give the control a unique ID in the document for easy access. First, we need to find this element in the document and use ID as the parameter.
ExampleCode: (Refer to the mfc7.0Source code)
// Document modified at: Sunday, August 18,200 2 11:04:50, by user: jiangsheng, from computer: KFB// Access the element interface by name
Hresult cd
C = 0;C = A + B;Return C;}Public float Ladd (float a, float B){Float C = 0;C = A + B;Return C;}}}
(2) write the calling program using vc6.0
Use vc6.0 to write and create the MFC Application usecom. The project type is MFC Appwizard (exe)
Add the following in stdafx. h:
# Import "addcom. TLB"Using namespace addcom;
Program code:
Void cusecomdlg: onbuttonuse (){// Todo: add your control notification handler code hereInt dresult;Float fresult;Cstring strresult;
Coinitialize (null); //
Getdestopwindow obtains the handle of the desktop window, but it is not the window containing the icon we see. The window containing the icon is actually one of the rows topwindow.Window. To be exact, desktopWindow contains a subwindow with no title and the class name "shelldll_defview". This word window also contains a untitled and Class Name"Syslistview32" subwindow -- this is the window that actually contains the desktop icon.
To operate the desktop icon, use the following functions,Hwnd get
the program into three steps:
1. Build a DirectDraw surface ).
2. Extract video streams from files (possibly audio ).
3. Play video streams on the DirectDraw surface.
Necessary variables:
Ddsurfacedesc ddsd;Idirectdraw * PDD;Idirectdrawsurface * pprimarysurface;Imultimediastream * pmmstream;
The imultimediastream interface is the highest-level interface object in DirectShow. It can contain one or more multimedia objects.
These multimedia objects can be of different types, such as
new instance of the Internet Explorer browser. In some cases, BHO is also applicable to Windows Resource Manager.Generally, a site is an intermediate object located between the container object and the contained object. Through it, container objects are managed to accommodate the content of objects, so internal functions of objects are available. Therefore, the container must implement the IoleClientSite interface, and the IOleObject interface must be implemented for the contained objects. By c
# Include # Include # Include # Include # Include # Include # Include
//////////////////////////////////////// //////////////////////////////////
// Function name: deletetask
// Function: deletes a specified task scheduler.
// Parameter description: lpcwsztaskname: name of the task plan to be deleted
//////////////////////////////////////// //////////////////////////////////
Hresult deletetask (maid );
//////////////////////////////////////// ///////
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.