Win32 & .Net Q & A

xiaoxiao2021-03-06  19

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"> </ title> </ head></p> <p><Body> <! - startfragment -> <table> <tbody> <tr> <td width = "95%> <b> <a href="http://www.computer.org/"> IEEE Computer Society </A> </ b> <br> <span> Last Updated 3 December from IEEE Annals </ span> </ td> </ tr> </ tbody> </ table> <! - endfragment-- > </ Body> </ html></p> <p>And the code I want to get should be:</p> <p><Tr> <td width = "95%"> <b> <bref="http://www.computer.org/"> IEEE Computer Society </A> </ b> <br> <span> last Updated 3 december from IEEE Annals </ span> </ td> </ tr></p> <p>How can I do? ? ?</p> <p>A: STATHTML: 000000264Endhtml: 000000659StartFragment: 000000431ENDSELECTION: 000000623StartSelection: 00000043StartSelection: 000000431ndSelection: 000000590 These values ​​are the scope of the corresponding text in the clipboard data, in characters</p> <p>Reference http://msdn.microsoft.com/workshop/neetworking/clipboard/htmlclipboard.asp</p> <p>Q: Isn't there a cumbersome words in VC7? How can I go to VC7 from VC6? A: Refer to http://msdn.microsoft.com/library/en-us/vccore/html/vcgrfwhereisclasswizardInvisualcnet.asp</p> <p>Q: How do I add my own menu in the resource manager's right-click menu, and how to write my menu response command, thank you. Also, if you can know that the user resource manager right-click menu "copy" is copy-oriented (file name or folder name) can also (so I don't have to add my own menu) A: Refer to http: // www. CodeProject.com/shell/copypathext.asp Q: Can two webbrowser controls a session? A: WebBrowser control of the same process shared a session. Exception: The process manually transmits illegal data to IIS may cause session loss. Simultaneously use SSL and some routers, such as Cisco Local Director, may cause session loss Q: WM standard message is that subclasses have flowed to parent classes. When they encounter messages such as WM_PAINT, they will end, others will give their father to the father. Class flow, then process. So what about the WM_COMMAND message? This message is quirky, and the subclass will also notify the owner, such as pressing a button, the buttons will receive the message, then how do they deal with? How to stream? The processing of WM standard messages I simulated, and the type mechanism also simulated. But how do WM_COMMAND and WM_NOTIFY messages? Everyone talks about your opinion and understanding, it is better to have similar code. A: You can go see http://msdn.microsoft.com/library/en-us/vclib/html/_mfcnotes_tn021.asp Q: I have previously had a C / S system, and now I have developed a B / S. The system, that is, two parts of the same business system. I now want to use COM, directly through the webpage, to extract the person ID, and then call out the information display immediately in the C / S program, how to achieve, everyone gives some ideas? I don't know if you have used EPH, his chat room is so dry. Click the back button to add the software. It is not enough to add: There are two ways to implement a custom protocol. Operation by parsing the URL is to implement IDochostuihandler, the script in the browser control is accessed to access the host program by accessing Window.external. Refer to http://www.euromind.com/iedelphi/embeddedwb/ongetexternal.htm and http://www.euromind.com/iedelphi/app/PlugGableProtocol.htm. Q: Install the Sky Simplified Chinese Enterprise Edition, downloaded the Visual Studio SP5 Chinese version, but in the installation, the language version is wrong, depressed ~ How can I upgrade? A: The VC has no official Chinese version, and the SP needs to use English. Q: Why can the integer constant can be used as the value of the Switch structure, and the variable is forced to convert into constants? A: Switch Case is not IF Goto, which may be optimized according to the option when compiling. For example, some compilers may optimize equal intervals of continuous Switch (for example, 0, 1, 2, 3) to a jump table. Q: How do I add one in the favorites in IE? A: You can get the location of your favorites directly with ShgetSpecialFolderPath, then create a URL shortcut with iShellLink. Use ShchanGenotify to inform other programs after creating.</p> <p>Q: How to intercept IE floating advertisement? A: You can enumerate all floating web elements (Style.Position = "Absolute") and hides them; but it is best to notify users when hidden because all floating elements are advertising. Q: How do I realize the label page like a VC's IDE in a Formview? A: You can refer to http://msdn.microsoft.com/msdnmag/issues/02/10/cqa/default.aspx, http://www.codeproject.com/docview/cpropertyView.asp and http: // www. CodeProject.com/docview/mditab.asp Q: How to make cdhtmldialog have scroll bar ??? I used CWEbBrowser, in order to remove its border, I used CDHTMLDIALOG, but this is no scroll bar?? How to make Thank you a scroll bar it does: By default CDHtmlDialog initialization time will cancel the scroll bar void CDHtmlDialog :: initialize () {SetHostFlags (DOCHOSTUIFLAG_NO3DBORDER | DOCHOSTUIFLAG_SCROLL_NO); call SetHostFlags before oninitdialog re-set look like?. When the dialog is larger than the web page, you want to remove the scroll bar, set Body.Scroll = Auto when DocumentComplete. Q: How do I simulate CTRL Alt DELETE? A: I can refer to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/how_to_lock_the_workstation.asp Q: I use cfiledialog after setting up the parameters, multiple selection files can be reached up to 4,750, and how much memory cannot be added casually! Does any other ways to rewrite the class to choose any multiple files? A: Refer to my article http://blog.joycode.com/jiangsheng/archive/2004/11/22/39413.aspx Q: Can you have managed code and non-hosting code at the same time? Use a mutual statement to tell the compiler which segment is a managed manner. A: Refer to my article http://blog.joycode.com/jiangsheng/archive/2004/12/15/41209.aspx Q: I originally called the JavaScript function, but later my web is embedded as a framework. Other pages will not be successfully called. ActiveX always tries to call the JavaScript function under the main framework and thus always report the error that cannot be found. First get Script IDispatch interface void cmyactivexctrl :: OnsetClientSite () {iServiceProvider * ISP, * ISP2 = NULL; pscript = null; phtmldocument = null; pwebbrowser = null; pwebbrowser = null;</p> <p>if (m_pClientSite) {do {HRESULT hr = S_OK; hr = m_pClientSite-> QueryInterface (IID_IServiceProvider, reinterpret_cast <void **> (& isp)); if (FAILED (hr)) {m_pClientSite-> Release (); m_pClientSite = NULL ; break;} hr = isp-> QueryService (SID_STopLevelBrowser, IID_IServiceProvider, reinterpret_cast <void **> (& isp2)); if (FAILED (hr)) {m_pClientSite-> Release (); m_pClientSite = NULL; break;} hr = isp2-> QueryService (SID_SWebBrowserApp, IID_IWebBrowser2, reinterpret_cast <void **> (& pWebBrowser)); if (FAILED (hr)) {m_pClientSite-> Release (); isp-> Release (); m_pClientSite = NULL; isp = NULL; Break;} hr = pwebbbrowser-> get_document ((idispatch **) & phtmldocument; if (failed (hr)) {m_pclients-> release (); pwebbrowser-> release (); isp-> release (); ISP2-> Release (); m_pClientSite = NULL; pWebBrowser = NULL; isp = NULL; isp2 = NULL; break;} hr = pHTMLDocument-> get_Script (& pScript); if (FAILED (hr)) {m_pClientSite-> Release (); pHTMLDocument- > Release (); pwebbrowser-> release (); isp-> release (); isp2-> release (); phtmldocument = null; m_pclientsite = null PwebBrowser = NULL; ISP = NULL; ISP2 = NULL; Break;} if (ISP) {ISP-> Release (); ISP = null;} if (ISP2) {ISP2-> Release (); ISP2 = null;} } while (false);} else {destroyWindow ();} coleControl :: OnsetClientSite ();}</p> <p>Then call</p> <p>// send LRESULT CMyDoc :: outputParam (CString fuctionName, const CArray <CString> & params) {extern IDispatch * pScript to js; if (pScript == NULL) {return -1;} CComBSTR bstrMember (fuctionName);</p> <p>Dispid Dispid;</p> <p>HRESULT hr = pScript-> GetIDsOfNames (IID_NULL, & bstrMember, 1, LOCALE_SYSTEM_DEFAULT, & dispid); if (FAILED (hr)) {# ifdef _DEBUGswitch (hr) {case E_OUTOFMEMORY: MessageBox (NULL, "E_OUTOFMEMORY", "outputParam Err", 0); break; case DISP_E_UNKNOWNNAME: MessageBox (NULL, "DISP_E_UNKNOWNNAME", "outputParam Err", 0); break; case DISP_E_UNKNOWNLCID: MessageBox (NULL, "DISP_E_UNKNOWNLCID", "outputParam Err", 0); break;} # endifreturn -1;} Disprams Disprams; Memset (& Disprams, 0, SizeOf Dispparams);</p> <p>INT paramnum = params.getcount (); variant * pParams = new variant [paramnum];</p> <p>For (int i = 0; i <paramnum; i ) {ccombstr bstr = params.getat (i); // back readingbstr.copyTo (& PParams [i] .bstrval; pParams [i] .vt = vt_bstr;}</p> <p>Dispparams.Rgvarg = pParams; Disprams.cnamedArgs = 0; Disprams.cargs = paramnum</p> <p>EXCEPINFO excepInfo; memset (& excepInfo, 0, sizeof excepInfo); CComVariant vaResult; UINT nArgErr = (UINT) -1; // initialize to invalid arghr = pScript-> Invoke (dispid, IID_NULL, 0, DISPATCH_METHOD, & dispparams, & vaResult, & excepInfo , & nargerr); delete [] Dispparams.Rgvarg; Return 1;} But this method can only get JavaScript scripts in the main frame, and the web page in which ActiveX is embedded as a sub-frame. It cannot be called successfully. Does anyone know how to do it? What is the way to let Acticex call JS to find the corresponding JavaScript code in a frame page containing ActiveX? Answer: hr = ISP-> queryservice (SID_STopleBrowser, IID_IServiceProvider, ReinterPret_cast <void **> (& ISP2)); Is this unclear to access the top floor frame? M_PClientSite's Container is an HTMLDocument object. The GET is Container. You can ask: How to specify a Google page to automatically fill in "Hello", automatically click the Search button? Do not answer the method of analog buttons: First access the HTMLDocument all attribute to get the HTML element collection and then enumerate to find the required form element (by comparing tagname or by querying the IHTMLMLEMELEMENT interface) to access the ELEMENT to access the form element after accessing the form element, then enumeration Find the required input domain elements (by comparing tagname or by querying the ihtmlinputelement interface) Q: Installing the VC6.0 English or Chinese version Finally prompt DCOM registration failure, partial installation and all installations ,I do not know why? XPSP2, master life! ! ! ! Q: Why is I always errors when I installed Visual Studio 6.0? Changed the disc, the Chinese and English version tried, always appeared in the following error tips: setup WAS Unable to create a dcom user account in Order to register 'C: / Program Files / Microsoft Visual Studio / Common / Tools / VS-ENT98 / Vanalyzr /valec.exe</p> <p>Please help the friends to help `~ Thank you first. If you pop up a new IE window in this window, this window cannot get the user's authentication information, you need to log in once. Question: How to pass this information in the new pop-up IE window after I have passed my own browser authentication? A: When you create a window, if the host of the browser control does not process the NewWindow2 event or the NewWindow event, you will create a window in a new IE process. Since the session does not cross the process, you can have problems with the SESSION program. About how to deal with newwindow2 events, you can refer to http://support.microsoft.com/kb/184876/ Q: How to release the icon resource obtained with SHGETFILEINFO? I use the following statement to get the icon of some type of file, you can succeed. However, if this operation is made for many files, the GDI object of this program is discovered in the Window Explorer, and when more than 10000, the system interface will spend. SHGetFileInfo (WFD.cFileName, FILE_ATTRIBUTE_NORMAL, & fileInfoS, sizeof (fileInfoS), SHGFI_USEFILEATTRIBUTES | SHGFI_TYPENAME | SHGFI_ICON); A: If SHGetFileInfo returns an icon handle in the hIcon member of the SHFILEINFO structure pointed to by psfi, you are responsible for freeing it with DestroyIcon when you no longer need it.For more information, seehttp: //msdn.microsoft.com/library/default.asp url = / library / en-us / shellcc / platform / shell / reference / functions / shgetfileinfo.asp? Q: How do I know the ID of OCX ON_EVENT (CDLG, IDC_SKIN, / * Here * /, OnClickskin, VTS_i4)</p> <p>Q: The problem is to draw the problem of continuous line segments below. The purpose is to click on a series of points with a mouse to connect each point into a straight line, but it is not allowed to intersect the existing lines. What should I do? A: The existing point is sorted in some way, and then sequentially connected in this row. Method 1</p> <p>1 Looking for any one and point concentration, no two points are not in a straight line point 2 with this point, either the polar shampoo to establish a polar coordinate system. 3 Sorting Point Set Polar Coordinates 4 Follow this sequential connection point or method 2</p> <p>Looking for the remaining points of the bumps again to find the bump circulation until all points have entered the bumps</p> <p>Obviously these bumps are included, one set, and then open this series of convex packets. The so-called opening is any point on the bump, finds a point on the next convex bag so that the connection between the wires and internal convex packs can be such that the result is a similar helical shape for the description Question, put the processing plan plan to find multiple bakes in the specific operation, how to find a pile of points while finding a pile of points, find a pole point, such as the smallest The point of the x component is the smallest point, it is definitely a point on the bumps and then finds a point from here, so that other points record this line segment on the same side of this point and the starting point, and then put it again Founded as a new starting point, find a next line segment, until completing a closed polygon for reference http://search.9cbs.net/expert/topic/2483/2483852.xml?temp =.5336725 Q: I am Make a category of Outlook / Foxmail in the WinForm program. In the HTML Editor Editing function, by browsing the local image, just record a picture path in the mail content, this is sent out, the customer can't see Go to the picture. Which hero knows how Outlook / Foxmail is sent to a part of the image (not in the attachment)? Should be a MHTML function? How to implement the above function? Please give an example code. : You can refer to http://www.codeproject.com/vb/net/mhtbuilder.asp Q: How do you see if VC6 has installed SP5 and SP6? A: Refer to Microsoft Knowledge Base Article How to determine if Visual Studio Service Pack http is installed: //support.microsoft.com/kb/194295 Q: I want to be an activeX to listen to the port of a server, accept the JS function of the page after the server instruction is called, can you implement this? ActiveX call page JS function how to write? A: Yes, the ActiveX container is an HTMLDocument object, and it is possible to execute its ExecScript method. Microsoft Knowledge Base Article Q172763 INFO: Accessing The Object Model from Withn AN ActiveX Control describes how to interact with IOLCLIENTSITE and IE control container. You can use the IoleClientSite :: getContainer to get the Iolecontainer interface of the HTML document object where the web is located, then query other interfaces, such as IHTMLDocument2 to perform access to the DHTML object model.</p> <p>The IHTMLDocument2 :: Scripts property represents all script objects in the HTML document. Use the IDispatch interface of the script object :: getIdsofNames method You can "find the functions and object members, use idispatch :: invoke to access these members. You can also perform scripts with IHTMLDocument2 :: ExecScript.</p> <p>You can also declare events in ActiveX, write the processing code for this event in the script.</p> <p>Q: Nearly studying browser development. I have encountered a problem, I haven't resolved a few days of information. I hope everyone gives support and help, thank you! The specific problems are as follows:</p> <p>I made a browser in MDI mode and using the AxWebBrowser to make a browser. Now I will pop up two windows at the same time, one is the (correct) in my browser, one is IE browser (more ). I now want to know why and how to block this window that can be blocked from IE.</p> <p>Some related code is as follows</p> <p>private void Mdi_Load (object sender, System.EventArgs e) {Thread t = new Thread (new ThreadStart (GoGo)); t.Start (); webBrowser_V1 = (SHDocVw.WebBrowser_V1) this.axWebBrowser1.Application; this.webBrowser_V1.NewWindow = new shdocvw.dwebbrowserevents_newwindoweventhandler (webbrowser_v1_newwindow);</p> <p>}</p> <p>private void webBrowser_V1_NewWindow (string URL, int Flags, string TargetFrameName, ref object PostData, string Headers, ref bool Processed) {Mdi form2 = new Mdi (URL); form2.MdiParent = this.MdiParent; form2.Show ();} A : NewWindow2 Events are triggered before creating a new window (NewWindow event is triggered for compatibility, and this event should not be processed in the new code) If you want to stop the default processing (open a new window in Internet Explorer), Need to set the value of Cancel to real reference http://msdn.microsoft.com/library/default.asp?url=/Workshop/Browser/webbrowser/reference/iFaces/dwebbrowserevents2/newwwindow2.asp</p> <p>Setting processed is true for Private Void WebBrowser_v1_newwindow (string url, int flags, string targetframename, refbject postdata, string headers, ref bool processed) this declaration.</p> <p>For Private Void AxWebBBrowser1_NewWindow2 (Object Sender, Axshdocvw.dWebBBrowserevents2_Newindow2event E), you need to set E.CANCEL as true. Q: IE programming, get the value of the current mouse pointing to the value? If there is no subordew in the web page, you can get it with the following statement, but if the web page is with Frame, the following statement is not the main frame, the following statement is invalid, htmlelement: = HTMLDocument.ElementFromPoint (px, py );</p> <p>There are two problems, I don't understand, one, how to get to the front mouse pointing to Frame, get the IHTMLDocument interface in the frame? Second, how to convert P.X and P.Y into coordinates relative to Frame? A: 1 ElementFromPoint After getting Frame Query iWebBrowser2 interface 2 Depending on the position of the left upper left corner, the coordinate reference information http://www.codeguru.com/Cpp/in/ieprogram/security/Article.php/c4387 Q: How to according to the file The extension gets the corresponding icon in the operating system? A:</p> <p>private void button1_Click (object sender, System.EventArgs e) {this.Icon = ExtractIcon.GetIcon ( "D: //111.txt", false);} using System; using System.Runtime.InteropServices; using System.Drawing; Using system.windows.forms;</p> <p>/// <summary> /// Summary description for ExtractIcon./// </ summary> public class ExtractIcon {[DllImport ( "Shell32.dll")] private static extern IntPtr SHGetFileInfo (string pszPath, uint dwFileAttributes, out SHFILEINFO psfi , uint cbfileinfo, SHGFI UFLAGS;</p> <p>[DLLIMPORT ("COMCTL32.DLL")] Private static extern int imagelist_getimagecount (intptr hi);</p> <p>[DLLIMPORT ("COMCTL32.DLL")] Private Static Extern INTPTR IMAGELIST_GETICON (INTPTR HIML, INT I, UINT FLAGS);</p> <p>[StructLayout (LayoutKind.Sequential)] private struct SHFILEINFO {public SHFILEINFO {hIcon = IntPtr.Zero (bool b); iIcon = 0; dwAttributes = 0; szDisplayName = ""; szTypeName = "";} public IntPtr hIcon; public int iIcon; public uint dwAttributes; [MarshalAs (UnmanagedType.LPStr, SizeConst = 260)] public string szDisplayName; [MarshalAs (UnmanagedType.LPStr, SizeConst = 80)] public string szTypeName;};</p> <p>Private extracton () {}</p> <p>private enum SHGFI {SHGFI_ICON = 0x000000100, // get iconSHGFI_DISPLAYNAME = 0x000000200, // get display nameSHGFI_TYPENAME = 0x000000400, // get type nameSHGFI_ATTRIBUTES = 0x000000800, // get attributesSHGFI_ICONLOCATION = 0x000001000, // get icon locationSHGFI_EXETYPE = 0x000002000, // return exe typeSHGFI_SYSICONINDEX = 0x000004000, // get system icon indexSHGFI_LINKOVERLAY = 0x000008000, // put a link overlay on iconSHGFI_SELECTED = 0x000010000, // show icon in selected stateSHGFI_ATTR_SPECIFIED = 0x000020000, // get only specified attributesSHGFI_LARGEICON = 0x000000000, // get large iconSHGFI_SMALLICON = 0x000000001 , // get small iconSHGFI_OPENICON = 0x000000002, // get open iconSHGFI_SHELLICONSIZE = 0x000000004, // get shell size iconSHGFI_PIDL = 0x000000008, // pszPath is a pidlSHGFI_USEFILEATTRIBUTES = 0x000000010 / / Use passed dwFileAttribute} private enum SHIL {SHIL_LARGE = 0, // normally 32x32SHIL_SMALL = 1, // normally 16x16SHIL_EXTRALARGE = 2, SHIL_SYSSMALL = 3 // like SHIL_SMALL, but tracks system small icon metric correctly}</p> <p>/// <summary> /// Get the associated icon for a file or application, this method always returns /// An icon. if the strpath is invalid or there iponc the default icon is returned /// </ summary > /// <param name = "strpath"> Full path to the file </ param> /// <param name = "bsmall"> if true, the 16x16 icon is returned otherwise the 32x32 </ param> /// <returns> </ returns> public static Icon GetIcon (string strPath, bool bSmall) {SHFILEINFO info = new SHFILEINFO (true); int cbFileInfo = Marshal.SizeOf (info); SHGFI flags; if (bSmall) flags = SHGFI.SHGFI_ICON | SHGFI.SHGFI_SMALLICON; elseflags = SHGFI.SHGFI_ICON | SHGFI.SHGFI_SMALLICON | SHGFI.SHGFI_USEFILEATTRIBUTES; SHGetFileInfo (strPath, 256, out info, (uint) cbFileInfo, flags); return Icon.FromHandle (info.hIcon);}</p> <p>Public static int geticonindex (string strpath, imagelist imglist) {shfileinfo info = new shfileinfo (true); int cbfileinfo = marshal.sizeof (info); inteptr hicon;</p> <p>Flags = shgfi.shgfi_sysiconindex | SHGFI.SHGFI_SMALLICON;</p> <p>INTPTR RET = SHGETFILEINFO ("C: ////", 256, OUT INFO, (UINT) CBFILEINFO, FLAGS); int nbicon = imagelist_getimagecount (re);</p> <p>For (int i = 0; i <nbicon; i ) {hicon = imagelist_geticon (RET, I, 0); imglist.images.add (icon.fromhandle (hicon));}</p> <p>Return Info.iicon;}} Q: I have a date format CString value, I want to give a variable of a CTIME, please ask what method is the best conversion? A: COLEDATETIME :: ParsedateTime You can resolve the time in the standard format, refer to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_coledatetime.asp but for the standard There is no ready-made algorithm. You need to design a parsing function, such as using scanf. ColedateTime is not necessarily to CTIME, because CTIME's time is from 0:00:00 GMT, January 1, 1970 to 03:14:07 January 19 2038, while COLLDATETIME is from 1 January 100 to 31 December 9999. If you determine the time can be converted, you can use a constructor of CTIME: CTIME (int Nyear, int NMONTH, INT NDAY, INT NHOUR, INT NMIN, INT NSEC, INT NDST = -1); in which the value of the parameter can call COLEDATETIME The corresponding member function is obtained. Q: How is the easiest way to edit the sky branch with VB.NET! A: there may be an increased class .Net 2.0 EastAsianLunisolarCalendar.GetSexagenaryYear Method EastAsianLunisolarCalendar.GetTerrestrialBranch MethodNote: Methods are new in the .NET Framework version 2.0 Namespace:. System.GlobalizationAssembly: mscorlib (in mscorlib.dll) look-up table may also Function GetYLDate (Tyear As INTEGER, TMONTH AS INTEGER, TDAY AS INTEGER, _ YLYEAR AS STRING, YLSHUXING As String, _ Optional isgetgl as boolean) AS String On Error ResMe Next NEXT</p> <p>DIM Dalist (1900 to 2011) AS String * 18</p> <p>DIM CONDATE AS DATE, SETDATE AS DATE</p> <p>Dim AddMonth As Integer, AddDay As Integer, Addyear AS Integer, Getday As Integer</p> <p>DIM Runyue as Boolean</p> <p>If Tyear> 2010 or Tyear <1901 Then EXIT FUNCTION 'If not valid, exit</p> <p>'1900 to 1909</p> <p>Dalist (1900) = "010010110110180131"</p> <p>Dalist (1901) = "010010101110000219"</p> <p>Dalist (1902) = "101001010111000208"</p> <p>Dalist (1903) = "010100100110150129"</p> <p>Dalist (1904) = "110100100110000216"</p> <p>Dalist (1905) = "110110010101000204"</p> <p>Dalist (1906) = "011010101010140125" DALIST (1907) = "010101101010000213"</p> <p>Dalist (1908) = "100110101101000202"</p> <p>Dalist (1909) = "010010101110120122"</p> <p>Dalist (1910) = "010010101110000210"</p> <p>Dalist (1911) = "101001001101160130"</p> <p>Dalist (1912) = "101001001101000218"</p> <p>Dalist (1913) = "110100100101000206"</p> <p>Dalist (1914) = "110101010100150126"</p> <p>Dalist (1915) = "101101010101000214"</p> <p>Dalist (1916) = "010101101010000204"</p> <p>Dalist (1917) = "100101101101020123"</p> <p>Dalist (1918) = "100101011011000211"</p> <p>Dalist (1919) = "010010011011170201"</p> <p>Dalist (1920) = "010010011011000220"</p> <p>Dalist (1921) = "101001001011000208"</p> <p>Dalist (1922) = "101100100101150128"</p> <p>Dalist (1923) = "011010100101000216"</p> <p>Dalist (1924) = "011011010100000205"</p> <p>Dalist (1925) = "101011011010140124"</p> <p>Dalist (1926) = "00101010110110000213"</p> <p>Dalist (1927) = "100101010111000202"</p> <p>Dalist (1928) = "010010010111120123"</p> <p>Dalist (1929) = "010010010111000210"</p> <p>Dalist (1930) = "011001001011060130"</p> <p>Dalist (1931) = "110101001010000217"</p> <p>Dalist (1932) = "111010100101000206"</p> <p>Dalist (1933) = "011011010100150126"</p> <p>Dalist (1934) = "010110101101000214"</p> <p>Dalist (1935) = "001010110110000204"</p> <p>Dalist (1936) = "100100110111030124"</p> <p>Dalist (1937) = "100100101110000211"</p> <p>Dalist (1938) = "110010010110170131"</p> <p>Dalist (1939) = "110010010101000219"</p> <p>Dalist (1940) = "110101001010000208"</p> <p>Dalist (1941) = "110110100101060127" DALIST (1942) = "101101010101000215"</p> <p>Dalist (1943) = "010101101010000205"</p> <p>Dalist (1944) = "101010101101140125"</p> <p>Dalist (1945) = "001001011101000213"</p> <p>Dalist (1946) = "100100101101000202"</p> <p>Dalist (1947) = "110010010101120122"</p> <p>Dalist (1948) = "101010010101000210"</p> <p>Dalist (1949) = "101101001010170129"</p> <p>Dalist (1950) = "011011001010000217"</p> <p>Dalist (1951) = "101101010101000206"</p> <p>Dalist (1952) = "010101011010150127"</p> <p>Dalist (1953) = "010011011010000214"</p> <p>Dalist (1954) = "101001011011000203"</p> <p>Dalist (1955) = "010100101011130124"</p> <p>Dalist (1956) = "010100101011000212"</p> <p>Dalist (1957) = "101010010101080131"</p> <p>Dalist (1958) = "111010010101000218"</p> <p>Dalist (1959) = "01101010101010000208"</p> <p>Dalist (1960) = "101011010101060128"</p> <p>Dalist (1961) = "101010110101000215"</p> <p>Dalist (1962) = "010010110110000205"</p> <p>Dalist (1963) = "101001010111040125"</p> <p>Dalist (1964) = "101001010111000213"</p> <p>Dalist (1965) = "010100100110000202"</p> <p>Dalist (1966) = "111010010011030121"</p> <p>Dalist (1967) = "110110010101000209"</p> <p>Dalist (1968) = "010110101010170130"</p> <p>Dalist (1969) = "010101101010000217"</p> <p>Dalist (1970) = "100101101101000206"</p> <p>Dalist (1971) = "010010101110150127"</p> <p>Dalist (1972) = "010010101101000215"</p> <p>Dalist (1973) = "101001001101000203"</p> <p>Dalist (1974) = "110100100110140123"</p> <p>Dalist (1975) = "110100100101000211"</p> <p>Dalist (1976) = "110101010010180131" DALIST (1977) = "101101010100000218"</p> <p>Dalist (1978) = "101101101010000207"</p> <p>Dalist (1979) = "100101101101060128"</p> <p>Dalist (1980) = "100101011011000216"</p> <p>Dalist (1981) = "010010011011000205"</p> <p>Dalist (1982) = "101001001011140125"</p> <p>Dalist (1983) = "101001001011000213"</p> <p>Dalist (1984) = "1011001001011A0202"</p> <p>Dalist (1985) = "011010100101000220"</p> <p>Dalist (1986) = "011011010100000209"</p> <p>Dalist (1987) = "101011011010060129"</p> <p>Dalist (1988) = "101010110110000217"</p> <p>Dalist (1989) = "100100110111000206"</p> <p>Dalist (1990) = "010010010111150127"</p> <p>Dalist (1991) = "010010010111000215"</p> <p>Dalist (1992) = "011001001011000204"</p> <p>Dalist (1993) = "011010100101030123"</p> <p>DALIST (1994) = "111010100101000210"</p> <p>Dalist (1995) = "011010110010180131"</p> <p>Dalist (1996) = "010110101100000219"</p> <p>Dalist (1997) = "101010110110000207"</p> <p>Dalist (1998) = "100100110110150128"</p> <p>Dalist (1999) = "100100101110000216"</p> <p>Dalist (2000) = "110010010110000205"</p> <p>DALIST (2001) = "110101001010140124"</p> <p>Dalist (2002) = "110101001010000212"</p> <p>Dalist (2003) = "110110100101000201"</p> <p>Dalist (2004) = "010110101010120122"</p> <p>Dalist (2005) = "010101101010000209"</p> <p>Dalist (2006) = "101010101101170129"</p> <p>Dalist (2007) = "001001011101000218"</p> <p>Dalist (2008) = "100100101101000207"</p> <p>Dalist (2009) = "110010010101150126"</p> <p>Dalist (2010) = "101010010101000214"</p> <p>Dalist (2011) = "101101001010000214" AddYear = Tyear</p> <p>Runyue = false</p> <p>If isgetgl then</p> <p>AddMonth = VAL (MID (Dalist (AddYear), 15, 2))</p> <p>Addday = VAL (MID (Dalist (AddYear), 17, 2))</p> <p>Condate = dateserial (addyear, addmonth, addday)</p> <p>AddDay = TDAY</p> <p>For i = 1 to TMONTH - 1</p> <p>Addday = addday 29 val (MID (Dalist (Tyear), I, 1))</p> <p>Next i</p> <p>'Msgbox Datediff ("D", Condate, Date)</p> <p>Setdate = dateadd ("D", AddDay - 1, Condate)</p> <p>Getyldate = setdate</p> <p>Tyear = year (setdate)</p> <p>TMONTH = MONTH (SetDate)</p> <p>TDAY = day (setdate)</p> <p>EXIT FUNCTION</p> <p>END IF</p> <p>Chushihua:</p> <p>AddMonth = VAL (MID (Dalist (AddYear), 15, 2))</p> <p>Addday = VAL (MID (Dalist (AddYear), 17, 2))</p> <p>Condate = dateserial (addyear, addmonth, addday)</p> <p>Setdate = dateserial (Tyear, TMONTH, TDAY)</p> <p>Getday = datediff ("d", condate, setdate)</p> <p>IF getday <0 Then adyear = addyar - 1: goto chushihua</p> <p>'AddDay = NEARDAY</p> <p>AddDay = 1: addmonth = 1</p> <p>For i = 1 to getday</p> <p>Addday = addday 1</p> <p>IF addday = 30 mid (Dalist (addyear), Addmonth, 1) or (Runyue and AddDay = 30 MID (Dalist (AddYear), 13, 1))</p> <p>IF Runyue = false and addmonth = VAL ("& H" & MID (Dalist (AddYear), 14, 1))</p> <p>Runyue = TRUE</p> <p>Else</p> <p>Runyue = false</p> <p>Addmonth = Addmonth 1</p> <p>END IF</p> <p>Addday = 1</p> <p>END IF</p> <p>NEXT</p> <p>MD $ = "The first third day of the third day, the first six first seventh day, the first nine, the first year, 112233141四 五 五 六 廿 八</p> <p>DD $ = MID (MD $, (AddDay - 1) * 2 1, 2)</p> <p>MM $ = MID ("Zhengsi Tie Thirty or 567899 Tolden", AddMonth, 1) "Month"</p> <p>Yougetdate = dateserial (addyear, addmonth, addday)</p> <p>Tiangan $ = "Betten Britten" has Geng Xinyi "</p> <p>Dizhi $ = "Zi ugly 寅 辰 巳 午 未 亥"</p> <p>Dim Ganzhi (0 to 59) AS STRING * 2for I = 0 to 59</p> <p>Ganzhi (i) = MID (Tiangan $, (i MOD 10) 1, 1) MID (Dizhi $, (i MOD 12) 1, 1)</p> <p>'ff $ = ff $ GANZHI (i)</p> <p>Next i</p> <p>'MSGBOX FF $,, LEN (ff $)</p> <p>Ylyear = Ganzhi ((ADDYEAR - 4) MOD 60)</p> <p>Shu $ = "Rat Niuhu Rabbit Dragon Snake Pigher Wool Monkey Chicken Dog"</p> <p>Ylshuxing = MID (Shu $, (AdDyear - 4) MOD 12) 1, 1)</p> <p>IF Runyue Then MM $ = "" mm $</p> <p>GetYldate = mm $ DD $</p> <p>END FUNCTION</p> <p>'The following is an example of use, you need to add a button on the form, and name Command1, then copy the following code to the form of the form.</p> <p>Private submmand1_click ()</p> <p>DIM TY AS INTEGER, TM AS INTEGER, TD AS INTEGER, YL AS STRING, SX AS STRING</p> <p>'Lunar Date of Taking the Queen of the Calendar 1999</p> <p>TY = 1999</p> <p>TM = 10</p> <p>TD = 28</p> <p>T = getYldate (TY, TM, TD, YL, SX)</p> <p>Msgbox T</p> <p>Msgbox Ty & "-" & TM & "-" & TD & "& YL &" & SX</p> <p>'Take the Date of the Guan calendar of the Lunar New Year's Day in 1999</p> <p>T = getYldate (TY, TM, TD, YL, SX, TRUE)</p> <p>Msgbox T</p> <p>Msgbox Ty & "-" & TM & "-" & TD & "& YL &" & SX</p> <p>End Sub Q: I want to write a COM component for the ASP call, can I get the customer IP / call URL of the current call ASP in the COM component? The method of passing parameters is not used: Yes, but this will make your components depend on IIS support. Reference http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnasp/html/comp.asp and http://msdn.microsoft.com/library/default.asp? url = / library / en-us / iissdk / iis / ref_biobj_cppirqs.asp Q: ActiveX written inside a method to call javascript method // send a message LRESULT CFXVTDoc :: outputParam (CString fuctionName, const CArray <CString> & params to js ) {EXTERN IDISPATCH * PScript; if (pscript == null) {return -1;} ccombstr bstrmember (fuctionname);</p> <p>Dispid Dispid;</p> <p>HRESULT hr = pScript-> GetIDsOfNames (IID_NULL, & bstrMember, 1, LOCALE_SYSTEM_DEFAULT, & dispid); if (FAILED (hr)) {# ifdef _DEBUGswitch (hr) {case E_OUTOFMEMORY: MessageBox (NULL, "E_OUTOFMEMORY", "outputParam Err", 0); break; case DISP_E_UNKNOWNNAME: MessageBox (NULL, "DISP_E_UNKNOWNNAME", "outputParam Err", 0); break; case DISP_E_UNKNOWNLCID: MessageBox (NULL, "DISP_E_UNKNOWNLCID", "outputParam Err", 0); break;} # endifreturn -1;} Disprams Disprams; Memset (& Disprams, 0, SizeOf Dispparams);</p> <p>INT paramnum = params.getcount (); variant * pParams = new variant [paramnum];</p> <p>For (int i = 0; i <paramnum; i ) {ccombstr bstr = params.getat (i); // back readingbstr.copyTo (& PParams [i] .bstrval; pParams [i] .vt = vt_bstr;}</p> <p>Dispparams.Rgvarg = pParams; Disprams.cnamedArgs = 0; Disprams.cargs = paramnum</p> <p>EXCEPINFO excepInfo; memset (& excepInfo, 0, sizeof excepInfo); CComVariant vaResult; UINT nArgErr = (UINT) -1; // initialize to invalid arghr = pScript-> Invoke (dispid, IID_NULL, 0, DISPATCH_METHOD, & dispparams, & vaResult, & excepInfo , & nargerr); delete [] Disprams.Rgvarg; Return 1;}</p> <p>This method calls everything in the main thread, but it will fail to call in the thread written by yourself, exploding the DISP_E_UNKNNAME error. I have checked for a long time, I saw that some people's post said that some COM methods are unsafe threads, so don't use threads. Is that right? But I don't know how to do it now.</p> <p>One of the operations here is like this. ActiveX calls JS method ---> JS Do the appropriate action -> JS Call ActiveX method Report operations The whole process is not overlap. For example, after the first JS method is called, if the JS completion message has not been obtained, it is not possible to start the second JS method call. But this is transparent to the user, and the user can submit multiple operational requests at a time. So I put the operation request in the queue and synchronize through CEVENT. If you don't put it in the thread, you will die when you wait.</p> <p>How to solve this? A: You can collect all your scripts to operate the thread that creates the control. The usual approach is to send a custom message, and write the processing code during the control of the control of the control. Q: What is the event when the JavaScrip call closes the window is triggered in AxWebBrowser? I use the AxWebBrowser control to browse the next page, http://www.5460.net/gy5460/jsp/login/loginmain.jsp, click Close button, web page calls to the window.close () method in JavaScript, how do I cut this event. Thank you. I monitor Window.close () Before and after execution, the AxWebBrowser control is not turned off, the various attributes are exactly the same, but when I call Browser.visible = true, the browser.bringtofront () function, the browser can reproduce But you can't browse the web. why is this happening? It seems that when using JavaScript to close the browser control, the browser control should release the resource, but it can be found when it is debugged, it is really strange! A: There will be WindowClosing. Event http://msdn.microsoft.com/Workshop/Browser/webbrowser/reference/events/windowclosing.asp. Handle the WindowClosing event, cancel the default process, you can prompt the user and close the window. Reference Q253219 PRB: WebBrowser Control Disappears When Script Calls WINDOW.CLOSE () http://support.microsoft.com/support/kb/articles/q253/2/19.asp</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-52862.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="52862" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.034</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'XNtfiEjvQuHrF7f5PHCIsH9CBUUADutzCluJiucXmYLKN4Q_2FXbAbDspJ448Q2t8KiPiUAKOXUpsKxqfrk_2FLoTQ_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>