After work, in the reading of the code written by foreigners, found a very interesting thing, we often say goto statement is harmful, mainly it jumps to jump, upset logic. But Goto also has benefits, such as single-exit, unified freeing of memory aspects, the next look at a function of MAPI initializationintMapiinit () {intResult =Dt_error; HRESULT HRESULT=S_FALSE; HANDLE Hlock=NULL; BOOL bLocked=FALSE; DWO
The method of the COM component is declared in IDL:
[ID (1), helpstring ("Method Inputarray")] HRESULT Inputarray ([in] VARIANT vdata);
Methods to establish an array in a script and invoke a COM component:
When the array is large, like 100k, JavaScript is very inefficient when assigning values to arrays! Completion time, CPU occupancy rate, memory consumption is terrible. Instead, VBScript did a good job.
Code for COM components:
You can see from
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
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.