我想在vC++窗口中更改標籤。該標籤顯示每100毫秒更新一次的實時數據。那麼我怎麼能在vC++窗口中做到這一點?任何一個請幫助在窗口中更改標籤
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND hRPMEx,hAvgTimeEx;
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch(message)
{
case WM_TIMER:
break;
case WM_CREATE:
hRPMEx = CreateWindowA("Static","",WS_CHILD | WS_VISIBLE | SS_LEFT,
20,100,220,25,
hWnd, (HMENU)IDC_RPM_EX, hInstance, NULL);
hAvgTimeEx = CreateWindowA("Static","",WS_CHILD | WS_VISIBLE | SS_LEFT,
20,150,220,25,
hWnd, (HMENU)IDC_AVGTIME_EX, hInstance, NULL);
break;
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDC_BTN_CONNECT:
break;
case IDC_RPM_EX:
break;
case IDC_BTN_DISCONNECT:
break;
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case IDM_OPEN:
break;
case IDM_EXIT:
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
我應該在哪裏給調用的函數更新標籤(靜態文本)
這看起來很有意思:你已經設法編寫了上面的代碼,但是對它沒有任何瞭解?我們怎麼說這是** HOMEWORK **,你需要一兩個提示。然後這裏有一個提示:查看代碼中每個東西的*文檔*。 – 2013-03-12 08:07:18
您還需要了解_indentation_。 – 2013-03-12 08:13:48