int PASCAL WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
static char szAppName[] = "DTMF";
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
char Str_Sys[200];
if (!hPrevInstance)
{
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = (WNDPROC)WndProc;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = DLGWINDOWEXTRA;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon (hInstance, "IDI_ICON1");
wndclass.hCursor = LoadCursor (NULL, IDI_APPLICATION);
wndclass.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName; ATOM a=RegisterClass (&wndclass);
} GetSystemDirectory(Str_Sys,200);
strcat(Str_Sys,"\\comctl32.dll");
hLib = LoadLibrary(Str_Sys); hInst = hInstance;
就是这句:hwnd = CreateDialog(hInstance, "DTMF", 0, NULL); hGWnd=hwnd; ShowWindow (hwnd, nCmdShow);
UpdateWindow(hwnd); bLoadDriver=DtmfInitSystem();
if(!bLoadDriver) PostQuitMessage(0); SetTimer(hwnd,ID_TIME,100,(TIMERPROC)TimerProc); while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
VOID CALLBACK TimerProc(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime)
{
if(idEvent!=ID_TIME) return;
DtmfDoWork();
}LRESULT CALLBACK WndProc (HWND hwnd, UINT message, UINT wParam, LONG lParam)
{
int i;
switch (message)
{
case WM_DESTROY :
KillTimer(hwnd,ID_TIME);
if(bLoadDriver) DtmfExitSystem();
PostQuitMessage (0) ;
return 0 ;
break;
case WM_COMMAND:
if(LOWORD(wParam)==IDC_CLOSE)
{
KillTimer(hwnd,ID_TIME);
if(bLoadDriver) DtmfExitSystem();
PostQuitMessage(0);
}
else if(LOWORD(wParam)==IDC_HANGUP)
{
for (i = 0; i < TalLine; i++)
DtmfResetChannel(i);
}
else if(LOWORD(wParam)==IDC_DIAL)
DtmfDialOut();
return 0;
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam) ;
break;
}
}
在调用CreateDialog函数后,为什么不进入WndProc 响应,结果是看得见窗口,但是整个程式几乎就没有反应?单击任何按钮都没反应?这是为什么??谢谢各位啦
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
static char szAppName[] = "DTMF";
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
char Str_Sys[200];
if (!hPrevInstance)
{
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = (WNDPROC)WndProc;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = DLGWINDOWEXTRA;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon (hInstance, "IDI_ICON1");
wndclass.hCursor = LoadCursor (NULL, IDI_APPLICATION);
wndclass.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName; ATOM a=RegisterClass (&wndclass);
} GetSystemDirectory(Str_Sys,200);
strcat(Str_Sys,"\\comctl32.dll");
hLib = LoadLibrary(Str_Sys); hInst = hInstance;
就是这句:hwnd = CreateDialog(hInstance, "DTMF", 0, NULL); hGWnd=hwnd; ShowWindow (hwnd, nCmdShow);
UpdateWindow(hwnd); bLoadDriver=DtmfInitSystem();
if(!bLoadDriver) PostQuitMessage(0); SetTimer(hwnd,ID_TIME,100,(TIMERPROC)TimerProc); while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
VOID CALLBACK TimerProc(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime)
{
if(idEvent!=ID_TIME) return;
DtmfDoWork();
}LRESULT CALLBACK WndProc (HWND hwnd, UINT message, UINT wParam, LONG lParam)
{
int i;
switch (message)
{
case WM_DESTROY :
KillTimer(hwnd,ID_TIME);
if(bLoadDriver) DtmfExitSystem();
PostQuitMessage (0) ;
return 0 ;
break;
case WM_COMMAND:
if(LOWORD(wParam)==IDC_CLOSE)
{
KillTimer(hwnd,ID_TIME);
if(bLoadDriver) DtmfExitSystem();
PostQuitMessage(0);
}
else if(LOWORD(wParam)==IDC_HANGUP)
{
for (i = 0; i < TalLine; i++)
DtmfResetChannel(i);
}
else if(LOWORD(wParam)==IDC_DIAL)
DtmfDialOut();
return 0;
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam) ;
break;
}
}
在调用CreateDialog函数后,为什么不进入WndProc 响应,结果是看得见窗口,但是整个程式几乎就没有反应?单击任何按钮都没反应?这是为什么??谢谢各位啦
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货