用windows sdk编写应用程序遇到一个奇怪的问题:当代码如下时, case IDC_BUTTON_GETPID: { MessageBox(NULL, "aaa", "aaa", MB_OK); 。。。。。。。。。。 } return TRUE;
case IDC_BUTTON_BROWSER: { OPENFILENAME ofn; TCHAR szFile[MAX_PATH] = {0}; memset(&ofn, 0, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hDlg; ofn.lpstrFile = szFile; ofn.nMaxFile = MAX_PATH; ofn.lpstrFilter = _T("*.*"); ofn.lpstrDefExt = _T("*"); ofn.lpstrTitle = _T("选择文件"); ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; if(GetOpenFileName(&ofn)) { SetWindowText(openedfileEdit, _T("")); SetWindowText(pidEdit, _T("")); SetWindowText(openedfileEdit, szFile); EnableWindow(pidEdit, TRUE); EnableWindow(pidBtn, TRUE); } } return TRUE;
获取文件对话框时,对话框里没有文件显示,只有文件夹。这很奇怪。
而当代码如下时:
case IDC_BUTTON_BROWSER: { OPENFILENAME ofn; TCHAR szFile[MAX_PATH] = {0}; memset(&ofn, 0, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hDlg; ofn.lpstrFile = szFile; ofn.nMaxFile = MAX_PATH; ofn.lpstrFilter = _T("*.*"); ofn.lpstrDefExt = _T("*"); ofn.lpstrTitle = _T("选择文件"); ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; if(GetOpenFileName(&ofn)) { SetWindowText(openedfileEdit, _T("")); SetWindowText(pidEdit, _T("")); SetWindowText(openedfileEdit, szFile); EnableWindow(pidEdit, TRUE); EnableWindow(pidBtn, TRUE); } } return TRUE; case IDC_BUTTON_GETPID: { MessageBox(NULL, "aaa", "aaa", MB_OK); 。。。。。。。。。。 } return TRUE;
获取文件对话框,对话框里有文件实现。具体导致这种问题并不清楚,不过调式信息发现,上面比下面多了些调式信息
/system32/shimgvw.dll', no matching symbolic information found. Loaded 'C:/WINDOWS/system32/ntmarta.dll', no matching symbolic information found. Loaded 'C:/WINDOWS/system32/samlib.dll', no matching symbolic information found. The thread 0x614 has exited with code 1 (0x1). The thread 0xDC8 has exited with code 1 (0x1). The thread 0x5A4 has exited with code 1 (0x1). The thread 0x8F4 has exited with code 1 (0x1). The thread 0xE84 has exited with code 1 (0x1).
我想是不是程序在哪里堵住了。