The MASM Forum

General => The Workshop => Topic started by: felipe on June 09, 2017, 03:21:53 PM

Title: New API functions?
Post by: felipe on June 09, 2017, 03:21:53 PM
Hi, i want to use the function SetConsoleDisplayMode, but is not defined in the kernel32.inc file. So what should i do to use that function?  :eusa_snooty:

Title: Re: New API functions?
Post by: jimg on June 09, 2017, 03:47:48 PM
it's in kernl32p
Title: Re: New API functions?
Post by: felipe on June 09, 2017, 11:34:06 PM
it's in kernl32p

Thanks jimg. You are right, but in the system that dll doesn't exist, so how can i use those functions?  :eusa_snooty:
Title: Re: New API functions?
Post by: jj2007 on June 09, 2017, 11:44:57 PM
Very old function but...

include \masm32\MasmBasic\MasmBasic.inc      ; download (http://masm32.com/board/index.php?topic=94.0)
  Init
  Dll "Kernel32"
  Declare void SetConsoleDisplayMode, 3
  SetConsoleDisplayMode(rv(GetStdHandle, STD_OUTPUT_HANDLE), CONSOLE_FULLSCREEN_MODE, 0)
  Print Err$()
  SetConsoleDisplayMode(rv(GetStdHandle, STD_OUTPUT_HANDLE), CONSOLE_WINDOWED_MODE, 0)
  Inkey Err$()
EndOfCode


Output:
Code: [Select]
Funzione non supportata dal sistema in uso.
Funzione non supportata dal sistema in uso.
Title: Re: New API functions?
Post by: felipe on June 09, 2017, 11:51:23 PM
Very old function but...

include \masm32\MasmBasic\MasmBasic.inc      ; download (http://masm32.com/board/index.php?topic=94.0)
  Init
  Dll "Kernel32"
  Declare void SetConsoleDisplayMode, 3
  SetConsoleDisplayMode(rv(GetStdHandle, STD_OUTPUT_HANDLE), CONSOLE_FULLSCREEN_MODE, 0)
  Print Err$()
  SetConsoleDisplayMode(rv(GetStdHandle, STD_OUTPUT_HANDLE), CONSOLE_WINDOWED_MODE, 0)
  Inkey Err$()
EndOfCode


Output:
Code: [Select]
Funzione non supportata dal sistema in uso.
Funzione non supportata dal sistema in uso.

So is in fact an old dll that is omitted in the new windows versions?  :shock:
Title: Re: New API functions?
Post by: LiaoMi on June 09, 2017, 11:59:09 PM
it's in kernl32p

Thanks jimg. You are right, but in the system that dll doesn't exist, so how can i use those functions?  :eusa_snooty:

This is not a dll, it's an add-on over kernel, to include these prototypes you need Inc and Lib files - https://msdn.microsoft.com/en-us/library/windows/desktop/ms686028(v=vs.85).aspx
You can try to load the library manually, with
       
LoadLibrary
GetModuleHandle
GetProcAddress

Or you can manually register a prototype - SetConsoleDisplayMode PROTO STDCALL :DWORD,:DWORD,:DWORD

Title: Re: New API functions?
Post by: jj2007 on June 10, 2017, 12:07:34 AM
Try the attachment. You can't get any closer, since the console misbehaves - no fine-tuning with MoveWindow, unfortunately.

include \masm32\MasmBasic\MasmBasic.inc      ; download (http://masm32.com/board/index.php?topic=94.0)
  SetGlobals rc:RECT, py
  Init
  Dll "Kernel32"
  Declare void SetConsoleDisplayMode, 3
  SetConsoleDisplayMode(rv(GetStdHandle, STD_OUTPUT_HANDLE), CONSOLE_FULLSCREEN_MODE, 0)
  Print Err$()
  SetConsoleDisplayMode(rv(GetStdHandle, STD_OUTPUT_HANDLE), CONSOLE_WINDOWED_MODE, 0)
  Print Err$()
  ClearLastError
  invoke SystemParametersInfo, SPI_GETWORKAREA, 0, addr rc, 0
  invoke GetSystemMetrics, SM_CYCAPTION
  neg eax
  mov py, eax
  add rc.right, 6
  add rc.bottom, 6
  invoke MoveWindow, rv(GetConsoleWindow), -6, py, rc.right, rc.bottom, 1
  Inkey "better: ", Err$()
EndOfCode


Output:
Code: [Select]
Funzione non supportata dal sistema in uso.
Funzione non supportata dal sistema in uso.
better: Operazione completata.
Title: Re: New API functions?
Post by: felipe on June 10, 2017, 03:09:15 AM
Thanks for your help. I tried what you said,  but i can't get it.  :(

Title: Re: New API functions?
Post by: jj2007 on June 10, 2017, 03:52:44 AM
You will not get it. It's simply impossible for any Windows version starting with Vista. My code shows an approximation, but it remains a window... no full screen.
Title: Re: New API functions?
Post by: felipe on June 10, 2017, 03:55:09 AM
Ok JJ, thanks for the reply, i think i should forget that function and go on.  :icon_mrgreen:
Title: Re: New API functions?
Post by: hutch-- on June 10, 2017, 10:23:47 AM
 :biggrin:

Even Microsoft don't get it wrong all of the time, the console in Win 10 64 bit can be set at full screen and its a lot faster than even the console in Win7 64.
Title: Re: New API functions?
Post by: jj2007 on June 10, 2017, 10:41:00 AM
Right, I just checked on Win10: it works :dazzled:
Title: Re: New API functions?
Post by: felipe on June 10, 2017, 10:47:52 AM
Yes, but in windows 8.1 it doesn't.
Title: Re: New API functions?
Post by: aw27 on June 11, 2017, 05:44:59 AM
:biggrin:

Even Microsoft don't get it wrong all of the time, the console in Win 10 64 bit can be set at full screen and its a lot faster than even the console in Win7 64.

I use ALT ENTER for full screen, and again to leave full screen. It works since XP.
Title: Re: New API functions?
Post by: jj2007 on June 11, 2017, 09:41:31 AM
I use ALT ENTER for full screen, and again to leave full screen. It works since XP.

It works in XP and Win10, but not in Win7.
Title: Re: New API functions?
Post by: aw27 on June 13, 2017, 12:01:52 AM
I use ALT ENTER for full screen, and again to leave full screen. It works since XP.

It works in XP and Win10, but not in Win7.
Yeap.  :(
There a trick for it, but we need to disable the Aero theme.
Title: Re: New API functions?
Post by: jj2007 on June 13, 2017, 12:28:01 AM
There a trick for it, but we need to disable the Aero theme.

I don't use Aero. What is the trick? Alt Enter in a console window certainly doesn't work...

I noticed, though, that DirectShow has a full screen mode, and it works.

Title: Re: New API functions?
Post by: aw27 on June 13, 2017, 12:32:13 AM
There a trick for it, but we need to disable the Aero theme.
I don't use Aero. What is the trick? Alt Enter in a console window certainly doesn't work...
I noticed, though, that DirectShow has a full screen mode, and it works.
I had to make a search because I don't remember exactly were I read it.
I found this: http://www.wikihow.com/Fix-Full-Screen-Command-Prompt
But I think there is another way.