Common commands for vc and vc operations

Source: Internet
Author: User

Common commands for vc and vc operations

1. restart the computer:

ExitWindowsEx (EWX_REBOOT, 0 );

2. Shutdown:

ExitWindowsEx (EWX_SHUTDOWN, 0 );

3. logout:

ExitWindowsEx (EWX_LOGOFF, 0 );

4. screen lock:

LockWorkStation ();

5. Make the current program appear in the application bar:

ModifyStyleEx (WS_EX_APPWINDOW, WS_EX_TOOLWINDOW); // not displayed in the taskbar

6. Minimize programs to pallets;

Related API functions used: BOOL shell_policyicon (DWORD dwMessage, PNOTIFYICONDATA lpdata );

The dwMessage parameter is used to specify the actions of a tray. This is a four-byte value, as shown below:

1) NIM_ADD (0X00000000): Add a System Tray

2) NIM_MODIFY (0X00000001): System Tray Modification

3) NIM_DELETE (0X00000002): Delete the system tray

4) NIM_SETFOCUS (0X00000003): Focus on the system tray

5) NIM_SETVERSION (0X00000004): sets the version of the system tray.

The PNOTIFYICONDATA parameter is a special structure for this service. Its structure is as follows:

Typedef struct _ policyicondata

{

DWORD cbSize; // the size of the struct, in bytes.

HWND hWnd; // handle of this pallet Program

UNIT uID; // The ID allocated by the system for each icon in the tray Area

UNIT uFlags; // In short, it is a identifier

UNIT uCallbackMessage; // callback function. You need to define a message to receive a message that slides over or clicks the mouse.

HICON hIcon; // icon

TCHAR szTip [64]; // size of the prompt text

DWORD dwState; // The status of the icon

DWORD dwStateMask; // similar to the preceding

TCHAR szInfo [256]; // text displayed in the bubble notification

Union

{

UNIT uTimeout;

UNIT uVersion;

}

TCHAR szInfoTitle [64]; // the title of the bubble notification

DWORD dwInfoFlags; // modify the flag related to the bubble notification

GUID guidItem; // The GUID of the icon

HICON hBalloonIcon; // bubble notification icon

} NOTIFYICONDATA, * ppolicyicondata

Eg:

M_tnd.cbSize = sizeof (policyicondata );

M_tnd.hWnd = pWnd-> GetSafeHwnd ();

M_tnk.uID = uID;

M_tnd.hIcon = icon;

M_tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;

Strcpy (m_tnd.szTip, szToolTip );

// Set the tray icon

Shell_policyicon (NIM_ADD, & m_tnd );

    

Related Article

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.