Hey, I have been searching this for a while now, and I cannot find a c++ code that expands the window once opened. I have found multiple codes that claim it opens it in an expanded window, but in the end all I get is compiling errors.

If someone would be so kind as to give a full example code that will open the window in a larger format, it would be greatly appreciated.

Note: I am using Visual Studios Express Edition, not sure if it matters or not..

Edit: I just realized how retarded my typo was on the header. It's supposed to be 'expanded'. Sorry..I'm tired.

Recommended Answers

All 8 Replies

This guy can do some amazing stuff with the DOS console window.. best tutorial I've seen for become a master of the console:

http://www.adrianxw.dk/index.html

I think you'd be interested in, "Win32 Console Applications - Part 6"
http://www.adrianxw.dk/SoftwareSite/Consoles/Consoles6.html

Works Great in how he made the window smaller and then back to normal again...didn't know you could do that.

However, it didn't really show me how to start it in full screen. I am really new to C++, so maybe I missed something..

If you want the CMD to be full screen, just press Alt+Enter :/

try this: compiled with vc++ 2008 express

#include <windows.h>
#include <iostream>
using std::cin;

int main()
{
    HWND hWnd = GetConsoleWindow();
    ShowWindow(hWnd,SW_MAXIMIZE);
    cin.get();
    return 0;
}

try this: compiled with vc++ 2008 express

#include <windows.h>
#include <iostream>
using std::cin;

int main()
{
    HWND hWnd = GetConsoleWindow();
    ShowWindow(hWnd,SW_MAXIMIZE);
    cin.get();
    return 0;
}

Thanks for the input...but I still get errors!! :(

1>conversation.obj : error LNK2028: unresolved token (0A0002BF) "extern "C" int __stdcall ShowWindow(struct HWND__ *,int)" (?ShowWindow@@$$J18YGHPAUHWND__@@H@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
1>conversation.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall ShowWindow(struct HWND__ *,int)" (?ShowWindow@@$$J18YGHPAUHWND__@@H@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
1>C:\Users\Jake\Documents\Visual Studio 2008\Projects\test\Debug\test.exe : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://c:\Users\Jake\Documents\Visual Studio 2008\Projects\test\test\Debug\BuildLog.htm"
1>test - 3 error(s), 0 warning(s)

It worked with me..

#include <windows.h>
#include <iostream>

//maybe you should add this
#pragma comment(lib,"kernel32.lib")
#pragma comment(lib,"user32.lib")
// this will puts a lib-search record in the object file

using std::cin;

int main()
{
    HWND hWnd = GetConsoleWindow();
    ShowWindow(hWnd,SW_MAXIMIZE);
    cin.get();
    return 0;
}

It worked with me..

#include <windows.h>
#include <iostream>

//maybe you should add this
#pragma comment(lib,"kernel32.lib")
#pragma comment(lib,"user32.lib")
// this will puts a lib-search record in the object file

using std::cin;

int main()
{
    HWND hWnd = GetConsoleWindow();
    ShowWindow(hWnd,SW_MAXIMIZE);
    cin.get();
    return 0;
}

Do you have the express edition?

Maybe you two could possibly have different compilers?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.