Windows API note

Source: Internet
Author: User

In Windows programming, I remember that there are so many APIs that can be called.

Someone may say, check msdn, but I am not good at English. I can only see 7 points. Swollen. The following are all notes when I watch the video. Save it first.

 

 

 

 

Uint getdlgitemtext (// The text in the dialog box (edit) is saved to a place pointed by the character pointer.

Hwnd hdlg, // handle of the handle to dialog box

Int niddlgitem, // ID of the control identifier Control

Lptstr lpstring, // pointer to buffer for text
Address of the returned string

Int nmaxcount // maximum size of string the size of the character array

); // Returns the number of copied characters

Bool setdlgitemtext (// set the content in a dialog box (edit box)

Hwnd hdlg, // handle of the handle to dialog box

Int niddlgitem, // ID of the dialog box to be set by the control identifier

Lptstr lpstring // text to set string to be set

);

Int wsprintf (

Lptstr lpout, // output buffer output character buffer

Lpctstr lpfmt, // format-control string format input

... // Optional arguments

);

Char MSG [200];

Char * name = "name ";

Wsprintf (MSG, "% s hello", name); // print the content in the name array to msg

Hwnd getdlgitem (// get the handle of the window control

Hwnd hdlg, // handle of the handle to dialog box

Int niddlgitem // ID of the control identifier Control

);

// Return a handle

1. Add a string to the list box:

Combobox_addstring (// not a function, essentially a macro

Hwndctrl, // handle of the window control

STR // string to be added

);

Int combobox_insertstring (

Hwnd hwndctrl,/. Window handle

Int index, // Insert before Index

Lpcstr lpsz // The inserted content (string)

); // If the index is set to-1, it indicates insertion at the last position.

2. Select the currently selected items from the drop-down list.

Int combobox_getcursel (

Hwnd hwndctrl // The parameter is the control handle

);

3. delete an item from the drop-down list

Int combobox_deletestring (

Hwnd hwndctrl, // control handle

Int index // index number to be deleted

);

4. Retrieve the number of items in the drop-down list

Int combobox_getcount (

Hwnd hwndctrl // control handle

); // Number of returned items

5. Select an item

Int combobox_setcursel (

Hwnd hwndctrl, // control handle

Int index // index number to be selected, starting from 0

); // Set the index to-1 to cancel all selections.

6. Obtain the value of an item.

Int combobox_getlbtext (

Hwnd hwndctrl, // control handle

Int index, // Index Number of the item to be obtained

Lpctstr lpszbuffer // string buffer after this value is obtained

);

Set or create a Timer:

Uint_ptr settimer (

Hwnd, // window handle

Uint_ptr nidevent, // timer ID

Uint uelapse, // time interval in milliseconds, 1 S = 1000 ms

Timerproc lptimerfunc // callback function, the following timeproc (); can be set to null

);

Void callback timeproc (

Hwnd, // window handle

Uint message, // message

Uint itimerid, // the ID of the timer

DWORD dwtime // time

)

{

// Process wm_time

}

System Time struct:

Typedef struct _ systemtime {

Word wyear;

Word wmonth;

Word wdayofweek;

Word wday;

Word whour;

Word wminute;

Word wsecond;

Word wmilliseconds;

} Systemtime;

Obtain the current system time.

Void getlocaltime (

Lpsystemtime // system time struct pointer

);

Check whether the check button is selected

Lresult button_getcheck (

Hwnd hwndctl

);

Returned value: bst_checked

Bst_unchecked

Set whether or not the check button is selected

Lresult button_getcheck (

Hwnd hwndctl,

Int check

);

Returned value: bst_checked

Bst_unchecked

Listbox_addstring (// not a function, essentially a macro

Hwndctrl, // handle of the window control

STR // string to be added

);

ComboBox _ series above ....

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.