childProc.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #include "Win32.h"
  2. #include "ID.h"
  3. #include "Function.h"
  4. HWND CreateChildWindow(HWND hFather, LPCWCHAR childTitle ,int x, int y, WNDPROC procFunc, LPCWCHAR className, HINSTANCE hInstanceF)
  5. {
  6. HWND hChild = NULL;
  7. static WNDCLASSEX wcexF;
  8. wcexF.cbSize = sizeof(WNDCLASSEX);
  9. wcexF.style = CS_HREDRAW | CS_VREDRAW;
  10. wcexF.lpfnWndProc = procFunc;
  11. wcexF.cbClsExtra = 0;
  12. wcexF.cbWndExtra = 0;
  13. wcexF.hInstance = hInstanceF;
  14. wcexF.hIcon = LoadIcon(wcexF.hInstance, IDI_APPLICATION);
  15. wcexF.hCursor = LoadCursor(NULL, IDC_ARROW);
  16. wcexF.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
  17. wcexF.lpszMenuName = NULL;
  18. wcexF.lpszClassName = className;
  19. wcexF.hIconSm = LoadIcon(wcexF.hInstance, IDI_APPLICATION);
  20. RegisterClassEx(&wcexF);
  21. hChild = CreateWindowEx(
  22. NULL,
  23. className, childTitle,
  24. WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU,
  25. 700, 300,
  26. x, y, hFather, NULL,
  27. hInstanceF, NULL
  28. );
  29. Err(hChild,
  30. _T("Create ChildWindow failed!"));
  31. return hChild;
  32. }
  33. HWND CreateNewWindow(LPCWCHAR childTitle, int x, int y, WNDPROC procFunc, LPCWCHAR className, HINSTANCE hInstanceF)
  34. {
  35. HWND hChild = NULL;
  36. static WNDCLASSEX wcexF;
  37. wcexF.cbSize = sizeof(WNDCLASSEX);
  38. wcexF.style = CS_HREDRAW | CS_VREDRAW;
  39. wcexF.lpfnWndProc = procFunc;
  40. wcexF.cbClsExtra = 0;
  41. wcexF.cbWndExtra = 0;
  42. wcexF.hInstance = hInstanceF;
  43. wcexF.hIcon = LoadIcon(wcexF.hInstance, IDI_APPLICATION);
  44. wcexF.hCursor = LoadCursor(NULL, IDC_ARROW);
  45. wcexF.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
  46. wcexF.lpszMenuName = NULL;
  47. wcexF.lpszClassName = className;
  48. wcexF.hIconSm = LoadIcon(wcexF.hInstance, IDI_APPLICATION);
  49. RegisterClassEx(&wcexF);
  50. hChild = CreateWindowEx(
  51. NULL,
  52. className, childTitle,
  53. WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU,
  54. 700, 300,
  55. x, y, NULL , NULL,
  56. hInstanceF, NULL
  57. );
  58. Err(hChild,
  59. _T("Create ChildWindow failed!"));
  60. return hChild;
  61. }