gpt4 book ai didi

visual-studio-2010 - 如何在vc++中创建密码字段和按钮

转载 作者:行者123 更新时间:2023-12-02 02:28:45 24 4
gpt4 key购买 nike

我是 vc++ 的新手,我的应用程序中需要一个密码字段。我使用以下代码创建了编辑文本框,但不知道如何创建密码字段和按钮控件。

CreateWindow(L"EDIT", L"hello", WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT |
ES_AUTOHSCROLL | ES_WANTRETURN, 350, 500, 130, 20, hwnd, NULL, NULL, NULL);

任何帮助将不胜感激。谢谢

最佳答案

尝试 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.

来源:Edit Control Styles

编辑

你是说创建一个按钮?通过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);

关于visual-studio-2010 - 如何在vc++中创建密码字段和按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4712330/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com