How am I able to make the following program (as a school project) launch fullscreen without pressing Alt+Enter efter it has launched
Code:#include <stdio.h>
int main()
{
while(1)
printf("10010101101010011010100110010");
return 0;
}
Printable View
How am I able to make the following program (as a school project) launch fullscreen without pressing Alt+Enter efter it has launched
Code:#include <stdio.h>
int main()
{
while(1)
printf("10010101101010011010100110010");
return 0;
}
u have to use windows api for that.
IIIRC you need to use the windows api call to send key presses to the window (look it up I can't remember what it's called). Is there any real reason to use fullscreen? You really shouldn't unless you need to; I can't think of any reason why.
What the heck kind of retarded question is this?
if i was moderator, i would kick your ass homeyg.
it is not the most eloquent way to do it ... but here's a way:
This sumulates a virtual keystroke of ALT and ENTER ... include windows.h and put that hunk of code at the start .... I think I have another way of doing it, if I do, i'll post it.Code:
keybd_event(VK_MENU, 0, 0, 0);
keybd_event(VK_RETURN, 0, 0, 0);
keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
SetConsoleDisplayMode ,,check out msdn for more information on this
One about how to make a program run fullscreen :pQuote:
Originally Posted by homeyg
Where did i put this if it was after main() then it will still run in a small window and not make it full screen.Quote:
Originally Posted by twomers
Just in case you are wondering this is what it looks like now
Code:#include <stdio.h>
#include <windows.h>
int main()
{
keybd_event(VK_MENU, 0, 0, 0);
keybd_event(VK_RETURN, 0, 0, 0);
keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
while(1)
printf("10010101101010011010100110010");
return 0;
}
this should workCode:#include <stdio.h>
#include <windows.h>
void launchfullscreen(void)
{
COORD coordScreen = { 0, 0 };
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleDisplayMode(hConsole,1,&coordScreen);
}
int main()
{
launchfullscreen();
printf("10010101101010011010100110010");
return 0;
}
just a few problems with this (within the coding)
binary.cpp: In function `int main()':
binary.cpp:9: error: `launchfullscreen' undeclared (first use this function)
binary.cpp:9: error: (Each undeclared identifier is reported only once for each function it appears in.)
binary.cpp: In function `void launchfullscreen()':
binary.cpp:16: error: `void launchfullscreen()' used prior to declaration
binary.cpp:22: error: `SetConsoleDisplayMode' undeclared (first use this function)
That is a little beyond my ability to trouble sshoot that at the moment
that reminds me to read more tutorial
try including wincon.h;
works just fine on my machine,,compiler dmc, and dont type the code,use copy and paste.
DEV C++ Still doesn't like line 12 although this has fixed the rest of its moaning
LOG For the record:
C:\Documents and Settings\msmith\Desktop\binary.cpp: In function `void launchfullscreen()':
C:\Documents and Settings\msmith\Desktop\binary.cpp:12: error: `SetConsoleDisplayMode' undeclared (first use this function)
C:\Documents and Settings\msmith\Desktop\binary.cpp:12: error: (Each undeclared identifier is reported only once for each function it appears in.)
yeah u have to update your wincon.h file,,,
so go to include folder search for wincon.h
scroll through it,,make sure u have the right file,where u see some functions,
add this :
WINBASEAPI
BOOL
WINAPI
SetConsoleDisplayMode(
HANDLE hConsoleOutput,
DWORD dwFlags,
PCOORD lpNewScreenBufferDimensions
);
if that wincon points to another wincon inside another folder ,go there.
is there a way to make the screen a higher resolution using SetConsoleDisplayMode()?