Developing Windows Screensavers with C++builder

Source: Internet
Author: User
Tags bool

Absrtact: This article demonstrates the implementation process of the screen saver under Windows by a specific program.

A Introduction

The screen saver under the Windows system is a command line based application. When the screensaver is invoked, the operating system executes the program with a specific command line. This article organizes and processes all of the command lines, including "/P", "/S,"/C ","/A "where"/p "means that the screensaver is displayed in the preview window,"/s "means that the screensaver is actually running,"/C "means the Invoke Settings dialog box, and"/a "means the Invoke Password Settings dialog box (invalid in Winnt). This program as simple as possible to achieve a fully functional screensaver, running Windows Screensaver Setup program when you can modify the password (invalid in Winnt) and you can set the picture display frequency and the frequency of the value of the register. When the screensaver is running, the picture changes the display position at the frequency you set. The author also left a job for the reader, please see figure 1 in the Select Picture folder this item, press the Browse button to set the path of the picture, the author has achieved the browsing button function and

The resulting path also saved to the registry, and let the screensaver start reading Picdir value, Picdir equals "No" when the author has been implemented, picdir not equal to "no" when the code is implemented by the reader. That is, let the reader implement a screensaver that can take turns showing the pictures in the Picdir directory.

Two Implementation methods

First, we introduce several API functions.

WinMain function:

int WINAPI WinMain (
HINSTANCE hinstance,//Current instance handle
HINSTANCE hPrevInstance,//Previous instance handle
LPSTR lpcmdline,//Pointer to command line arguments (parameters to be used by this program)
int ncmdshow//window state
);
GetWindowLong function: A function that gets the specified window information
LONG GetWindowLong (
HWND hwnd,//window/mouth handle
int nindex//Refer to the returned information
);
SetWindowLong function: Changing window properties
LONG SetWindowLong (
HWND hwnd,//window/mouth handle
int nindex,//specifying the value to set the information
LONG Dwnewlong//New value
);
setparent function: Change the parent window of the specified window
HWND SetParent (
HWND Hwndchild,//To/change the window handle of the parent form
Handle of the HWND hwndnewparent//new/parent form
);
GetClientRect function: Get the client area of the window
BOOL GetClientRect (
HWND hwnd,//Window handle
Address of lprect lprect//rect/structure
);
SetWindowPos function: Change window size, position, top-level window, etc.
BOOL SetWindowPos (
HWND hwnd,//Window handle
HWND Hwndinsertafter,//handle (Z order) for arranging window orders
int X,//Horizontal position
int Y,//Vertical position
int CX,//width
int CY,//height
UINT uflags//window Position etc mark
);
SystemParametersInfo function: Accessing or setting system-level parameters
BOOL SystemParametersInfo (
UINT uiaction,//Specify the system parameters to get or set
UINT Uiparam,//depends on action to be taken
PVOID Pvparam,//depends on action to be taken
UINT Fwinini//user Profile change tag
);
ShowCursor function: Show or hide the cursor
int ShowCursor (
BOOL bshow//mouse visibility marker
);
getversion function: Getting version information for the system
DWORD getversion (VOID)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.