News:

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

Main Menu

New API functions?

Started by felipe, June 09, 2017, 03:21:53 PM

Previous topic - Next topic

felipe

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:


jimg


felipe

Quote from: jimg on June 09, 2017, 03:47:48 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:

jj2007

Very old function but...

include \masm32\MasmBasic\MasmBasic.inc      ; download
  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:
Funzione non supportata dal sistema in uso.
Funzione non supportata dal sistema in uso.

felipe

Quote from: jj2007 on June 09, 2017, 11:44:57 PM
Very old function but...

include \masm32\MasmBasic\MasmBasic.inc      ; download
  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:
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:

LiaoMi

Quote from: felipe on June 09, 2017, 11:34:06 PM
Quote from: jimg on June 09, 2017, 03:47:48 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


jj2007

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
  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:
Funzione non supportata dal sistema in uso.
Funzione non supportata dal sistema in uso.
better: Operazione completata.

felipe

Thanks for your help. I tried what you said,  but i can't get it.  :(


jj2007

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.

felipe

Ok JJ, thanks for the reply, i think i should forget that function and go on.  :icon_mrgreen:

hutch--

 :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.

jj2007

Right, I just checked on Win10: it works :dazzled:

felipe

Yes, but in windows 8.1 it doesn't.

aw27

Quote from: 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.

I use ALT ENTER for full screen, and again to leave full screen. It works since XP.

jj2007

Quote from: aw27 on June 11, 2017, 05:44:59 AMI 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.