PDA

Просмотр полной версии : Help - Бесконечный цикл в запускателе C++


Olympicus
03.10.2024, 07:51
Hi, I've been trying to make my life a little more miserable for a few days now and I'm trying to compile this C++ code. I should clarify that my knowledge of C++ is zero and even Visual Studio is unfamiliar to me (Yes, I'm a Notepad++ user). After following a few tutorials and YouTube videos, I was able to compile the code without errors, but when I run the updater, it throws up a "Failed to create window" message. Googling and checking the code, it looks like the window is never registered. After applying some changes suggested by ChatGPT, the updater runs without that error, but eventually gets stuck in an infinite loop, collapsed, and nothing happens.

C++:



WNDCLASSEXW wcex
;
wcex
.
cbSize
=
sizeof
(
WNDCLASSEX
)
;
wcex
.
style
=
CS_HREDRAW
|
CS_VREDRAW
;
wcex
.
lpfnWndProc
=
_WndProc
;
wcex
.
cbClsExtra
=
0
;
wcex
.
cbWndExtra
=
0
;
wcex
.
hInstance
=
hInstance
;
wcex
.
hCursor
=
LoadCursor
(
nullptr
,
IDC_ARROW
)
;
wcex
.
hbrBackground
=
(
HBRUSH
)
GetStockObject
(
BLACK_BRUSH
)
;
wcex
.
lpszMenuName
=
MAKEINTRESOURCEW
(
IDC_CPP_GAME_LAUNCHER
)
;
wcex
.
lpszClassName
=
Constants
::
GUID
.
c_str
(
)
;
RegisterClassExW
(
&
wcex
)
;
hWnd
=
CreateWindowExW
(
0
,
Constants
::
GUID
.
c_str
(
)
,
szWindowTitle
,
WS_POPUP
|
WS_MINIMIZEBOX
,
windowX
,
windowY
,
windowWidth
,
windowHeight
,
nullptr
,
nullptr
,
nullptr
,
nullptr
)
;
if
(
!
hWnd
)
throw
std
::
logic_error
(
"Failed to create window!"
)
;


Any recommendations or advice are welcome. I want to clarify that for the libraries I use vcpkg and Visual Studio 2022 (maybe this can cause some conflict (?))

GitHub - FLWL/CPPGameLauncher: A game launcher/updater/patcher written in C++ for the Windows platform. (https://github.com/FLWL/CPPGameLauncher)

A game launcher/updater/patcher written in C++ for the Windows platform. - FLWL/CPPGameLauncher

github.com

ANZO
03.10.2024, 18:43
Need to know exact error after handle failed to create.

Replace

C++:



throw
std
::
logic_error
(
"Failed to create window!"
)
;


with

C++:



throw
std
::
runtime_error
(
"Failed to create window: "
+
std
::
system_category
(
)
.
message
(
GetLastError
(
)
)
)
;


and provide error message you got

Olympicus
04.10.2024, 03:10
Need to know exact error after handle failed to create.

Replace

C++:



throw
std
::
logic_error
(
"Failed to create window!"
)
;


with

C++:



throw
std
::
runtime_error
(
"Failed to create window: "
+
std
::
system_category
(
)
.
message
(
GetLastError
(
)
)
)
;


and provide error message you got

ANZO
04.10.2024, 03:29
"Erro! Failed to create window" · Issue #2 · FLWL/CPPGameLauncher (https://github.com/FLWL/CPPGameLauncher/issues/2)

Hello, I`m trying to compile it, after solving all dependencies I'm receiving this error 'CPPGameLauncher.exe' (Win32): Loaded 'D:\DEV\CPPGameLauncher\x64\Debug\CPPGameLauncher. exe'. Symbols loaded...

github.com


Last message has fix