HOME FORUMS MEMBERS RECENT POSTS LOG IN  
× Авторизация
Имя пользователя:
Пароль:
Нет аккаунта? Регистрация
Баннер 1   Баннер 2
НОВЫЕ ТОРГОВАЯ НОВОСТИ ЧАТ
loading...
Скрыть
Вернуться   ANTICHAT > ПРОГРАММИРОВАНИЕ > С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby
   
Ответ
 
Опции темы Поиск в этой теме Опции просмотра

  #1  
Старый 03.10.2024, 07:51
Olympicus
Познающий
Регистрация: 02.03.2021
Сообщений: 93
С нами: 2738171

Репутация: 273
По умолчанию

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.

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

github.com
 
Ответить с цитированием

  #2  
Старый 03.10.2024, 18:43
ANZO
Участник форума
Регистрация: 09.07.2015
Сообщений: 211
С нами: 5708007

Репутация: 312
По умолчанию

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
 
Ответить с цитированием

  #3  
Старый 04.10.2024, 03:10
Olympicus
Познающий
Регистрация: 02.03.2021
Сообщений: 93
С нами: 2738171

Репутация: 273
По умолчанию

Цитата:
Сообщение от ANZO  

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
 
Ответить с цитированием

  #4  
Старый 04.10.2024, 03:29
ANZO
Участник форума
Регистрация: 09.07.2015
Сообщений: 211
С нами: 5708007

Репутация: 312
По умолчанию

Цитата:
Сообщение от Olympicus  
"Erro! Failed to create window" · Issue #2 · FLWL/CPPGameLauncher

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
 
Ответить с цитированием
Ответ





Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
 


Быстрый переход




ANTICHAT ™ © 2001- Antichat Kft.