MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Tools / AppCreateWin32Window

Function AppCreateWin32Window

vulkaninfo/vulkaninfo.h:797–840  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

795}
796
797static void AppCreateWin32Window(AppInstance &inst) {
798 inst.h_instance = GetModuleHandle(nullptr);
799
800 WNDCLASSEX win_class;
801
802 // Initialize the window class structure:
803 win_class.cbSize = sizeof(WNDCLASSEX);
804 win_class.style = CS_HREDRAW | CS_VREDRAW;
805 win_class.lpfnWndProc = WndProc;
806 win_class.cbClsExtra = 0;
807 win_class.cbWndExtra = 0;
808 win_class.hInstance = inst.h_instance;
809 win_class.hIcon = user32_handles->pfnLoadIconA(nullptr, IDI_APPLICATION);
810 win_class.hCursor = LoadCursor(nullptr, IDC_ARROW);
811 win_class.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
812 win_class.lpszMenuName = nullptr;
813 win_class.lpszClassName = APP_SHORT_NAME;
814 win_class.hInstance = inst.h_instance;
815 win_class.hIconSm = user32_handles->pfnLoadIconA(nullptr, IDI_WINLOGO);
816 // Register window class:
817 if (!user32_handles->pfnRegisterClassExA(&win_class)) {
818 // It didn't work, so try to give a useful error:
819 THROW_ERR("Failed to register the window class!");
820 }
821 // Create window with the registered class:
822 RECT wr = {0, 0, inst.width, inst.height};
823 user32_handles->pfnAdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE);
824 inst.h_wnd = user32_handles->pfnCreateWindowExA(0,
825 APP_SHORT_NAME, // class name
826 APP_SHORT_NAME, // app name
827 // WS_VISIBLE | WS_SYSMENU |
828 WS_OVERLAPPEDWINDOW, // window style
829 100, 100, // x/y coords
830 wr.right - wr.left, // width
831 wr.bottom - wr.top, // height
832 nullptr, // handle to parent
833 nullptr, // handle to menu
834 inst.h_instance, // hInstance
835 nullptr); // no extra parameters
836 if (!inst.h_wnd) {
837 // It didn't work, so try to give a useful error:
838 THROW_ERR("Failed to create a window!");
839 }
840}
841
842static VkSurfaceKHR AppCreateWin32Surface(AppInstance &inst) {
843 VkWin32SurfaceCreateInfoKHR createInfo;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected