You've also tried novocain's idea?
Code:ShowWindow(hwnd,SW_SHOWMAXIMIZED);
You've also tried novocain's idea?
Code:ShowWindow(hwnd,SW_SHOWMAXIMIZED);
You mean put that in WM_CREATE? I used WS_MAXIMIZE instead of SW_SHOWMAXIMIZED (I thought it was a typo).
I went back and changed it to SW_SHOWMAXIMIZED and it had a curious effect: it maximized horizontally but not vertically.
I'm just going to start over. I always backup my programs before I start making changes. Looks like a good practice when dealing with Microsux.
mw
Blucast Corporation
The strange thing is, in the previous code you posted (the long one), I couldn't get it to compile without fixing alot of typos. So it's likely there's some typo in your code that's messing things up.
Before you give up completely, could you perhaps zip up a compilable version, which has the maximizing problem, of all your stuff (icons/source files etc) and email it to me?
danteshamest AT gmail DOT COM
I'm just curious, and would like to get to the bottom of this.
Uh- Sorry about that... The computer I program on doesn't have internet access so I had to retype it manually. It's a safety thing...
I noticed some strange things about WS_MAXIMIZE and SW_SHOWMAXIMIZED when I started over:
If I don't put WS_MAXIMIZE in my CreateWindow, then my buttons are off-centered.
If I *do* put WS_MAXIMIZE in my CreateWindow, then my buttons are centered fine AS LONG AS I put WS_MAXIMIZE in my ShowWindow function as well.
SW_SHOWMAXIMIZED is just plain weird and I can't even find it on Microsoft's library website.
Also, a new problem has come up: my program compiles and runs fine except that nothing shows up on the screen?! I have to shut it down from the Task Manager.
Since I didn't delete the program that I couldn't get working, I went back to that in desperation and it does the same thing too!?
I don't think I have a virus, since the computer I program on doesn't get on the internet.
This is why I hate Microsoft.
mw
Last edited by Lionmane; 10-14-2005 at 12:10 PM.
Blucast Corporation
Couldn't you save it into a disk, then open it up in the other computer that connects to theThe computer I program on doesn't have internet access so I had to retype it manually. It's a safety thing...
internet?
It's here.SW_SHOWMAXIMIZED is just plain weird and I can't even find it on Microsoft's library website.
I don't think it's a problem with Microsoft, really. If it isn't just your program, then alot of applications would be having this strange maximizing problem.This is why I hate Microsoft.
To test that it's just your program, try compiling the following code exactly and without making any changes. See if it displays a fullscreen maximized window. If it does, you can use it as your base code.
Code:#include <windows.h> HWND hwndMain ; LRESULT CALLBACK WndProc( HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam ) { switch(msg) { case WM_DESTROY: { PostQuitMessage(0); return 0; } default: return DefWindowProc(hwnd,msg,wParam,lParam); } } int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrev, LPSTR args, int nShow ) { MSG msg ; WNDCLASS wc = {0}; wc.lpszClassName = TEXT( "TestClass" ); wc.hInstance = hInst ; wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE); wc.lpfnWndProc = WndProc ; wc.hCursor = LoadCursor(0,IDC_ARROW); RegisterClass(&wc); hwndMain = CreateWindow( wc.lpszClassName,TEXT("Maximized Window"), WS_OVERLAPPED|WS_VISIBLE|WS_MAXIMIZE, 0,0,300,200,0,0,hInst,0); while( GetMessage(&msg,0,0,0) > 0 ) { TranslateMessage(&msg); DispatchMessage(&msg); } return (int)msg.wParam; }
Last edited by Dante Shamest; 10-14-2005 at 01:35 PM.
I noticed in your window procedure you don't declare HWND as hwndMain. Why is that? Are they not the same?
mw
Blucast Corporation
hwndMain is the global one (below the #include <windows.h>) line
hwnd is the one inside the window procedure.
Both handles refer to the same window.
How does Windows know they're both the same window?
The program doesn't create a maximized window. It creates a small window (300 x 200) in the top-left corner of the screen.
Also I had to move "MSG msg" to the top of the WinMain function to get it to compile. Is that ok?
I'm using Windoes XP home edition and MSVC++ ver 6.0 if that makes a difference...
mw
Blucast Corporation
Because I only create one window.How does Windows know they're both the same window?
Yes, it should be okay. I forgot you're using C. Anyway, I've edited the code to reflect the changes. You've not changed anything else, right?Also I had to move "MSG msg" to the top of the WinMain function to get it to compile. Is that ok?
Hmm, very strange indeed. I admit, I am totally stumped. It creates a fullscreen maximized window on my computer.The program doesn't create a maximized window. It creates a small window (300 x 200) in the top-left corner of the screen.
I'm using Windows XP Professional, Dev-C++.
Edit: Wait, if I run my program outside my IDE, I get the same thing as you.
But if I add this code
After CreateWindow, I get a maximized window everytime.Code:ShowWindow( hwndMain, SW_SHOWMAXIMIZED );
Last edited by Dante Shamest; 10-14-2005 at 01:43 PM.
Okay, I've uploaded my program that comes with an .EXE and .C
http://www.abdn.ac.uk/~u02cll2/maximized.zip
Check whether it maximizes on your computer.
If I do the ShowWindow like you did then I get the maximized window too.
What is "IDE"?
I'll have to wait for my friend to bring the USB floppy... :-)
mw
Blucast Corporation
Cool. Hope we're getting closer to solving this.If I do the ShowWindow like you did then I get the maximized window too.
Integrated Development Environment. Basically your development environment. For me, it's Dev-C++.What is "IDE"?
Ok, I ran the executeable and it maximized the window BUT...
The source code has the "ShowWindow( hwndMain, SW_SHOWMAXIMIZED );" function in it. Did you intend to include that?
mw
Blucast Corporation
Yes. If you see the styles I passed inside CreateWindow(), there was only WS_OVERLAPPED.
But I thought we were testing to see if it would maximize normally (ie: without the ShowWindow)...?
mw
Blucast Corporation