Windows programming,

Started by
9 comments, last by TooOld2rock-nRoll 18 years, 9 months ago
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
Advertisement
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 styleWS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME


Greetz,

Illco
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.
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.
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.
Well, this could be useful, though Its made fullscreen by default, maybe look around the code a bit for a solution that involves the user's choice
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...
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
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?
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.

This topic is closed to new replies.

Advertisement