The serial communication protocol designed below is used to complete dual-machine InterconnectionProgram(SPCP. The design concept is based on the pillow frame transmission mode, that is, when sending data to the serial port, it is sent one frame at a time. In order to ensure reliable transmission, a connection is established through a handshake. In the transmission of each frame, the transmission, response, reconnection, and failure modes are used.
implement the idispatch pointer passing interface to handle various events. Now we use the iconnectionpointcontainer pointer we have obtained to call the findconnectionpoint method-it returns a pointer pointing to the connection point object (it is through this connection point object to obtain the required external interface, which is diid_dwebbrowserevent2 ). The following code shows the connection point:
5
Original article: Microsoft Co
; FindConnectionPoint (DIID_DWebBrowserEvents2, spCP );If (FAILED (hr ))Return hr;
If (inAdvise){// Pass the event handlers to the containerHr = spCP-> Advise (reinterpret_cast }Else{SpCP-> Unadvise (mCookie );}Return hr;}We can see that the SetSite parameter actually points to the browser component. In the SetSite implementation, we first save the browser compo
hr = spCPC-> FindConnectionPoint (DIID_DWebBrowserEvents2, spCP );If (FAILED (hr ))Return hr;If (inAdvise){// Pass the event handlers to the containerHr = spCP-> Advise (reinterpret_cast }Else{SpCP-> Unadvise (mCookie );}Return hr;}We can see that the SetSite parameter actually points to the browser component. In the SetSite implementation, we first save the br
, get_document can obtain the page content. To intercept an event, you can use the iwebbrowser2 interface to request the iconnectionpointercontainer interface, and then findconnectionpoint to find the connection point object of the outbound interface corresponding to an event, then, use the pointer of your COM object to call advice registration. From this perspective, your com is a receiver external image, so you need to implement the idispatch interface (automatically implement dual in the ATL
,sbroadcast):...Class Spacetimebuttonmatrix (View):...Class Stimepath (Timepath):...Class SPCP (PCP):...Class App (Guimixin, Guimaker): # or Guimakerframemenu"" "Application Level Class" "#其中包含菜单定义与操作...if __name__ = = ' __main__ ':Import TkinterImport Sysmain = APP ()Main.disablemenus ()If Len (sys.argv) = = 1:Main.mainloop ()Sys.exit ()Else# below here is wrapper functions for ShellDef openproject ():Main.openproject ()def example ():Main.example ()
Contact Us
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.