开发者

how to create password field and button in vc++

I am new in vc++ and i need a Password field in my application. I created edit textbox using below code but don't know how to create password field and button control.

CreateWindow(L"EDIT", L"hello", WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT |
ES_AUTOHSCR开发者_如何学编程OLL | ES_WANTRETURN, 350, 500, 130, 20, hwnd, NULL, NULL, NULL);

Any help would be grateful. thanks


Try ES_PASSWORD :

Displays an asterisk (*) for each character typed into the edit control. This style is valid only for single-line edit controls.

Windows XP: If the edit control is from user32.dll, the default password character is an asterisk. However, if the edit control is from comctl32.dll version 6, the default character is a black circle.

To change the characters that is displayed, or set or clear this style, use the EM_SETPASSWORDCHAR message.

Note Comctl32.dll version 6 is not redistributable but it is included in Windows XP or later. To use Comctl32.dll version 6, specify it in a manifest. For more information on manifests, see Enabling Visual Styles.

Source : Edit Control Styles

Edit

You mean creating a button ? Via Using Buttons :

     HWND hwndButton = CreateWindow( 
        L"BUTTON",   // Predefined class; Unicode assumed. 
        L"OK",       // Button text. 
        WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, 
        0,         // x position. 
        0,         // y position. 
        50,        // Button width.
        50,        // Button height.
        hwnd_parentwindow,
        NULL,       // No menu.
        (HINSTANCE)GetWindowLong(hwnd_parentwindow, GWL_HINSTANCE), 
        NULL); 


You can select the edit box and right click and choose its properties. In that there is an option called password. Just check it. Also this link will help you. http://msdn.microsoft.com/en-us/library/d3223ht2.aspx Or if you want you can directly add

ES_PASSWORD

also along with rest.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜