9CBS Discussion Summary Series:
JIANGSHENG 9CBS Digest (http://blog.9cbs.net/jiangsheng/archive/2005/12/24/561501.aspx) jiangsheng's 9CBS Digest (Oct 2005) (http: //blog.9cbs). NET / JIANGSHENG / Archive / 2005/12/27 / 563274.ASPX) Win32 & .NET Q & A 200509 (http://blog.9cbs.net/jiangsheng/archive/2005/09/13/480540.aspx )win32 &. NET Q & A (http://blog.9cbs.net/jiangsheng/archive/2005/02/28/304654.aspx) VC / MFC Q & A 200407 (http://blog.9cbs.net/jiangsheng/archive/2004/07 / 13/40771.aspx)
Ask the "VC Technical Insider" fourth edition P217, about the thread and the MFC book, not allowed to share the MFC object between the thread (this principle does not apply to the object derived from COBJECT or a simple class), then I want to Open a TXT file in a thread and write data in the inside: file * pfile = fopen (g_strsavepath, "wt"); where cstring g_strsavepath; is a global variable. In addition, the P217 of the book is mentioned that the main thread has a window, what is this window? What is the difference between delivery window handle and delivery window pointer? Is it possible to use the API function in the thread? Help the classmates do a program, I didn't expect to use the thread in it, I had to hold a Buddha foot, please advise. Thank you!
A: Each MFC thread class contains a master window pointer member. If this pointer points to which this pointer points to which this pointer points to the window have been destroyed in the main message loop of the thread class, then the main message loop is also caused.
CSTRING created with other threads is currently safe - but you'd better do this, ghosts know that Microsoft will not modify its implementation in the future MFC version to rely on the thread. The character array is secure, and the path length is capable, so you can use Tchar Tszpath [_MAX_PATH} to save the data. Some other types of classes and types can also be used to deliver data between threads, such as BSTR, and the like.
The function used by threads is not limited, but the MFC objects that can be used are limited, and only access to this thread is allowed to be created. If you check the source code of CWINTHREAD, it will find a temporary window object to inherit the main window of the parent thread in this clip - this is the default behavior, unless you manually specify a main window. This temporary window object is created by the main window handle using the parent thread.
Q: Embed controls in the web, the "control runs some functional unsafe" when browsing, what is the cause of these issues? If it is the reason for the control, then what should I enhance the security problem in the control? Will there be a problem with scripting editing? Ask a master to help?
A: If the control is secure to IE, you must implement the IObjectsafety interface. If you don't use the MFC to add a COM interface, you need to take a closer look at the MFC technical document 038Http: //msdn.microsoft.com/library/en-us/vcmfc98/html/_mfcnotes_tn038.asp For your problem, the knowledge base There is an example of MFC-based example http://support.microsoft.com/kb/164119 If you want to upgrade the existing control, you can refer to http://support.microsoft.com/kb/161873 Q: BHO intercepted Dispid_BeforenaviGate222, How do you display custom Band? How to pass the Explorer Bar written in the past? A: Manual display / hidden browser can refer to http://support.microsoft.com/support/kb/articles/q255/9/20.asp. In BHO, you can pass the enumerated window, after each window is located, a custom message is sent to the window of this thread.
Q: How do I declare an event in the VC class? Answer: C hosted extensions and C / CLI support events. // Managed C EXTENSION__DELEGATE VOID CLICKEVENTHANDLER (INT, DOUBLE); __ delegate void dblclickeventhandler (String *);
__gc class eventsource {__EVENT CLICKEVENTHANDLER * ONCLICK; __EVENT DBLCLICKEVENTHANDLER * ONDBLCLICK
// ...};
// C / ClideLegate Void CLICKEVENTHANDELER (int, double); delegate void dblclickeventhandler (string ^);
Ref class eventsource {Event copyventhandler ^ onclick; Event dblclicke; // ...};
// managed C extension // Explicitly achieve add, remove and raise ...
Public __dlegate void f (int); public __gc struct e {f * _e; public: e () {_e = 0;}
__event void add_e1 (f * d) {_e = D;
Static void Go () {E * PE = New E; PE-> E1 = New f (PE, & E :: Handler); PE-> E1 (17); PE-> E1 - = New F (PE, & E :: Handler); PE-> E1 (17);
Private: __event void raise_e1 (int i) {if (_e) _e (i);
Protected: __event void transove_e1 (f * d) {_e - = D;}};
// c / clidelegate void f (int); public ref struct e {private: f ^ _e; // Yes, commission is also a reference type
Public: e () {// Note 0 to be replaced with NULLPTR! _E = nullptr;} // C / CLI syntax collection Event f ^ e1 {public: void add (f ^ d) {_e = D;
Protected: void remove (f ^ D) {_e - = d;
Private: Void Raise (INT I) {if (_e) _e (i);
} Static void Go () {E ^ PE = GCNEW E; PE-> E1 = GCNEW F (PE, & E :: Handler); PE-> E1 (17); PE-> E1 - = GCNEW F (PE, & E :: handler); PE-> E1 (17);}}; you can also implement a callback function, send a WM_NOTIFY message or implement an automated connection-related interface to complete similar functions.
Q: There are several Page in my cpropertySheet, change the input in the EDITBOX of Page, and want to pass the input of the box to the variable. In the onok () response, Updatedata (TRUE) is called; however, the obtained variable value does not change accordingly. Why is it? Is it possible to use Updatedata ()? So how do I make the value of the variable to the input value of the box A: You can call CPROPERTYSHEET :: PressButton (PSBTN_ApplyNow); manually perform data exchange; note that use DDX to associate variables and controls on Page
Q: How to implement the functionality of dragging and dropping files from the listing empty side in WinRAR in WinRAR. Just from my own app to drag and drop the file by double-click "My Computer" window, I checked the information, it is estimated that the Coledatasource and the hook function, the younger brother didn't have to have, The heroes help, and the source code is better! A: You can implement OLE DRAG / DROP interface, refer to Microsoft Knowledge Base Article Q152092 Dragd95.exe Ole Drag / Drop in Windows 95 Common Controls and http://msdn.microsoft.com/library/en-us/shellcc/platform /shell/programmersguide/shell_basics/shell_basics_programming/transferring/DataSCenarios.asp.
Q: First, I am sure that a section of HTML has been copied to the clipboard, then I want to use the following code to get HTML code:
IdataObject idata = clipboard.getdataObject (); this.txtBox1.text = (string) iData.getdata (dataformats.html);
However, the obtained HTML is a piece of code (there is a lot of information on the beginning of the text):
Version: 1.0StartHTML: 000000264EndHTML: 000000659StartFragment: 000000431EndFragment: 000000623StartSelection: 000000431EndSelection: 000000590SourceURL: file: // D: / quzw / To press / Ba Rong Suo version Zhan Qian Qi Tu Web ℃ Dun Copernicium by Xiao / Application / WebExtract / bin /Debug/untitled.htm< !DOCTYPE HTML PUBLIC "- // w3c // DTD HTML 4.0 Transitional // En">