The DynamicGIF control was written for a few more time. When the code was optimized, the enabled attribute was removed, but I didn't expect it to have a problem in VB, I have to add attributes. In addition, when the VB is called, the discovery background cannot be automatically updated, resulting in overlapping of the rear frame image and the previous frame. I want to further study VB's ActiveX work principle, but unfortunately I am a VB blind, no way.
In the RicheDit 2.0 version, the call to the ActiveX control interface is relatively large, so after the enabled property is added, in the Richedit control inserted into version 2.0, you need to call the following method after the InsertObject call is successful: lpdyNamicgif-> PUT_ENABLED ( Variant_true); to allow display in the RicheDit control. In addition, in the ATL dialog and MFC dialog box, the principle is completely different when you create a DynamicGIF control. In the MFC, create a windowless control, the display area of the dialog, so some GIF files will cause the dialog that is not stopped, gives people a flicker feel. In the ATL dialog box, a corresponding window is created, the GIF image is displayed in a new window, so that there is no flashing feel, the display is also normal. Therefore, you can choose different creation methods according to different needs. Here's how to use the source code of the control in the ATL / WTL dialog: CAXWINDOW DYNAXWINDOW; DYNAXWINDOW.M_HWND = NULL; DYNAXWINDOW.ATTACH (Getdlgitem (idc_dynamicgif1));
HRESULT HR = DynaxWindow.QueryControl; if (hr == s_ok) {m_spdyngif-> LoadFromFile (CCOMBSTR (L "E: //8.gif");} DynaxWindow.detach (); Note: The above code should Compile the compilation environment after VC7, the problem of resource leakage in VC6 (BUG of ATL3.0). After getting the idynamicGIF interface, you can call the relevant method. In addition, in order to facilitate VB6 users, two functions, INSERTGIFTORICHEDITW / A, to support direct files into the richedit control, the prototypes of the two functions are as follows: stdapi insertgiftoricheditw (hwnd hwnd, lpcwstr lpszgiff); stdapi insertgiftorichedita (hwnd HWND, LPCSTR LPSZGIFFILE); successfully returns a unique cookie identity control, failed to return 0. Here, in order to limit the usage rate of the CPU, the maximum size of the GIF is 150 * 150, and the maximum 50 objects are created in a process (actually more than 50, the CPU is almost 100%). By using these two functions, it can be used in any language that can be used in a dynamic connection library, such as Delphi, Pb, C #, etc., even Win32. The code used in the VC is as follows:
TypedEf HRESULT (hwnd hwnd, bstr lpszgififfile); hModule hdll = loadingLibrary ("DynamicGIF.dll");
PFNSERTGIFTORICHEDIT_T PFNSERTGIF = NULL;
PFNSERTGIF = (PfnInsertgiftoricHedit_T) getProcaddress (HDLL, "InsertgiftoricHeditw);
IF (PFNSERTGIF! = NULL)
PFNSERTGIF (M_RichEdit1.m_hWnd, CCOMBSTR (DLG.GetPathName ()));
There are two ways to use in VB: 1, using the ActiveX control mode, GIF 2 is displayed in the Form, inserted into the VB in the API mode: First declare this function, private declare function insertgiftorichedit lib "DynamicGIF.dll "BYVAL HWND AS Long, Byval Giffile AS String) AS Long then calls this function in the appropriate function, inserting a GIF animation, such as Ret = INSERTGIFTORICHEDIT (RichtextBox1.hwnd, filename), using VB6 You can also develop chat tools with dynamic expressions. The real dynamic expression is simple in the VC, and I have time, I write more, discuss how to implement dynamic expressions in VB. How to download controls and presentations: In the Album 2005-1 article pictures, use the flashget to download the corresponding GIF image, each with a corresponding prompt. The pictures corresponding to DEMO and DYNAMICGIF are opened with UltraEdit binary, delete the front 67 bytes, and save the remaining parts with the ZIP extension, is the corresponding compressed file. Before run, copy DynamicGIF.dll to the system directory, and then call Regsvr32 DynamicGIF.dll to register to the system, you can use it. The control relies on gdiplus.dll, XP has already taken it, and you need to download it on Microsoft Site in 2000. Disclaimer: This control does not contain any destructive code, but due to the limited level of authority, no liability may be caused by the loss of the corresponding control. Free use declaration: (I suggest you use this way) 1. You can use the DynamicGIF control free of charge to provide some technical support in public welfare. 2. If you declare that the DynamicGIF control is KQL work in the About dialog or help file, then thank you.
version upgrade:
2005/12/5 Version 1.1
The control adds an attribute, method:
Text attribute: This property can be used to store and express keywords corresponding to the expression, which is convenient when transmitting parsing :).
SetMaxSize method: Used to narrow the display image, make the interface more beautiful.