// Specify the resource identifier of the descriptive // text for the given button. idButton = lpttt->hdr.idFrom; switch (idButton) { case IDM_CUT: lpttt->lpszText = MAKEINTRESOURCE(IDS_TIPS_CUT); break; case IDM_COPY: lpttt->lpszText = MAKEINTRESOURCE(IDS_TIPS_COPY); break; case IDM_PASTE: lpttt->lpszText = MAKEINTRESOURCE(IDS_TIPS_PASTE); break; } break; } . . // Process other notifications here. . default: break; }
switch (((LPNMHDR) lParam)->code)
{
case TTN_GETDISPINFO:
{
LPTOOLTIPTEXT lpttt;
lpttt = (LPTOOLTIPTEXT) lParam;
lpttt->hinst = g_hinst;
// Specify the resource identifier of the descriptive
// text for the given button.
idButton = lpttt->hdr.idFrom;
switch (idButton)
{
case IDM_CUT:
lpttt->lpszText = MAKEINTRESOURCE(IDS_TIPS_CUT);
break;
case IDM_COPY:
lpttt->lpszText = MAKEINTRESOURCE(IDS_TIPS_COPY);
break;
case IDM_PASTE:
lpttt->lpszText = MAKEINTRESOURCE(IDS_TIPS_PASTE);
break;
}
break;
}
.
. // Process other notifications here.
.
default:
break;
}
pList=(CListBox *)this->dlgbar1.GetDlgItem(IDC_LIST_LINE);用不着MAKEINTRESOURCE ,得到指针后记住 强制转换类型
(CListBox *)
pEdit->SetWindowText("kk");
为什么要用MAKEINTRESOURCE?
int CJcSqd::GetIntByName(CString strName)
{
if(strName=="IDC_EDIT1")
return 1001;
else if...
else
return 0;
}
然后用GetDlgItem(GetIntByName(strValue))-SetWindowText("kk");来进行赋值。能否不用自己写GetIntByName函数?
返回的int值是在编译时制定的,除非你是动态创建的,但动态创建有句柄呀!把你遇到问题的情况说清楚点>>共同研究研究!
:)
我的做法是以XML的格式把所有的内容存成一个字段(包括控件的名称),这样不同的窗体(申请单模板)从同一表中读出的数据根据控件名和值回填,所以这时得到的ID值是一个CString型的,我就想知道在VC中有没有不用自己来写GetIntByName(CString strName)这一函数的方法。(由于我的表别的VB程序也要用,所以这里不能在表中存入ID的int值)。请赐教!
struct{
CString strid;
int ID;
}
从数组中找到你要ID ,不也一样么