Edit Control Message APIs for Windows X. h

Source: Internet
Author: User

Generally, you need to convert the ID defined in resource to hwnd. The most common function is the getdlgitem () function!

When writing the SDK program, you must obtain the content in the editbox. There are multiple methods:
Here I will introduce two topics:
1. Use getdlgitemtext
Eg:
Getdlgitemtext (hwnd, idc_edit_oldname, szoldname, max_path );

2. Use the macro edit_gettext (hwndedit,) in windowsx. h ,,,)
Here we need to convert resourceid to hwnd
Eg:
Edit_gettext (getdlgitem (hwnd, idc_edit_oldname), szoldname, max_path );

 

 

Other Edit Control Message APIs

# Define edit_enable (hwndctl, fenable) enablewindow (hwndctl), (fenable ))

# Define edit_gettext (hwndctl, lpch, cchmax) getwindowtext (hwndctl), (lpch), (cchmax ))
# Define edit_gettextlength (hwndctl) getwindowtextlength (hwndctl)
# Define edit_settext (hwndctl, lpsz) setwindowtext (hwndctl), (lpsz ))

# Define edit_limittext (hwndctl, cchmax) (void) sndmsg (hwndctl), em_limittext, (wparam) (cchmax), 0l ))

# Define edit_getlinecount (hwndctl) (INT) (DWORD) sndmsg (hwndctl), em_getlinecount, 0l, 0l ))
# Ifndef _ Mac
# Define edit_getline (hwndctl, line, lpch, cchmax) (* (int *) (lpch) = (cchmax), (INT) (DWORD) sndmsg (hwndctl), em_getline, (wparam) (INT) (line), (lparam) (lptstr) (lpch ))))
# Else
# Define edit_getline (hwndctl, line, lpch, cchmax) (* (word *) (lpch) = (cchmax), (INT) (DWORD) sndmsg (hwndctl), em_getline, (wparam) (INT) (line), (lparam) (lptstr) (lpch ))))
# Endif

# Define edit_getrect (hwndctl, LPRC) (void) sndmsg (hwndctl), em_getrect, 0l, (lparam) (rect *) (LPRC )))
# Define edit_setrect (hwndctl, LPRC) (void) sndmsg (hwndctl), em_setrect, 0l, (lparam) (const rect *) (LPRC )))
# Define edit_setrectnopaint (hwndctl, LPRC) (void) sndmsg (hwndctl), em_setrectnp, 0l, (lparam) (const rect *) (LPRC )))

# Define edit_getsel (hwndctl) (DWORD) sndmsg (hwndctl), em_getsel, 0l, 0l ))
# Define edit_setsel (hwndctl, ichstart, ichend) (void) sndmsg (hwndctl), em_setsel, (ichstart), (ichend )))
# Define edit_replacesel (hwndctl, lpszreplace) (void) sndmsg (hwndctl), em_replacesel, 0l, (lparam) (lpctstr) (lpszreplace )))

# Define edit_getmodify (hwndctl) (bool) (DWORD) sndmsg (hwndctl), em_getmodify, 0l, 0l ))
# Define edit_setmodify (hwndctl, fmodified) (void) sndmsg (hwndctl), em_setmodify, (wparam) (uint) (fmodified), 0l ))

# Define edit_scrollcaret (hwndctl) (bool) (DWORD) sndmsg (hwndctl), em_scrollcaret, 0, 0l ))

# Define edit_linefromchar (hwndctl, ich) (INT) (DWORD) sndmsg (hwndctl), em_linefromchar, (wparam) (INT) (ICH), 0l ))
# Define edit_lineindex (hwndctl, line) (INT) (DWORD) sndmsg (hwndctl), em_lineindex, (wparam) (INT) (line), 0l ))
# Define edit_linelength (hwndctl, line) (INT) (DWORD) sndmsg (hwndctl), em_linelength, (wparam) (INT) (line), 0l ))

# Define edit_scroll (hwndctl, DV, DH) (void) sndmsg (hwndctl), em_linescroll, (wparam) (DH), (lparam) (DV )))

# Define edit_canundo (hwndctl) (bool) (DWORD) sndmsg (hwndctl), em_canundo, 0l, 0l ))
# Define edit_undo (hwndctl) (bool) (DWORD) sndmsg (hwndctl), em_undo, 0l, 0l ))
# Define edit_emptyundobuffer (hwndctl) (void) sndmsg (hwndctl), em_emptyundobuffer, 0l, 0l ))

# Define edit_setpasswordchar (hwndctl, CH) (void) sndmsg (hwndctl), em_setpasswordchar, (wparam) (uint) (CH), 0l ))

# Define edit_settabstops (hwndctl, ctabs, lptabs) (void) sndmsg (hwndctl), em_settabstops, (wparam) (INT) (ctabs), (lparam) (const int *) (lptabs )))

# Define edit_fmtlines (hwndctl, faddeol) (bool) (DWORD) sndmsg (hwndctl), em_fmtlines, (wparam) (bool) (faddeol), 0l ))

# Define edit_gethandle (hwndctl) (hlocal) (uint_ptr) sndmsg (hwndctl), em_gethandle, 0l, 0l ))
# Define edit_sethandle (hwndctl, H) (void) sndmsg (hwndctl), em_sethandle, (wparam) (uint_ptr) (hlocal) (h), 0l ))

# If (winver> = 0x030a)
# Define edit_getfirstvisibleline (hwndctl) (INT) (DWORD) sndmsg (hwndctl), em_getfirstvisibleline, 0l, 0l ))

# Define edit_setreadonly (hwndctl, freadonly) (bool) (DWORD) sndmsg (hwndctl), em_setreadonly, (wparam) (bool) (freadonly), 0l ))

# Define edit_getpasswordchar (hwndctl) (tchar) (DWORD) sndmsg (hwndctl), em_getpasswordchar, 0l, 0l ))

# Define edit_setwordbreakproc (hwndctl, lpfnwordbreak) (void) sndmsg (hwndctl), expires, 0l, (lparam) (editwordbreakproc) (lpfnwordbreak )))
# Define edit_getwordbreakproc (hwndctl) (editwordbreakproc) sndmsg (hwndctl), em_getwordbreakproc, 0l, 0l ))
# Endif/* winver> = 0x030a */

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.