本文整理汇总了C++中GetDlgItemTextA函数的典型用法代码示例。如果您正苦于以下问题:C++ GetDlgItemTextA函数的具体用法?C++ GetDlgItemTextA怎么用?C++ GetDlgItemTextA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetDlgItemTextA函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DlgProc2
//反汇编对话框的消息处理
BOOL CALLBACK DlgProc2(HWND hdlg,UINT message,WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_INITDIALOG:
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case ID_OK:
{
char szStr[20];
GetDlgItemTextA(hdlg, IDC_EDIT1, szStr, 20);
StartAddress = atoi(szStr);
GetDlgItemTextA(hdlg, IDC_EDIT2, szStr, 20);
Size = atoi(szStr);
EndDialog(hdlg, 0);
}
break;
case ID_CLOSE:
EndDialog(hdlg, 0);
break;
}
}
return 0;
}
示例2: MainDlgProc
int WINAPI MainDlgProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
CHAR ExeFilePath[MAX_PATH] = {0};
CHAR SysFilePath[MAX_PATH] = {0};
if (message == WM_COMMAND)
{
if (wParam == IDOK)
{
if (GetDlgItemTextA(hWnd, IDC_PATH_EXE, ExeFilePath, MAX_PATH-1))
{
if (GetDlgItemTextA(hWnd, IDC_PATH_SYS, SysFilePath, MAX_PATH-1))
{
if (BuildDropper(ExeFilePath, SysFilePath))
{
MessageBoxA(hWnd, "OK", "OK", MB_OK);
}
}
}
return 0;
}
if (wParam == IDC_CHOSE_EXE)
{
char *file = OpenFileDialog("Executable files (*.exe)\0*.exe\0", hWnd);
if (file)
{
SetDlgItemText(hWnd, IDC_PATH_EXE, file);
delete file;
}
return 0;
}
if (wParam == IDC_CHOSE_SYS)
{
char *file = OpenFileDialog("Executable files (*.sys)\0*.sys\0", hWnd);
if (file)
{
SetDlgItemText(hWnd, IDC_PATH_SYS, file);
delete file;
}
return 0;
}
if (wParam == IDCANCEL)
{
return EndDialog(hWnd, 0), ExitProcess(0), 0;
}
}
return 0;
}
示例3: DlgProcContactInfo
INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwnd);
{
MCONTACT hContact = (MCONTACT)((PROPSHEETPAGE*)lParam)->lParam;
char name[2048];
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)hContact);
if (db_get_static(hContact, MODNAME, "Name", name, _countof(name)))
break;
SetDlgItemTextA(hwnd, IDC_DISPLAY_NAME, name);
if (db_get_static(hContact, MODNAME, "ToolTip", name, _countof(name)))
break;
SetDlgItemTextA(hwnd, IDC_TOOLTIP, name);
}
return TRUE;
case WM_COMMAND:
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
return TRUE;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->idFrom) {
case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_DISPLAY_NAME))) {
char text[512];
GetDlgItemTextA(hwnd, IDC_DISPLAY_NAME, text, _countof(text));
db_set_s(hContact, MODNAME, "Name", text);
WriteSetting(hContact, MODNAME, "Name", MODNAME, "Nick");
}
else {
db_unset(hContact, MODNAME, "Name");
db_unset(hContact, MODNAME, "Nick");
}
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_TOOLTIP))) {
char text[2048];
GetDlgItemTextA(hwnd, IDC_TOOLTIP, text, _countof(text));
db_set_s(hContact, MODNAME, "ToolTip", text);
WriteSetting(hContact, MODNAME, "ToolTip", "UserInfo", "MyNotes");
}
else {
db_unset(hContact, MODNAME, "ToolTip");
db_unset(hContact, "UserInfo", "MyNotes");
}
}
return TRUE;
}
break;
}
return FALSE;
}
示例4: PromptForInputDialogProc
static INT_PTR CALLBACK PromptForInputDialogProc(HWND dialogHandle, UINT message, WPARAM wParam, LPARAM lParam)
{
BOOL result = TRUE;
// Initialization
if (message == WM_INITDIALOG)
{
// Text initialization
TInputDialogInitInfo *pInfo = reinterpret_cast<TInputDialogInitInfo *>(lParam);
SetWindowTextA(dialogHandle, pInfo->get<1>().c_str());
SetDlgItemTextA(dialogHandle, IDC_PROMPT, pInfo->get<2>().c_str());
SetDlgItemTextA(dialogHandle, IDC_EDIT_CONTENT, pInfo->get<3>().c_str());
SetDlgItemTextA(dialogHandle, IDOK, pInfo->get<4>().c_str());
SetDlgItemTextA(dialogHandle, IDCANCEL, pInfo->get<5>().c_str());
}
// Clicked button
else if (message == WM_COMMAND)
{
// ID that triggered
UINT id = LOWORD(wParam);
// Clicked "OK" or "Cancel"
if (id == IDOK || id == IDCANCEL)
{
// TODO: Duplicate code.
SInputInfo *pInfo = reinterpret_cast<SInputInfo *>(malloc(sizeof(SInputInfo)));
if (pInfo)
{
pInfo->isOkClicked = (id == IDOK);
GetDlgItemTextA(dialogHandle, IDC_EDIT_CONTENT, pInfo->text, sizeof(pInfo->text));
}
EndDialog(dialogHandle, reinterpret_cast<INT_PTR>(pInfo));
}
}
// Clicked close
else if (message == WM_CLOSE)
{
// TODO: Duplicate code.
SInputInfo *pInfo = reinterpret_cast<SInputInfo *>(malloc(sizeof(SInputInfo)));
if (pInfo)
{
pInfo->isOkClicked = false;
GetDlgItemTextA(dialogHandle, IDC_EDIT_CONTENT, pInfo->text, sizeof(pInfo->text));
}
EndDialog(dialogHandle, reinterpret_cast<INT_PTR>(pInfo));
}
// Messages that not interested
else
{
result = FALSE;
}
return result;
}
示例5: GetSetting
VOID GetSetting(HWND hwnd)
{
int i;
CHAR buf[256];
for (i = 0; i < hack_argcount; i++)
{
GetDlgItemTextA(hwnd, IDC_ARGVAL00 + i, buf, 256);
sz_trim(buf);
switch (hack_arginfo[i].type)
{
case t_Bool:
if (lstrcmpiA(buf, "True") == 0 || lstrcmpiA(buf, "1") == 0 )
*(Bool *)hack_arginfo[i].data = True;
else if (lstrcmpiA(buf, "False") == 0 || lstrcmpiA(buf, "0") == 0 )
*(Bool *)hack_arginfo[i].data = False;
break;
case t_Int:
*(INT *)hack_arginfo[i].data = strtol(buf, NULL, 10);
break;
case t_Float:
*(float *)hack_arginfo[i].data = strtod(buf, NULL);
break;
case t_String:
*(char **)hack_arginfo[i].data = _strdup(buf);
break;
}
}
if (hack_count_enabled)
{
GetDlgItemTextA(hwnd, IDC_COUNTVAL, buf, 256);
sz_trim(buf);
ss.modeinfo.count = strtol(buf, NULL, 10);
}
if (hack_cycles_enabled)
{
GetDlgItemTextA(hwnd, IDC_CYCLESVAL, buf, 256);
sz_trim(buf);
ss.modeinfo.cycles = strtol(buf, NULL, 10);
}
if (hack_size_enabled)
{
GetDlgItemTextA(hwnd, IDC_SIZEVAL, buf, 256);
sz_trim(buf);
ss.modeinfo.size = strtol(buf, NULL, 10);
}
}
示例6: WaitForSingleObject
void upsStatus::Update(StatMgr *statmgr)
{
// Bail if window is not open
WaitForSingleObject(_mutex, INFINITE);
if (!_hwnd)
{
ReleaseMutex(_mutex);
return;
}
// Fetch full status from nutupsd
list<string> keys, values;
if (!statmgr->GetAll(keys, values) || keys.empty())
{
ReleaseMutex(_mutex);
return;
}
// Update listview
list<string>* data[] = {&keys, &values};
_grid->UpdateAll(data);
// Update battery
_bmeter->Set(atoi(statmgr->Get("battery.charge").c_str()));
// Update load
_lmeter->Set(atoi(statmgr->Get("ups.load").c_str()));
// Update status
char str[128];
string stat = statmgr->Get("ups.status");
GetDlgItemTextA(_hwnd, IDC_STATUS, str, sizeof(str));
if (stat != str)
SetDlgItemTextA(_hwnd, IDC_STATUS, stat.c_str());
// Update runtime
string runtime = statmgr->Get("battery.runtime");
GetDlgItemTextA(_hwnd, IDC_RUNTIME, str, sizeof(str));
if (runtime != str)
SetDlgItemTextA(_hwnd, IDC_RUNTIME, runtime.c_str());
// Update title bar
char name[512];
string upsname = statmgr->Get("UPS");
snprintf(name, sizeof(name), "Status for UPS: %s", upsname.c_str());
SetWindowTextA(_hwnd, name);
ReleaseMutex(_mutex);
}
示例7: GetDlgItemTextA
void ProjectConfigDialog::onSelectScriptFile(void)
{
char buff[MAX_PATH + 1] = {0};
char projdir[MAX_PATH + 1] = {0};
GetDlgItemTextA(m_hwndDialog, IDC_EDIT_PROJECT_DIR, projdir, MAX_PATH);
OPENFILENAMEA ofn = {0};
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = m_hwndDialog;
ofn.lpstrFilter = "Lua Script File (*.lua)\0*.lua\0";
ofn.lpstrTitle = "Select Script File";
if (DirectoryExists(projdir))
{
ofn.lpstrInitialDir = projdir;
}
ofn.Flags = OFN_DONTADDTORECENT | OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
ofn.lpstrFile = buff;
ofn.nMaxFile = MAX_PATH;
if (GetOpenFileNameA(&ofn))
{
m_project.setScriptFile(buff);
updateScriptFile();
}
}
示例8: AboutProc
LRESULT CALLBACK AboutProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM)
{
char buf[48];
DWORD d;
switch(message){
case WM_INITDIALOG:
setDlgTexts(hWnd, 11);
d=getVer();
sprintf(buf, "%d.%d", HIWORD(d), LOWORD(d));
SetDlgItemTextA(hWnd, 101, buf);
return TRUE;
case WM_COMMAND:
switch(wParam){
case IDOK:
case IDCANCEL:
EndDialog(hWnd, wParam);
return TRUE;
case 123:
GetDlgItemTextA(hWnd, wParam, buf, sizeA(buf)-13);
if(!_tcscmp(lang, _T("English"))) strcat(buf, "/indexEN.html");
ShellExecuteA(0, 0, buf, 0, 0, SW_SHOWNORMAL);
break;
}
break;
}
return FALSE;
}
示例9: dlogpassproc
INT CALLBACK
dlogpassproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_INITDIALOG:
SetDlgItemTextA(hwnd, 4, pd_filename);
return TRUE;
case WM_COMMAND:
switch(wParam)
{
case 1:
pd_okay = 1;
GetDlgItemTextA(hwnd, 3, pd_password, sizeof pd_password);
EndDialog(hwnd, 1);
return TRUE;
case 2:
pd_okay = 0;
EndDialog(hwnd, 1);
return TRUE;
}
break;
}
return FALSE;
}
示例10: JabbeSearchrRenewFields
static int JabbeSearchrRenewFields(HWND hwndDlg, JabberSearchData * dat)
{
char szServerName[100];
EnableWindow(GetDlgItem(hwndDlg, IDC_GO),FALSE);
GetDlgItemTextA(hwndDlg,IDC_SERVER,szServerName,sizeof(szServerName));
dat->CurrentHeight = 0;
dat->curPos = 0;
SetScrollPos( GetDlgItem( hwndDlg, IDC_VSCROLL ), SB_CTL, 0, FALSE );
JabberSearchFreeData( hwndDlg, dat );
JabberSearchRefreshFrameScroll( hwndDlg, dat );
if ( jabberOnline )
SetDlgItemText(hwndDlg,IDC_INSTRUCTIONS,TranslateT("Please wait...\r\nConnecting search server..."));
else
SetDlgItemText(hwndDlg,IDC_INSTRUCTIONS,TranslateT("You have to be connected to server"));
if ( !jabberOnline )
return 0;
searchHandleDlg = hwndDlg;
int iqId = JabberSerialNext();
XmlNodeIq iq( "get", iqId, szServerName );
XmlNode* query = iq.addChild( "query" );
query->addAttr( "xmlns", "jabber:iq:search" );
JabberIqAdd( iqId, IQ_PROC_GETSEARCHFIELDS, JabberIqResultGetSearchFields );
JabberSend( jabberThreadInfo->s, iq );
return iqId;
}
示例11: Window_StopwatchExportDlg
static INT_PTR CALLBACK Window_StopwatchExportDlg(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
(void)lParam; // unused
switch(msg) {
case WM_INITDIALOG:{
wchar_t buf[128];
api.GetStr(L"Timers", L"SwExT", buf, _countof(buf), L"");
SetDlgItemText(hDlg,IDC_SWE_TOTAL,buf);
api.GetStr(L"Timers", L"SwExL", buf, _countof(buf), L"");
SetDlgItemText(hDlg, IDC_SWE_LAP, buf);
SendMessage(hDlg, WM_COMMAND,IDOK, 0);
Edit_SetSel(GetDlgItem(hDlg,IDC_SWE_OUT), 0, -1);
SetFocus(GetDlgItem(hDlg,IDC_SWE_OUT));
return FALSE;}
case WM_DESTROY:{
break;}
case WM_COMMAND: {
switch(LOWORD(wParam)) {
case IDC_SWE_EXPORT:{
wchar_t filename[MAX_PATH];
unsigned buflen = (unsigned)SendDlgItemMessageA(hDlg,IDC_SWE_OUT,WM_GETTEXTLENGTH,0,0);
char* buf = malloc(buflen + 1);
if(buf && buflen){
GetDlgItemTextA(hDlg, IDC_SWE_OUT, buf, buflen+1);
*filename = '\0';
if(SaveFileDialog(hDlg,filename,_countof(filename))){
FILE* fp = _wfopen(filename, L"wb");
if(fp){
fwrite(buf, sizeof(buf[0]), buflen, fp);
fclose(fp);
}
}
}
free(buf);
break;}
case IDOK:{
wchar_t buf[128];
GetDlgItemText(hDlg, IDC_SWE_TOTAL, buf, _countof(buf));
if(!*buf){
api.DelValue(L"Timers", L"SwExT");
SetDlgItemText(hDlg, IDC_SWE_TOTAL, L"\\n--------------------\\n\\t");
}else
api.SetStr(L"Timers", L"SwExT", buf);
GetDlgItemText(hDlg, IDC_SWE_LAP, buf, _countof(buf));
if(!*buf){
api.DelValue(L"Timers", L"SwExL");
SetDlgItemText(hDlg, IDC_SWE_LAP, L"Lap \\#\\f: \\l (\\t)\\n");
}else
api.SetStr(L"Timers", L"SwExL", buf);
export_text(hDlg);
break;}
case IDCANCEL:
EndDialog(hDlg, TRUE);
}
return TRUE;
}
}
return FALSE;
}
示例12: searchPackTLVWordLNTS
static void searchPackTLVWordLNTS(PBYTE *buf, int *buflen, HWND hwndDlg, UINT idControl, WORD w, WORD wType)
{
char str[512];
GetDlgItemTextA(hwndDlg, idControl, str, sizeof(str));
ppackLETLVWordLNTS(buf, buflen, w, str, wType, 0);
}
示例13: PwConfirmDlgProc
static INT_PTR CALLBACK PwConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
PwConfirmDlgParam* dat = (PwConfirmDlgParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch(msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
SendDlgItemMessage(hwndDlg,IDC_PASSWORD,EM_LIMITTEXT,15,0);
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDOK:
{
char szTest[16];
GetDlgItemTextA(hwndDlg,IDC_OLDPASS,szTest,sizeof(szTest));
if (strcmpnull(szTest, dat->ppro->GetUserPassword(TRUE)))
{
MessageBox(hwndDlg, TranslateT("The password does not match your current password. Check Caps Lock and try again."), TranslateT("Change ICQ Details"), MB_OK);
SendDlgItemMessage(hwndDlg,IDC_OLDPASS,EM_SETSEL,0,(LPARAM)-1);
SetFocus(GetDlgItem(hwndDlg,IDC_OLDPASS));
break;
}
GetDlgItemTextA(hwndDlg,IDC_PASSWORD,szTest,sizeof(szTest));
if(strcmpnull(szTest, dat->Pass))
{
MessageBox(hwndDlg, TranslateT("The password does not match the password you originally entered. Check Caps Lock and try again."), TranslateT("Change ICQ Details"), MB_OK);
SendDlgItemMessage(hwndDlg,IDC_PASSWORD,EM_SETSEL,0,(LPARAM)-1);
SetFocus(GetDlgItem(hwndDlg,IDC_PASSWORD));
break;
}
}
case IDCANCEL:
EndDialog(hwndDlg,wParam);
break;
}
break;
}
return FALSE;
}
示例14: PreTranslateMessage
// 먼저 한번 거르고 메시지 처리
void PreTranslateMessage(LPMSG msg){
if (msg->message == WM_KEYUP)
{
switch (msg->wParam)
{
case VK_RETURN:
if (GetFocus() == _hwMemo){
GetDlgItemTextA(_hw, EDIT1, buffer2, sizeof(buffer2));
if (strlen(buffer2) != 0){
//ID
string a = buffer2;
GetDlgItemTextA(_hw, EDIT4, buffer2, sizeof(buffer2));
string b = buffer2;
a = b + ": " + a;
MyMessObj.SendMessagePort(a);
g_pChatMgr->setInputString(">");
SetWindowText(GetDlgItem(_hw, EDIT1), L"");
}
else {
g_pChatMgr->setInputString("");
//SetFocus(_hw);
}
break;
//return;/*i don't want this message to reach the procedures anway*/
}
case VK_ESCAPE:
g_pChatMgr->setInputString("");
SetFocus(_hw);
break;
default:
if (GetFocus() == _hwMemo){
GetDlgItemTextA(_hw, EDIT1, buffer3, sizeof(buffer3));
string input = buffer3;
input = ">" + input;
g_pChatMgr->setInputString(input);
}
break;
}
}
TranslateMessage(msg);
DispatchMessage(msg);
}
示例15: UT_return_val_if_fail
UT_UTF8String AP_Win32Dialog_GenericInput::_getText(HWND hWnd, int nID)
{
UT_return_val_if_fail(hWnd, UT_UTF8String());
const int buflen = 4096;
char szBuff[buflen];
*szBuff=0;
GetDlgItemTextA(hWnd, nID, szBuff, buflen);
szBuff[buflen-1] = '\0';
return AP_Win32App::s_fromWinLocaleToUTF8(szBuff);
}