Sign in to follow this  
Dogh Quch

Windows programming,

Recommended Posts

Dogh Quch    122
Hail, I don't know if this is the best place to ask that, but... How do I take out the maximize and minimize buttons in the window I'm creating? This is the procedure I'm working to crate the window, I already check the windows documentation but what I'm looking for doesn't look like to be in the parameters of this creation functions: WNDCLASSEX winclass; //Main window hadler //first fill in the window class structure winclass.cbSize = sizeof (WNDCLASSEX); //size of WNDCLASSEX structure winclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW; //style flags winclass.lpfnWndProc = WindowProc; //function pointer to handler winclass.cbClsExtra = 0; //extra class info winclass.cbWndExtra = 0; //extra window info winclass.hInstance = h_Instance; //the instance of the application winclass.hIcon = LoadIcon (h_Instance, "ICON_ExeFileIcon"); //icon to use in .exe file winclass.hCursor = LoadCursor (h_Instance, "CURSOR_MainCursor"); //cursor to use in window winclass.hbrBackground = (HBRUSH) GetStockObject (BLACK_BRUSH); //background color winclass.lpszMenuName = NULL; //the name of the menu to attach winclass.lpszClassName = MAIN_WINDOW_NAME; //window name winclass.hIconSm = LoadIcon (h_Instance, "ICON_SmallIcon"); //icon to use in the window top left //register the window class if (!RegisterClassEx (&winclass)) return 0; //Create the window st_TheMainStruct.MainWindowHandler = CreateWindowEx (NULL, //extended window style MAIN_WINDOW_NAME, //pointer to registered class name "Your Basic Window", //window text WS_OVERLAPPEDWINDOW | WS_VISIBLE, //window style 0, 0, //initial x,y 400, 400, //initial width, height NULL, //handle to parent LoadMenu (h_Instance, MAIN_MENU_NAME), //handle to menu h_Instance, //instance of this application NULL); //extra creation parms

Share this post


Link to post
Share on other sites
Illco    928
This page gives the possible values for the window style. You can combine them to produce mixed effects. The trick here is the following.

One of the styles, WS_OVERLAPPEDWINDOW, is a sort of wrapper for a number of styles (see the page for details). It includes the flags for the boxes. To obtain the desired effect, you should (1) remove WS_OVERLAPPEDWINDOW, (2) include the flags defined for WS_OVERLAPPEDWINDOW, (3) except for the min/max box flags.

This brings us to:

// Window style
WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME


Greetz,

Illco

Share this post


Link to post
Share on other sites
Dogh Quch    122
Thanks Illco.

How stupid am I? now I see were I was mistaken....
I must have read that thing 3 times just this morning and didn't realize that.

Just one more thing, how do I change from windowed mode to full screen mode?
I don't want to create a full screen window, I have a window opened and I want to change it to full screen when the user choose to.

Share this post


Link to post
Share on other sites
twkr    162
you might want to try WS_POPUP|WS_BORDER|WS_DLGFRAME so that the window cannot be resized if you are getting rid of min and max.

Share this post


Link to post
Share on other sites
Dave Hunt    4872
Quote:
Original post by Dogh Quch
Just one more thing, how do I change from windowed mode to full screen mode?
I don't want to create a full screen window, I have a window opened and I want to change it to full screen when the user choose to.


See ChangeDisplaySettings.

Share this post


Link to post
Share on other sites
Dogh Quch    122
ChangeDisplaySettings doesn't look like what I want to do.

This program I'm building is just a skeleton to a directX based program.
The fist screen will be just a window with some menu option and a big logo image, so the user may configure the application, but it should be in full screen mode when running.

So, this function mess with the windows display settings and I would like to stay as far as possible from windows! Besides, It's safer to let directX deal with the display sittings.

Maybe I didn't understand how it actually work, but I was unable to produce the effect I wished.

I'll keep trying...

Share this post


Link to post
Share on other sites
Origanlmaxin    122
i may be mistaken Dogh Quch, but i think this command may do it?

ChangeDisplaySettings(NULL,0);

and i think changing the 0 to a 1 makes it fullscreen.. i havent tested it but it looks to be the part of the program to change fullscreen :D

Share this post


Link to post
Share on other sites
Dogh Quch    122
I tested...it did nothing!

ChangeDisplaySettings(NULL,0) will just restore de default dysplay settings (I'm assuming its the windows settings).

Theoretically, to change to full screen would be like this: ChangeDisplaySettings (NULL, CDS_FULLSCREEN);

Maybe I'm using it the wrong way...how would you use it? I mean, just calling the function should do the job or it need some work before/after the function call?

Share this post


Link to post
Share on other sites
Dave Hunt    4872
Quote:
Original post by Dogh Quch
This program I'm building is just a skeleton to a directX based program.


Ok. That changes everything. For DirectX, fullscreen/windowed is handled by the device. When you create the device, you tell it whether you want fullscreen or windowed. If the device is already created, then you can flip between fullscreen/windowed using the Reset method of the device interface.

Share this post


Link to post
Share on other sites
Dogh Quch    122
It took some time but I found it!

To change the window attributes you must first call this function: SetWindowLongPtr.
Than, you call SetWindowPos to make the changes take effect.

I already changed the screen size and took out the menu bar. I'm still unable to make a complete full screen, but I'm on the right trek now.

Tanks for the help guys!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this