mirror of
https://github.com/curl/curl.git
synced 2026-08-01 00:08:09 +03:00
main_window_loop
This commit is contained in:
parent
db58e29fa5
commit
b77a43cbcd
1 changed files with 22 additions and 0 deletions
|
|
@ -525,17 +525,27 @@ static DWORD WINAPI main_window_loop(void *lpParameter)
|
|||
WNDCLASS wc;
|
||||
BOOL ret;
|
||||
MSG msg;
|
||||
#ifdef DEBUG_WIN32_CALLBACKS
|
||||
DWORD err;
|
||||
char buffer[WINAPI_ERROR_LEN];
|
||||
#else
|
||||
DWORD dwWritten;
|
||||
#endif
|
||||
|
||||
ZeroMemory(&wc, sizeof(wc));
|
||||
wc.lpfnWndProc = (WNDPROC)main_window_proc;
|
||||
wc.hInstance = (HINSTANCE)lpParameter;
|
||||
wc.lpszClassName = TEXT("MainWClass");
|
||||
if(!RegisterClass(&wc)) {
|
||||
#ifdef DEBUG_WIN32_CALLBACKS
|
||||
err = GetLastError();
|
||||
curlx_winapi_strerror(err, buffer, sizeof(buffer));
|
||||
fprintf(stderr, "RegisterClass failed: %s\n", buffer);
|
||||
#else
|
||||
static const char str[] = "RegisterClass() failed\n";
|
||||
WriteFile(GetStdHandle(STD_ERROR_HANDLE), str, sizeof(str) - 1,
|
||||
&dwWritten, NULL);
|
||||
#endif
|
||||
return (DWORD)-1;
|
||||
}
|
||||
|
||||
|
|
@ -547,18 +557,30 @@ static DWORD WINAPI main_window_loop(void *lpParameter)
|
|||
(HWND)NULL, (HMENU)NULL,
|
||||
wc.hInstance, NULL);
|
||||
if(!hidden_main_window) {
|
||||
#ifdef DEBUG_WIN32_CALLBACKS
|
||||
err = GetLastError();
|
||||
curlx_winapi_strerror(err, buffer, sizeof(buffer));
|
||||
fprintf(stderr, "CreateWindowEx failed: (0x%08lx) - %s\n", err, buffer);
|
||||
#else
|
||||
static const char str[] = "CreateWindowEx() failed\n";
|
||||
WriteFile(GetStdHandle(STD_ERROR_HANDLE), str, sizeof(str) - 1,
|
||||
&dwWritten, NULL);
|
||||
#endif
|
||||
return (DWORD)-1;
|
||||
}
|
||||
|
||||
do {
|
||||
ret = GetMessage(&msg, NULL, 0, 0);
|
||||
if(ret == -1) {
|
||||
#ifdef DEBUG_WIN32_CALLBACKS
|
||||
err = GetLastError();
|
||||
curlx_winapi_strerror(err, buffer, sizeof(buffer));
|
||||
fprintf(stderr, "GetMessage failed: (0x%08lx) - %s\n", err, buffer);
|
||||
#else
|
||||
static const char str[] = "GetMessage() failed\n";
|
||||
WriteFile(GetStdHandle(STD_ERROR_HANDLE), str, sizeof(str) - 1,
|
||||
&dwWritten, NULL);
|
||||
#endif
|
||||
return (DWORD)-1;
|
||||
}
|
||||
else if(ret) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue