Taskbar program -02

xiaoxiao2021-03-06  38

People are really less, seeing very few people in the first part, this is the people who are popular! Grouped it. OK, continue to post.

For beginners, the system hotkey (Hotkey) seems to be a difficult technology, in fact in Delphi, can be easily completed. In accordance with this example, two Atom type global variables AF9 and AF10 are declared. VAR AF9, AF10: Atom

Drag and drop a webbrowser control on Form1 (in the Internet), the name is Web1. In the form of event create add the following code: procedure TForm1.FormCreate (Sender: TObject); begin aF9: = GlobalAddAtom ( 'MyhotkeyF9'); // define elements aF10: = GlobalAddAtom ( 'MyhotkeyF10'); RegisterHotKey (Handle, aF9, MOD_SHIFT, VK_F9); // Register Hotkey Shift F9 RegisterhotKey (Handle, AF10, MOD_SHIFT, VK_F10); // Register Hot Key Shift F10

END;

This defines the hotkey and the function of the corresponding hotkey is also required. For Windows Message Delivery Mechanism, please refer to the relevant book, I just talk about the means of Delphi. Add the following publicProcedure WMHOTKEYHANDLE (VAR MSG: TMESSAGE); Message WM_HOTKEY; / / Response Sensitive Key button message

Add: procedure tform1.wmhotkeyhandle (var msg: tmessage); begin if (msg.lparamhi = vk_f9) and (msg.lparamlo = mod_shift) THEN Web1.naviGate ('http: // appnews .qq.com / cgi-bin / news_qq_search? city = Changchun ') Else if (msg.lparamhi = vk_f10) and (msg.lparamlo = mod_shift) THEN SELF.CLOSE;

Try it, press SHIFT F9 to connect to the weather forecast; SHIFT F10 will exit.

So our sidebar already has a prototype, and there is still the beautiful clock. The BMPCLOCK control is a national, very good, just more expenses, it is easy to find online. You can also display digital clocks in what clocks or LEDs.

The last point is important to install a transparent control, put it on the top of Web1, so that there will be no hateful right-click menu. The source code of the transparent control is as follows (I am Yuzhan in 9CBS):

{Welcome to transparent control v1.0 development by Yuzhan (9CBS) inherited from TwinControl, the main function is to block some things that don't want others, but will still keep it.

UNIT TRANSPARENT;

Interface

Uses sysutils, classes, controls, windows;

Type TTRANSPARENT = Class (TwinControl) private {private declarations} protected

Public Constructor Create (Aowner: Tcomponent); Override; Procedure CreateParams; OVERRIDE; Published {Published Declarations} End; Procedure Register

IMPLEMentation

Constructor TTRANSPARENT.CREATE (AOWNER: TComponent); Begin ControlStyle: = ControlStyle - [Csopaque]; inherited;

procedure TTransparent.CreateParams (var Params: TCreateParams); begin inherited CreateParams (Params); with Params do begin {redrawn completely} Style: = Style and not WS_CLIPCHILDREN; Style: = Style and not WS_CLIPSIBLINGS; {increase transparent} ExStyle: = EXSTYLE or WS_EX_TRANSPARENT; END;

Procedure Register; Begin RegisterComponents ('Win32', [TTRANSPARENT]); END;

End.

转载请注明原文地址:https://www.9cbs.com/read-67389.html

New Post(0)