本文整理汇总了C++中SetDlgItemTextA函数的典型用法代码示例。如果您正苦于以下问题:C++ SetDlgItemTextA函数的具体用法?C++ SetDlgItemTextA怎么用?C++ SetDlgItemTextA使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetDlgItemTextA函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetDlgItemTextA
BOOL CDlgLinkProperties::OnInitDialog()
{
CDialog::OnInitDialog();
std::map<int, DTALinkType>:: const_iterator itr;
for(itr = m_pDoc->m_LinkTypeMap.begin(); itr != m_pDoc->m_LinkTypeMap.end(); itr++)
{
CString str;
str.Format("%d,%s",itr->first,itr->second .link_type_name.c_str ());
m_LinkTypeComboBox.AddString (str);
if(LinkType == itr->first)
{
m_LinkTypeComboBox.SetCurSel (m_LinkTypeComboBox.GetCount ()-1);
}
}
SetDlgItemTextA(IDC_STATIC_UNIT_SPEED_LIMIT,"distance unit/hour");
SetDlgItemTextA(IDC_STATIC_UNIT_DENSITY,"(veh/distance/ln)");
EnableDataBasedOnLinkType();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例2: dialogPasswordCallback
/*********************************************************
*NAME: dialogPasswordCallback
*AUTHOR: John Morrison
*CREATION DATE: 24/1/99
*LAST MODIFIED: 29/4/00
*PURPOSE:
* The Opening Dialog call back function.
*
*ARGUMENTS:
* hWnd - Handle to the window
* msg - The message
* wParam - Message parameters
* lParam - More Message parameters
*********************************************************/
BOOL CALLBACK dialogPasswordCallback( HWND hWnd, unsigned uMsg, WPARAM wParam, LPARAM lParam ) {
char pass[MAP_STR_SIZE]; /* The password to get */
switch ( uMsg ) {
case WM_INITDIALOG:
/* Set languages */
SetWindowTextA(hWnd, langGetText(STR_DLGPASSWORD_TITLE));
SetDlgItemTextA(hWnd, IDC_BLURB, langGetText(STR_DLGPASSWORD_BLURB));
SetDlgItemTextA(hWnd, IDOK, langGetText(STR_OK));
SetFocus(GetDlgItem(hWnd, IDC_PASSWORD));
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
GetDlgItemText(hWnd, IDC_PASSWORD, pass, (sizeof(pass)));
gameFrontSetGameOptions(pass, gameOpen, FALSE, FALSE, 0, 0, TRUE);
EndDialog(hWnd, TRUE);
break;
}
break;
case WM_PAINT:
break;
case WM_DESTROY:
break;
}
return FALSE;
}
示例3: switch
bool CDVSAboutPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg) {
case WM_INITDIALOG: {
#ifdef _VSMOD
SetDlgItemTextA( m_Dlg, IDC_VERSION, "DirectVobSub 2.40."MAKE_STR(MPC_VERSION_PATCH)"."MAKE_STR(MPC_VERSION_REV)" "MAKE_STR(VERSION_ARCH)", MOD\nCopyright 2001-2011 MPC-HC & VSFilterMod Teams" );
#else
SetDlgItemTextA( m_Dlg, IDC_VERSION, "DirectVobSub 2.40."MAKE_STR(MPC_VERSION_PATCH)"."MAKE_STR(MPC_VERSION_REV)" "MAKE_STR(VERSION_ARCH)"\nCopyright 2001-2011 MPC-HC Team" );
#endif
}
break;
case WM_COMMAND: {
switch(HIWORD(wParam)) {
case BN_CLICKED: {
if(LOWORD(wParam) == IDC_HOMEPAGEBTN) {
AFX_MANAGE_STATE(AfxGetStaticModuleState());
ShellExecute(m_Dlg, _T("open"), ResStr(IDS_URL_HOMEPAGE), NULL, NULL, SW_SHOWNORMAL);
return(true);
} else if(LOWORD(wParam) == IDC_BUGREPORTBTN) {
AFX_MANAGE_STATE(AfxGetStaticModuleState());
ShellExecute(m_Dlg, _T("open"), ResStr(IDS_URL_EMAIL), NULL, NULL, SW_SHOWNORMAL);
return(true);
}
}
break;
}
}
break;
}
return(false);
}
示例4: MraAvatarsQueueDlgProcOpts
INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
CMraProto *ppro = (CMraProto*)GetWindowLongPtr(hWndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hWndDlg);
SetWindowLongPtr(hWndDlg, GWLP_USERDATA, lParam);
ppro = (CMraProto*)lParam;
{
CheckDlgButton(hWndDlg, IDC_ENABLE, db_get_b(NULL, MRA_AVT_SECT_NAME, "Enable", MRA_AVT_DEFAULT_ENABLE));
CMStringW szServer;
if (DB_GetStringW(NULL, MRA_AVT_SECT_NAME, "Server", szServer))
SetDlgItemText(hWndDlg, IDC_SERVER, szServer.c_str());
else
SetDlgItemTextA(hWndDlg, IDC_SERVER, MRA_AVT_DEFAULT_SERVER);
SetDlgItemInt(hWndDlg, IDC_SERVERPORT, db_get_dw(NULL, MRA_AVT_SECT_NAME, "ServerPort", MRA_AVT_DEFAULT_SERVER_PORT), FALSE);
CheckDlgButton(hWndDlg, IDC_USE_KEEPALIVE_CONN, db_get_b(NULL, MRA_AVT_SECT_NAME, "UseKeepAliveConn", MRA_AVT_DEFAULT_USE_KEEPALIVE_CONN));
SetDlgItemInt(hWndDlg, IDC_UPD_CHECK_INTERVAL, db_get_dw(NULL, MRA_AVT_SECT_NAME, "CheckInterval", MRA_AVT_DEFAULT_CHK_INTERVAL), FALSE);
CheckDlgButton(hWndDlg, IDC_RETURN_ABC_PATH, db_get_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", MRA_AVT_DEFAULT_RET_ABC_PATH));
CheckDlgButton(hWndDlg, IDC_DELETE_AVT_ON_CONTACT_DELETE, db_get_b(NULL, MRA_AVT_SECT_NAME, "DeleteAvtOnContactDelete", MRA_DELETE_AVT_ON_CONTACT_DELETE));
EnableControlsArray(hWndDlg, (WORD*)&wMraAvatarsControlsList, SIZEOF(wMraAvatarsControlsList), IsDlgButtonChecked(hWndDlg, IDC_ENABLE));
}
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDC_ENABLE)
EnableControlsArray(hWndDlg, (WORD*)&wMraAvatarsControlsList, SIZEOF(wMraAvatarsControlsList), IsDlgButtonChecked(hWndDlg, IDC_ENABLE));
if (LOWORD(wParam) == IDC_BUTTON_DEFAULT) {
SetDlgItemTextA(hWndDlg, IDC_SERVER, MRA_AVT_DEFAULT_SERVER);
SetDlgItemInt(hWndDlg, IDC_SERVERPORT, MRA_AVT_DEFAULT_SERVER_PORT, FALSE);
}
if ((LOWORD(wParam) == IDC_SERVER || LOWORD(wParam) == IDC_SERVERPORT || LOWORD(wParam) == IDC_UPD_CHECK_INTERVAL) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return FALSE;
SendMessage(GetParent(hWndDlg), PSM_CHANGED, 0, 0);
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
db_set_b(NULL, MRA_AVT_SECT_NAME, "Enable", IsDlgButtonChecked(hWndDlg, IDC_ENABLE));
db_set_b(NULL, MRA_AVT_SECT_NAME, "DeleteAvtOnContactDelete", IsDlgButtonChecked(hWndDlg, IDC_DELETE_AVT_ON_CONTACT_DELETE));
db_set_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", IsDlgButtonChecked(hWndDlg, IDC_RETURN_ABC_PATH));
db_set_dw(NULL, MRA_AVT_SECT_NAME, "CheckInterval", GetDlgItemInt(hWndDlg, IDC_UPD_CHECK_INTERVAL, NULL, FALSE));
db_set_b(NULL, MRA_AVT_SECT_NAME, "UseKeepAliveConn", IsDlgButtonChecked(hWndDlg, IDC_USE_KEEPALIVE_CONN));
db_set_dw(NULL, MRA_AVT_SECT_NAME, "ServerPort", GetDlgItemInt(hWndDlg, IDC_SERVERPORT, NULL, FALSE));
TCHAR szServer[MAX_PATH];
GetDlgItemText(hWndDlg, IDC_SERVER, szServer, SIZEOF(szServer));
db_set_ts(NULL, MRA_AVT_SECT_NAME, "Server", szServer);
return TRUE;
}
break;
}
return FALSE;
}
示例5: ErrorDlgProc
BOOL CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
struct ErrorWindowData *ewd = (struct ErrorWindowData *) GetWindowLong(hwndDlg, GWL_USERDATA);
//if (ewd==NULL && msg!=WM_INITDIALOG) return FALSE;
switch (msg) {
case WM_INITDIALOG:
{
RECT rc, rcParent;
char caption[2048];
ewd = (struct ErrorWindowData *) lParam;
SetWindowLong(hwndDlg, GWL_USERDATA, (LONG) ewd);
TranslateDialogDefault(hwndDlg);
if (ewd != NULL) {
if (!ewd->szDescription)
ewd->szDescription = strdup(Translate("An unknown error has occured."));
if (!ewd->szText)
ewd->szText = strdup("");
if (!ewd->szName)
ewd->szName = strdup("");
SetDlgItemTextA(hwndDlg, IDC_ERRORTEXT, ewd->szDescription);
#if defined( _UNICODE )
SetDlgItemTextW(hwndDlg, IDC_MSGTEXT, (TCHAR *)(ewd->szText + strlen(ewd->szText) + 1));
#else
SetDlgItemTextA(hwndDlg, IDC_MSGTEXT, ewd->szText);
#endif
sprintf(caption, "%s - %s", Translate("Send Error"), ewd->szName);
SetWindowTextA(hwndDlg, caption);
GetWindowRect(hwndDlg, &rc);
GetWindowRect(ewd->hwndParent, &rcParent);
SetWindowPos(hwndDlg, HWND_TOP, rcParent.left + (rcParent.right - rcParent.left - rc.right + rc.left) / 2, rcParent.top + (rcParent.bottom - rcParent.top - rc.bottom + rc.top), 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
}
}
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
SendMessage(ewd->hwndParent, DM_ERRORDECIDED, MSGERROR_RETRY, (LPARAM) ewd);
DestroyWindow(hwndDlg);
break;
case IDCANCEL:
SendMessage(ewd->hwndParent, DM_ERRORDECIDED, MSGERROR_CANCEL, (LPARAM) ewd);
DestroyWindow(hwndDlg);
break;
}
break;
case WM_DESTROY:
SetWindowLong(hwndDlg, GWL_USERDATA, (LONG) NULL);
free(ewd->szName);
free(ewd->szDescription);
free(ewd->szText);
free(ewd);
break;
}
return FALSE;
}
示例6: 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;
}
示例7: DisplayPackInfo
static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack)
{
/* locale string */
if (!(pack->flags & LPF_NOLOCALE)) {
TCHAR szLocaleName[128];
szLocaleName[0] = _T('\0');
/* can't use LOCALE_SNAME as it is not present on pre WinVista */
if (!GetLocaleInfo(pack->Locale, LOCALE_SISO639LANGNAME, szLocaleName, SIZEOF(szLocaleName))) { /* Win98/NT4+ */
if (!GetLocaleInfo(pack->Locale, LOCALE_SLANGUAGE, szLocaleName, SIZEOF(szLocaleName))) /* not unique! */
szLocaleName[0] = _T('\0');
}
else {
if (GetLocaleInfo(pack->Locale, LOCALE_SISO3166CTRYNAME, &szLocaleName[3], SIZEOF(szLocaleName) - 3)) /* Win98/NT4+ */
szLocaleName[2] = _T('-');
}
/* add some note if its incompatible */
if (szLocaleName[0]) {
if (!IsValidLocale(pack->Locale, LCID_INSTALLED)) {
TCHAR *pszIncompat;
pszIncompat = TranslateT("(incompatible)");
szLocaleName[SIZEOF(szLocaleName) - lstrlen(pszIncompat) - 1] = 0;
lstrcat(lstrcat(szLocaleName, _T(" ")), pszIncompat); /* buffer safe */
}
SetDlgItemText(hwndDlg, IDC_LANGLOCALE, szLocaleName);
}
else SetDlgItemText(hwndDlg, IDC_LANGLOCALE, TranslateT("Unknown"));
}
else SetDlgItemText(hwndDlg, IDC_LANGLOCALE, TranslateT("Current"));
/* file date */
SYSTEMTIME stFileDate;
TCHAR szDate[128];
szDate[0] = _T('\0');
if (FileTimeToSystemTime(&pack->ftFileDate, &stFileDate))
GetDateFormat((LCID)CallService(MS_LANGPACK_GETLOCALE, 0, 0), DATE_SHORTDATE, &stFileDate, NULL, szDate, SIZEOF(szDate));
SetDlgItemText(hwndDlg, IDC_LANGDATE, szDate);
/* version */
SetDlgItemTextA(hwndDlg, IDC_LANGVERSION, pack->szVersion);
if (pack->szVersion[0] && pack->szFLName[0]) {
if (!IsWindowVisible(GetDlgItem(hwndDlg, IDC_LANGVERSIONLABEL))) {
ShowWindow(GetDlgItem(hwndDlg, IDC_LANGVERSIONLABEL), SW_SHOW);
ShowWindow(GetDlgItem(hwndDlg, IDC_LANGVERSION), SW_SHOW);
}
}
else {
ShowWindow(GetDlgItem(hwndDlg, IDC_LANGVERSIONLABEL), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_LANGVERSION), SW_HIDE);
}
/* general */
SetDlgItemTextA(hwndDlg, IDC_LANGMODUSING, pack->szLastModifiedUsing);
SetDlgItemTextA(hwndDlg, IDC_LANGAUTHORS, pack->szAuthors);
SetDlgItemTextA(hwndDlg, IDC_LANGEMAIL, pack->szAuthorEmail);
SetDlgItemText(hwndDlg, IDC_LANGINFOFRAME, TranslateTS(pack->szLanguage));
}
示例8: 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;
}
示例9: VCP_UI_CopyStart
static RETERR16 VCP_UI_CopyStart(void)
{
LPCVOID template32;
char buf[256]; /* plenty */
BOOL dirty;
DWORD len;
/* FIXME: should be registered at DLL startup instead */
VCP_UI_RegisterProgressClass();
if (!(VCP_UI_GetDialogTemplate(&template32)))
return VCPN_FAIL;
if (vn_num > 10) /* hack */
{
hDlgCopy = CreateDialogIndirectParamA(SETUPAPI_hInstance, template32, 0,
VCP_UI_FileCopyDlgProc, 0);
if (!hDlgCopy)
return VCPN_FAIL;
SetDlgItemTextA(hDlgCopy, SOURCESTRORD, "Scanning ...");
SetDlgItemTextA(hDlgCopy, DESTSTRORD, "NOT_IMPLEMENTED_YET");
}
strcpy(buf, REG_INSTALLEDFILES);
if (RegCreateKeyA(HKEY_LOCAL_MACHINE, buf, &hKeyFiles))
return VCPN_FAIL;
strcat(buf, REGPART_RENAME);
if (RegCreateKeyA(HKEY_LOCAL_MACHINE, buf, &hKeyRename))
return VCPN_FAIL;
if (RegCreateKeyA(HKEY_LOCAL_MACHINE, REG_VERSIONCONFLICT, &hKeyConflict))
return VCPN_FAIL;
len = 1;
if (!(RegQueryValueExA(hKeyConflict, "Dirty", NULL, 0, (LPBYTE)&dirty, &len)))
{
/* FIXME: what does SETUPX.DLL do in this case ? */
MESSAGE("Warning: another program using SETUPX is already running ! Failed.\n");
return VCPN_FAIL;
}
dirty = TRUE;
if (RegSetValueExA(hKeyConflict, "Dirty", 0, REG_BINARY, (LPBYTE)&dirty, 1))
return VCPN_FAIL;
len = 12;
if (!(RegQueryValueExA(hKeyConflict, "BackupDirectory", NULL, 0, (LPBYTE)BackupDir, &len)))
strcpy(BackupDir, "VCM");
/* create C:\WINDOWS\[BackupDir] and set registry key to it */
GetWindowsDirectoryA(buf, 256);
strcat(buf, "\\");
strcat(buf, BackupDir);
if (!(CreateDirectoryA(buf, NULL)))
return VCPN_FAIL;
if (RegSetValueExA(hKeyConflict, "BackupDirectory", 0, REG_SZ, (LPBYTE)buf, strlen(buf)+1))
return VCPN_FAIL;
RegCloseKey(hKeyConflict);
return VCPN_OK;
}
示例10: VwOnInit
// Initialization
void VwOnInit(HWND hWnd)
{
inited = false;
if (IsSupportedOs() == false)
{
// The OS is unsupported
Hide(hWnd, P_PROGRESS);
SetDlgItemTextA(hWnd, S_INFO, msgNotSupported);
return;
}
if(data.VpnServerManagerMode == FALSE)
{
SetText(hWnd, S_INFO2, msgStartTextForVpnClient);
SetText(hWnd, B_START, msgButtonForVpnClient);
}
else
{
SetText(hWnd, S_INFO2, msgStartTextForVpnServer);
SetText(hWnd, B_START, msgButtonForVpnServer);
}
if (lstrlen(data.InstallerExeUrl) == 0 || lstrlen(data.InstallerInfUrl) == 0)
{
// Parameter is not specified
Hide(hWnd, P_PROGRESS);
SetDlgItemTextA(hWnd, S_INFO, msgNoParam);
return;
}
if (data.VpnServerManagerMode == FALSE)
{
Show(hWnd, S_ICON_VPN);
Hide(hWnd, S_ICON_SERVER);
}
else
{
Show(hWnd, S_ICON_SERVER);
Hide(hWnd, S_ICON_VPN);
}
Hide(hWnd, P_PROGRESS);
Hide(hWnd, S_INFO);
Show(hWnd, S_INFO2);
Show(hWnd, B_START);
clicked_flag = false;
Zero(&task, sizeof(task));
}
示例11: 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);
}
示例12: dlogaboutproc
INT CALLBACK
dlogaboutproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_INITDIALOG:
SetDlgItemTextA(hwnd, 2, pdfapp_version(&gapp));
SetDlgItemTextA(hwnd, 3, pdfapp_usage(&gapp));
return TRUE;
case WM_COMMAND:
EndDialog(hwnd, 1);
return TRUE;
}
return FALSE;
}
示例13: else
void ALERT::OnClickList1(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
// TODO: Add your control notification handler code here
CListCtrl *pListctrl = (CListCtrl *)GetDlgItem(IDC_LIST1);
if (pListctrl->GetItemText(pNMItemActivate->iItem, 0) == "1") {
((CButton*)GetDlgItem(IDC_CHECK1))->SetCheck(TRUE);
} else ((CButton*)GetDlgItem(IDC_CHECK1))->SetCheck(FALSE);
SetDlgItemTextA(IDC_EDIT1, pListctrl->GetItemText(pNMItemActivate->iItem, 1));
SetDlgItemTextA(IDC_EDIT2, pListctrl->GetItemText(pNMItemActivate->iItem, 2));
SetDlgItemTextA(IDC_EDIT3, pListctrl->GetItemText(pNMItemActivate->iItem, 3));
SetDlgItemTextA(IDC_EDIT5, pListctrl->GetItemText(pNMItemActivate->iItem, 4));
*pResult = 0;
}
示例14: About
// “关于”框的消息处理程序。
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
SetDlgItemTextA(hDlg, ID_CODENAME, codename_str );
return (INT_PTR)TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDURL && HIWORD(wParam) == BN_CLICKED)
{
ShellExecute(NULL, TEXT("open"), TEXT("http://aean.net/"), NULL, NULL, SW_SHOWNORMAL);
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
else if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}
示例15: 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;
}