The popularity here is really not prosperous. I will add a firewood, I hope to drive everyone's programs. This is my first time to write a tutorial, and everyone will bear more. I plan to write two times a Sidebar listed on the right side (Chinese name I don't know what to call, it seems to be a taskbar, because the main sense comes from the Desktop Sidebar program, you can read the weather forecast from the Internet, you can display the current clock Wait for basic functions (you can join your own feature). My programming environment is Windows 2003 Delphi 7. Other versions of Delphi and Windows I want to be no problem, please see attachments. I want a reader to take a little Delphi, mainly take care of some beginners twice. OK, Let's Go!
// ----------- Text start -------------------
I don't know if you have noticed it? In fact, the desktop (Desktop) and Form1 are all forms (Window), the difference is that the desktop is behind all windows, we can completely have this property that makes our own form.
Procedure TForm1.FormCreate (Sender: Tobject); Var HDesktop: Thandle; Begin HDESKTOP: = FindWindow ('Progman', 'Program Manager'); Windows.SetParent (Handle, HDesktop);
END;
Try it in accordance with the code above, see WIN D will minimize this FORM1 form to the taskbar? The answer is of course negative because it already has the same attribute as the desktop. This is one of the skills of this tutorial. Sidebar should rely on the right or elsewhere on the desktop, which is very simple in delphi. Set the borderstyle of Form1 in Object Inspector to bsnone; width is 195; in FormCreate, you are as follows:
Procedure TForm1.FormCreate (Sender: Tobject); Var HDesktop: Thandle; R: TRECT; Begin R: = Screen.DesktopRect; // Read Desktop Resolution Self.top: = 0; Self.Left: = R.right- R.Left-self.width; // On the right Self.Height: = R.Bottom -r.top; // and desktop contour
HDESKTOP: = FindWindow ('progman', 'program manager'); Windows.SetParent (Handle, HDesktop);
END;
It is fun to establish Sidebar against the right side (press Alt F2), very fun. This time, here, you will see you next time.