user-0 提问: 用 vc 写了个对话框程序，但是运行没反应

回复:
user: user-1
content: 楼主debug调试跟一下呗

user: user-0
content: spy是什么东东

user: user-2
content: 学会使用Spy++

user: user-0
content: 贴上代码 #include "stdafx.h" #include <windows.h> #include <windowsx.h> #include <mmsystem.h> #include <commdlg.h> #include "resource.h" #include "MainDlg.h" TCHAR precmd[MAX_PATH+10]="";  /* Template designed by RuPeng.com. Please visit http://www.rupeng.com for more information 如鹏网（http://www.rupeng.com）大学生计算机学习社区，提供大量免费视频学习教程，提供个性化一对一学习指导 */ BOOL WINAPI Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {     switch(uMsg)     {         HANDLE_MSG(hWnd, WM_INITDIALOG, Main_OnInitDialog);         HANDLE_MSG(hWnd, WM_COMMAND, Main_OnCommand);         HANDLE_MSG(hWnd,WM_CLOSE, Main_OnClose);     }      return FALSE; }  BOOL Main_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) {     TCHAR strInitTime1[10]="00:00";     TCHAR strInitTime2[10]="00:00";     SetDlgItemText(hwnd,IDC_EDIT2,strInitTime1);     SetDlgItemText(hwnd,IDC_EDIT3,strInitTime2);     return TRUE; }  void Main_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) {     //TCHAR precmd[MAX_PATH+10]="";     //在同一个函数中，precmd不能在case之间传递     //跟c语言不同     switch(id)     {         case IDC_OK:         {             OPENFILENAME ofn;             char szFile[MAX_PATH];             ZeroMemory(&ofn,sizeof(ofn));             ofn.lStructSize = sizeof(ofn);             ofn.lpstrFile = szFile;             ofn.lpstrFile[0] = TEXT('\0');             ofn.nMaxFile = sizeof(szFile);             ofn.lpstrFilter = TEXT("ALL\0*.*\0Text\0*.TXT\0");             ofn.nFilterIndex = 1;             ofn.lpstrFileTitle = NULL;             ofn.nMaxFileTitle = 0;             ofn.lpstrInitialDir = NULL;             ofn.hwndOwner = hwnd;//自学能力、探索能力、猜测能力             ofn.Flags = OFN_EXPLORER |OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;             if (GetOpenFileName(&ofn))             {                 HWND hwndList=GetDlgItem(hwnd,IDC_LIST1);                 ListBox_InsertString(hwndList,-1,szFile);                              }          }         break;         case IDC_LIST1:             {                 switch (codeNotify)                 {                 case LBN_DBLCLK:                     {                         mciSendString(precmd,"",0,NULL);                         HWND hwndList=GetDlgItem(hwnd,IDC_LIST1);                         int a=ListBox_GetCurSel(hwndList);                         TCHAR str[MAX_PATH];                         ListBox_GetText(hwndList,a,str);                         TCHAR shortpath[MAX_PATH];                         GetShortPathName(str,shortpath,sizeof(shortpath));                         SetDlgItemText(hwnd,IDC_EDIT1,str);                         TCHAR playcmd[MAX_PATH+10];                         wsprintf(playcmd,"play %s",shortpath);                         mciSendString(playcmd,"",0,NULL);                                                  TCHAR statuscmd[MAX_PATH+20];                         TCHAR buf[256];                         wsprintf(statuscmd,"status %s length",shortpath);                         mciSendString(statuscmd,buf,256,NULL);                         int minute,second,iAllLength;                         TCHAR strAllTime[256];                         iAllLength=strtol(buf,NULL,0);                         minute=iAllLength/60000;                         second=(iAllLength/1000)%60;                         wsprintf(strAllTime,"%02d:%02d",minute,second);                                                  SetDlgItemText(hwnd,IDC_EDIT3,strAllTime);                                              wsprintf(precmd,"stop %s",shortpath);                     }                 break;                 }             }         break;         case IDC_BUTTON1:             {                 mciSendString(precmd,"",0,NULL);                 HWND hwndList=GetDlgItem(hwnd,IDC_LIST1);                 int a=ListBox_GetCurSel(hwndList);                 TCHAR str[MAX_PATH];                 ListBox_GetText(hwndList,a,str);                 TCHAR shortpath[MAX_PATH];                 GetShortPathName(str,shortpath,sizeof(shortpath));                 SetDlgItemText(hwnd,IDC_EDIT1,str);                 TCHAR cmd[MAX_PATH+10];                 wsprintf(cmd,"play %s",shortpath);                 mciSendString(cmd,"",0,NULL);                 wsprintf(precmd,"stop %s",shortpath);             }         break;         case IDC_BUTTON2:             {                 HWND hwndList=GetDlgItem(hwnd,IDC_LIST1);                 int a=ListBox_GetCurSel(hwndList);                 TCHAR str[MAX_PATH];                 ListBox_GetText(hwndList,a,str);                 TCHAR shortpath[MAX_PATH];                 GetShortPathName(str,shortpath,sizeof(shortpath));                 SetDlgItemText(hwnd,IDC_EDIT1,str);                 TCHAR cmd[MAX_PATH+10];                 wsprintf(cmd,"pause %s",shortpath);                 mciSendString(cmd,"",0,NULL);             }         break;         case IDC_BUTTON3:             {                 HWND hwndList=GetDlgItem(hwnd,IDC_LIST1);                 int a=ListBox_GetCurSel(hwndList);                 TCHAR str[MAX_PATH];                 ListBox_GetText(hwndList,a,str);                 TCHAR shortpath[MAX_PATH];                 GetShortPathName(str,shortpath,sizeof(shortpath));                 SetDlgItemText(hwnd,IDC_EDIT1,str);                 TCHAR cmd[MAX_PATH+10];                 wsprintf(cmd,"resume %s",shortpath);                 mciSendString(cmd,"",0,NULL);             }         break;         case IDC_BUTTON4:             {                 HWND hwndList=GetDlgItem(hwnd,IDC_LIST1);                 int a=ListBox_GetCurSel(hwndList);                 TCHAR str[MAX_PATH];                 ListBox_GetText(hwndList,a,str);                 TCHAR shortpath[MAX_PATH];                 GetShortPathName(str,shortpath,sizeof(shortpath));                 SetDlgItemText(hwnd,IDC_EDIT1,str);                 TCHAR cmd[MAX_PATH+10];                 wsprintf(cmd,"stop %s",shortpath);                 mciSendString(cmd,"",0,NULL);             }         break;         default:         break;     } }  void Main_OnClose(HWND hwnd) {     EndDialog(hwnd, 0); }