childProc.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  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. }