void CCMPPGATEDlg::OnButton2()
{
// TODO: Add your control notification handler code here
GetModuleFileName(NULL,g_app_path.GetBuffer(MAX_PATH), MAX_PATH);
g_app_path.ReleaseBuffer();
int len = g_app_path.GetLength();
//滤去文件名称,只保留路径
for(int i=0; i<=len-1; i++)
{
if(g_app_path.Right(1)!="\\")
g_app_path.Delete(len-1-i,1);
else
{
g_app_path.Delete(len-1-i,1);
break;
}
}
SetDlgItemText(IDC_EDITPATH, g_app_path);
}
{
// TODO: Add your control notification handler code here
GetModuleFileName(NULL,g_app_path.GetBuffer(MAX_PATH), MAX_PATH);
g_app_path.ReleaseBuffer();
int len = g_app_path.GetLength();
//滤去文件名称,只保留路径
for(int i=0; i<=len-1; i++)
{
if(g_app_path.Right(1)!="\\")
g_app_path.Delete(len-1-i,1);
else
{
g_app_path.Delete(len-1-i,1);
break;
}
}
SetDlgItemText(IDC_EDITPATH, g_app_path);
}
GetCurrentDirectory(128 , dir);
CEidt * pEdit = (CEdit *)GetDlgItem(ID_……);
pEdit->SetWindowText(dir);
steedhorse(晨星) 的有点问题,通常用你的程序去打开另一文件夹中的文件时,
CurrentDirectory已经变了。