fork download
  1. ////////////////////////////////////////////////////////////////////////////////
  2. // TrackTest.c
  3.  
  4. #include <Windows.h>
  5. #include <CommCtrl.h>
  6. #include "resource.h"
  7.  
  8. INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  9.  
  10. int APIENTRY WinMain(
  11. HINSTANCE hInstance,
  12. HINSTANCE hPrevInstance,
  13. LPSTR lpCmdLine,
  14. int nCmdShow)
  15. {
  16. DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG), NULL, DialogProc);
  17. return 0;
  18. }
  19.  
  20. INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  21. {
  22. static HWND hProg, hTrack;
  23. INT_PTR retval = TRUE;
  24. int iPos;
  25.  
  26. switch (uMsg) {
  27. case WM_INITDIALOG:
  28. hProg = GetDlgItem(hDlg, IDC_PROGRESS1);
  29. hTrack = GetDlgItem(hDlg, IDC_TRACK1);
  30. SendMessage(hProg, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
  31. SendMessage(hTrack, TBM_SETRANGE, 0, MAKELPARAM(0, 100));
  32. break;
  33. case WM_HSCROLL:
  34. iPos = SendMessage(hTrack, TBM_GETPOS, 0, 0);
  35. SendMessage(hProg, PBM_SETPOS, iPos, 0);
  36. break;
  37. case WM_CLOSE:
  38. EndDialog(hDlg, IDOK);
  39. break;
  40. default:
  41. retval = FALSE;
  42. }
  43. return retval;
  44. }
  45.  
  46. ////////////////////////////////////////////////////////////////////////////////
  47. // resource.h
  48.  
  49. #define IDD_DIALOG 100
  50.  
  51. #define IDC_PROGRESS1 1000
  52. #define IDC_TRACK1 1001
  53.  
  54. ////////////////////////////////////////////////////////////////////////////////
  55. // TrackTest.rc
  56.  
  57. #include <windows.h>
  58. #include "resource.h"
  59.  
  60. IDD_DIALOG DIALOGEX 0, 0, 320, 200
  61. STYLE WS_POPUPWINDOW | WS_MINIMIZEBOX
  62. EXSTYLE WS_EX_APPWINDOW
  63. CAPTION "TrackTest"
  64. FONT 9, "MS Pゴシック"
  65. BEGIN
  66. CONTROL "Progress1",IDC_PROGRESS1,"msctls_progress32",
  67. WS_BORDER,20,8,284,16
  68. CONTROL "Track1",IDC_TRACK1,"msctls_trackbar32",
  69. TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,20,36,284,16
  70. END
  71.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty