News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

console flexibility

Started by felipe, March 11, 2019, 07:34:53 AM

Previous topic - Next topic

felipe

i have tried to locate the console window created on an arbitrary location of the screen, also i have choose the size of the console window. The best (as in flexible) apprach has been using CreateProcess because allows you to do all this thing with the STARTUPINFO structure, when creating a console for the new process.
I have tried too with a bloody combination of SetConsoleWindowInfo, SetScreenBuffer, GetConsoleWindow (not in windows.inc) and MoveWindow (not in windows.inc). But this approach dosen't work so well (if well at all). It's not flexible enough so you can choose a window size bigger than the screen buffer size (which with CreateProcess you can).
The bad news is that with the CreateProcess approach, you need a special "launcher" program (which creates the new process with this console) and the program that will use the console: which are 2 executables for the "user" (me?  :P)...
SetConsoleDisplayMode with FULL_SCREEN dosen't work in windows 8.1 either... :idea:

felipe

here it's an example of what i say above. If you don't change the code, you need to run the "launcher" program in the same folder than the "test" program. If you execute "test" you will not see what i was talking above.
So, "launcher" will create a new process with a new console attached to it and it will create special settings (i mean customized ones) for the console when showed at the first time, using the STARTUPINFO structure. So this console (in this example) will be centerd in your screen and will have a fixed window size (800x600). I have created a big buffer where you can see "happy faces" writed and you can type up to 10000 characters too. But you can safely change the screen buffer in the structure to make it smaller (like 80x25 for example) and the console will not suffer in it's format for that (which is not the case when usign the other approach mentioned above).
.asms and .exes in the .zip file attached...  :icon14:

hutch--

When I start the launcher, the test.exe runs and its full of smilies, I forget the ascii code. Is this what its supposed to do ?

felipe

yes. the ascii code is 02h. the main idea is to show that the console window can be placed wherever you want using CreateProcess.

daydreamer

it also changes scrollbar ,is it new console game coming?
If thats so,maybe windowsapp with textarea would be an alternative,that maybe has better ways to control window
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

felipe


daydreamer

Quote from: felipe on March 12, 2019, 03:45:44 AM
Quote from: daydreamer on March 12, 2019, 02:18:46 AM
it also changes scrollbar

what do you mean with that?
to see the difference I ran test without launcher first and the scrollbar shows a centimetersized control almost in the middle in a standard console size rectangular,almost leftmost/uppermost screencorner
after that I ran the launcher and the bigger squaresized console window centered on screen,with scrollbar almost uppermost and the control the minimum 2millimeter flat size
FULLSCREEN doesnt work here
but maybe this is an alternative api to use only for that
http://www.directxtutorial.com/Lesson.aspx?lessonid=11-4-4
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding