when we create the window, we can choose some styles. but i see 2 problems:
- how can i hide the border?(i have seen the msdn styles, but theres no const for that)
- how can i change the styles after create the window?

Recommended Answers

You should use SetWindowLongPtr() so that it will be compatible with both 32 and 64 bit version of MS-Windows.

Jump to Post

All 17 Replies

This article might be of interest to you. Codeproject.com has one of the largest repositories of free Windows code that you will find on the internet. You will find examples of almost anything you want to do there.

just tell me more 1 thing: what is the const for no border?

AFAIK there is none. Here is the list of valid styles. There are many other styles but they are specific to window type such as buttons, dialog boxes, check boxes, etc.

having test more and i found it.
when we create a window, we must choose what we need. theres some standard const's too ;)
when we need change it: we use the SetWindowLong() function very cool.
readers don't forget use GWL_STYLE for normal styles and GWL_EX_STYLE for EX styles;)

You should use SetWindowLongPtr() so that it will be compatible with both 32 and 64 bit version of MS-Windows.

commented: thanks +2

imagine that i need a window without any border(just the rectangule backcolor). what combination styles i can use?

AFAIK there isn't such an option. Why would you want a borderless window? Maybe you want something like a spliter window??

if i use NULL(no style) the window stays with textbox style :(

thanks for the right term ;)
yes it is

finally i did ;)

// Step 2: Creating the Window
    hwnd = CreateWindowEx(
        WS_EX_APPWINDOW, //see here
        "The title of my window",
         WS_OVERLAPPED|WS_POPUP , //see here
        NULL, NULL, hInstance, NULL);

explain to me what i'm confuse: the 1st and 4th arguments are for styles(they are both styles). can you explain better to me the diference?
and if i click 2 times(on task bar) the window isn't minimized.. it's a normal thing or i can activate that?

For detailed explanation of each argument you need to read this article. There are two functions -- CreateWindow() and CreateWindowEx(). If you compare the arguments of the two functions the only difference is the first argument, which are additional window styles not used in the first function.

commented: thanks +2

i don't understand why not only 1 parameter for styles. but i have seen(i have tested now) they do a combination of the both styles(extend windows styles with windows styles). that's why i never get the borderless style ;)
hey i learned more than i thot today ;)
thanks for all

i need understand better about combinations styles for don't give me problems... but seems the msdn link isn't the best :(

It's almost a waste of time learning win32 api because it has been supersedded by .NET Framework. Your time would be more well spent by learning Windows Forms using CLR/C++, C# and VB.NET languages, all which use .NET Framework functions. It wouldn't surprise me if win32 api was someday (in the next 10 years) obsolete and no longer supported.