#window code in C

37 messages · Page 1 of 1 (latest)

wise field
#

can someone explain this code for me:


WNDCLASSEXW wc = {0};
 
 
wc.hbrBackground = (HBRUSH) COLOR_WINDOW ;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hInstance = hInst;
wc.lpszClassName = L"myWindowClass";
wc.lpfnWndProc = WindowProcedure;

if there is, can tell me what the window variable name is

supple otterBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

dense arch
#

That looks like code for initializing a WinAPI window class

#

What part don't you understand?

wise field
#

each line

#

well, i get the idea that hbrBackground is the window colour

#

and hCursor changes cursor colour ?

granite cypress
#

All of this you can find in the documentation of WNDCLASSEX.

wise field
#

so you can't explain it yourself?

granite cypress
#

It would be duplicated effort to.

wise field
#

so, what's the point of this part of the discord?

granite cypress
#

To give enough information to solve the problem.

wise field
#

ok

#

    wc1.hbrBackground = (HBRUSH) COLOR_WINDOW ; //set window background colour
    wc1.hCursor = LoadCursor(NULL, IDC_ARROW); //set cursor type

is these comments right?

granite cypress
#

Kind of, but the actual explanations are in the Members section of that page.

wise field
#

wc1.hInstance = hInst; //A handle to the instance that contains the window procedure for the class.

this is what I got from that page

granite cypress
#

Yes, then?

wise field
#

i wes wondering if that was the right way to see that code

granite cypress
#

Sure.

wise field
#

ah ok thanks

supple otterBOT
#

@wise field Has your question been resolved? If so, type !solved :)

wise field
#

wc1.lpszClassName = L"myWindowClass1"; //window class name

naming the window?

dense arch
#

The window title is not the window class name

wise field
#

ohh, so, naming the window title?

dense arch
#

The window class describes how a window looks and functions

#

When you create a window, you pass in the window class name

wise field
#

ill check it now

#

is that in C?

dense arch
#

WinAPI works in both C and C++

wise field
#

i see

#

that actually explains better than the youtube video i copied from

#

the guy in the video was just like, "do this", but didn't explain the code

dense arch
#

For Microsoft stuff, you really have to read the docs

wise field
wise field
#

!solved