query, so what is this interface? This is the famous IUnknown interface, and the IUnknown interface is defined in the Windows SDK Unknwn.h, which is defined as follows:
Copy Code code as follows:
Interface IUnknown
{
Public
Virtual HRESULT stdmethodcalltype QueryInterface (REFIID riid, _com_outptr_ void **ppvobject) = 0;
Virtual ULONG stdmethodcalltype AddRef (void) = 0;
Virtual ULONG Stdmethodcalltype release (void) = 0;
operation rather than a COM operation, in the lookup SQL This is especially true when the server online brochure (BOL) is in use. Let's talk about how to use SQL Server's COM automated operation stored procedures and how COM automated operations can help us solve real-world programming problems.
Details of COM operations
Table 1 lists the 7 extended stored procedures for COM operations in SQL Server. When automating a COM object, you need to first establish an instance of a COM object by callin
Three, purely manually create a COM component
1, from the construction project to the implementation of registration
In this process we will complete three steps: Create DLL entry function, define interface file, implement registration function
1.1 Create a type Win32 DLL project
Create a Win32 DLL project called Mathcom.
In the second step of the wizard, select the "A smiple DLL project" option. Of course, if you choose an empty project, then you complete the DllMain definition yourself.
These are in the MFC framework for the study of insurance projects, only studied for two weeks, but still learned a lot of knowledge. Here is a look at the various operations of the database using ADO. 1, the database connection and open the project is SQL Server database, ADO connection data encountered the most important problem is to find the connection string, through a variety of personal experience, found on the internet a bug-free method, is by creating a new Ado.udl file and then open
detail.
1. Initialization1) Create an idirectsound8 interface object
You can use the directsoundcreate8 () method to create a device object. This object usually represents the default playing device. The directsoundcreate8 () function is defined as follows.
HRESULT DirectSoundCreate8( LPCGUID lpcGuidDevice, LPDIRECTSOUND8 * ppDS8, LPUNKNOWN pUnkOuter)
The parameters are described as follows:
Lpcguiddevice: guid of the device object to be created.
the index of the pointer of the function in vtbl so that it can call them? When a macro language calls a function in the COM component, three types of information can be used: the proid, function name, and parameters passed to the function. The macro runtime system must provide a simple method to execute functions with the old name of the function. This method is the idispatch interface.
1.2idispatch Interface
In short, idispatch will receive a function name and execute it. IDL description of
Compile a transform filter to flip the image.
In msdn, the "Writing transform filters" section lists the six basic steps for writing a transform filter. Follow these six steps one by one.
1. Select base class
Derived from cbasefilter, three classes are used to compile the transform filter: ctransformfilter, ctransinplacefilter, and cvideotransformfilter. For the differences between the three base classes, see the description of msdn. We select the ctransformfilter class.
After selecting the bas
, the constructor simply calls AddRef of the pointer. However, if the type is different, it first calls the QueryInterface of the pointer to obtain the same type of interface pointer. When the QueryInterface fails, the internal pointer is set to NULL.
All the following code can be used to check whether the conversion is successful:
Void func (iunknown * punk)
(2) Assignment
When assigning values, the following three events occur:
111. If the current pointer is not null, release the current po
the source ); The DoDragDrop parameter contains information about the drag and drop source object and the drag data. In the DoDragDrop function, the information about the drag target object is obtained through the cursor position. Next, the author provides a method to drag and drop files without using the mouse, but by simulating code.To use the code to simulate the drag and drop operation, you need to extract the GUI operation part of the DoDragDrop function to find the function that actually
then userdata then ESP + 04 then parameter 0 then ESP + 08 then parameter 0 then ESP + 0C callback parameter 0 callback ESP + 08 when parameter 1 when ESP + 0C when parameter 1 when ESP + 10 when parameter 1 when ...... Too many ...... Too many ...... Random (). normal function (B ). member functions (c ). stack in function call with userdata parameter: there are two major causes for this problem. EBP + 04 bytes returned address ┃ EBP + 00 bytes old EBP ┃ EBP + 04 bytes returned address ┃ EBP +
(string wordpath) to the existing document {// start the word application wordapp = new application () {vis Visible = true}; document worddoc = NULL; try {// if the document does not exist, a failure to call the COM object will occur. // open the Word document worddoc = wordapp. documents. open (wordpath); // Insert the text range wordrange = worddoc to the word. range (0, 0); wordrange. TEXT = "this is the inserted text"; // Save the worddoc. save ();} catch (exception ex) {// obtain the
the custom voice recognition message and type.
# Define gid_1__gr 333333
# Define wm_recoevent wm_user+ 102
The rest is to supplement the function body to the functions initsr () and recoevent () of the CPP file.
3) For details, see the following:
Code :
(1) void cspeech: initsr ()
{
Hresult hR = s_ OK;
HR = m_cprecoengine.cocreateinstance (clsid_spinprocrecognizer); // create a com instance of the recognition engine
*.
VT_UNKNOWN
Variable type isIUnknownFAR *.
VT_UI1
Variable type is unsigned char.
VT_RESERVED
This element is reserved.
VT_BYREF
Variable type is a pointer to data.
VT_ARRAY
Variable type is a safe array.
4. Write Data
SafeArrayPutElement(pSArray, l, inqReport[l]);
Instance Program (COM method ):
AA: Shielded Value
STDMETHODIMP CRepoFmt::getInqRepo(ULONG iStation, SAFEARRAY** ret){SAFEARRAY *pSArray = NULL;un
guidgen.exe tool.
2. Macro declare_interface _ declares the interface. The first parameter of the macro is the interface name, and the second parameter is the base class of the interface. The declare_interface macro is used to declare interfaces without the base class.
3. the macro stdmethod declares the methods in the interface. the return value of this method is hresult. pure is interpreted as "; = 0";, that is, this method is a pure virtual functi
DirectShow is a set of interfaces defined by Microsoft. It consists of different interfaces, such as ibasefilter and ipin. The relationship between these interfaces forms the DirectShow architecture.
The DirectX SDK provides a C ++ baseclasses interface. These implementations are mature and complete, so we don't need to re-develop a class library to implement the dirctshow interface, just use it directly.
DirectShow programming is filter programming. Different filters are implemented based on fu
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.