Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

UFCPP - The Unofficial Fullscreen Command Prompt Patcher


  • Please log in to reply
30 replies to this topic
joedf
  • Members
  • 799 posts
  • Last active: Today, 08:17 AM
  • Joined: 20 May 2012

UFCPP - The Unofficial Fullscreen Command Prompt Patcher
UFCPP_Logo.png By Joe DF
 
Basic Description
Script Function:
      Make Cmd Fullscreen with a Hotkey: Alt+Enter (Customizable)
      + Hotkey to open a new cmd window: Ctrl+Win+C (Customizable)
 
This is FREE software and should not be sold.

 

Version 2.8.4
- Better Hotkey handling in HotkeyGUI Via Fork of HotkeyControl.ahk by A_Samurai

- bugfix: Get Function Name in Error Handling

 
Download - View Source - Project Page
screen3_2.8c.png

 

Special Thanks to: Lexikos, DataLife, A_Samurai and Linear Spoon
 
Old Post:

Spoiler



Lexikos
  • Administrators
  • 9449 posts
  • Last active:
  • Joined: 17 Oct 2006

I believe you can control the console window in the same way that any console app would, by first attaching to it. I think resizing the window would go something like this:

  • AttachConsole(PID of any process attached to the target console).
  • f := FileOpen("CONOUT$", "w"), h := f.__Handle to get the console screen buffer handle.
  • SetConsoleWindowInfo to resize the window.
  • FreeConsole to detach from the console (note you can only attach to one at a time).

Browse the Console Functions to get an idea of what else you can do.



joedf
  • Members
  • 799 posts
  • Last active: Today, 08:17 AM
  • Joined: 20 May 2012
I believe you can control the console window in the same way that any console app would, by first attaching to it. I think resizing the window would go something like this:
  • AttachConsole(PID of any process attached to the target console).

  • f := FileOpen("CONOUT$", "w"), h := f.__Handle to get the console screen buffer handle.

  • SetConsoleWindowInfo to resize the window.

  • FreeConsole to detach from the console (note you can only attach to one at a time).

Browse the Console Functions to get an idea of what else you can do.

 

Thanks! :D ill work on it!



DataLife
  • Members
  • 993 posts
  • Last active: Yesterday, 09:30 PM
  • Joined: 27 Apr 2008

Very nice. I use the command prompt almost everyday.

 

I get the message "This system does not support fullscreen mode" when I press Alt Enter to make fullscreen and when I press Alt Enter to make normal size. 

 

It stills makes it fullscreen but is there a way to suppress this message?

 

Edit: 12-28-12 - The Alt Enter hotkey causes the "This system does not support fullscreen mode" message.

Change Alt Enter to any other hotkey and that message will not appear.



joedf
  • Members
  • 799 posts
  • Last active: Today, 08:17 AM
  • Joined: 20 May 2012

-

 

Very nice. I use the command prompt almost everyday.

 

I get the message "This system does not support fullscreen mode" when I press Alt Enter to make fullscreen and when I press Alt Enter to make normal size. 

 

It stills makes it fullscreen but is there a way to suppress this message?

 

Really?, oh well good and bad to know, you/me could try to add a fix to Winactivate then close the window... tongue.png

Ill work on it later... tongue.png Thx, for saying! It helps me to make a better program! biggrin.png



DataLife
  • Members
  • 993 posts
  • Last active: Yesterday, 09:30 PM
  • Joined: 27 Apr 2008

Here is the window title

Administrator: C:\Windows\system32\cmd.exe

 

Here is the window text 

This system does not support fullscreen mode.

 

It has an OK button.

 

Hope this helps.
 

 

Edit: 12-28-12 - The Alt Enter hotkey causes the "This system does not support fullscreen mode" message.

Change Alt Enter to any other hotkey and that message will not appear.



DataLife
  • Members
  • 993 posts
  • Last active: Yesterday, 09:30 PM
  • Joined: 27 Apr 2008

Why do I have to apply the patch everytime I restart the script?

 

-------------------------------------------------

Edit: 12-28-12 - The Alt Enter hotkey causes the "This system does not support fullscreen mode" message.

Change Alt Enter to any other hotkey and that message will not appear.

 

-------------------------------------------------

 

Here is my solution to closing the "This system does not support fullscreen mode." window.

 

Add 

SetTimer,WatchForWindow,10

 

 to your Alt Enter hotkey after

IfWinActive, ahk_class ConsoleWindowClass

 

Add this code after any Return

WatchForWindow:
IfWinExist,Administrator: C:\Windows\system32\cmd.exe
 {
  SetTimer,WatchForWindow,off
  WinWaitActive,Administrator: C:\Windows\system32\cmd.exe
  ControlClick,Button1, A
 }
return

 

Seems to work very well.



joedf
  • Members
  • 799 posts
  • Last active: Today, 08:17 AM
  • Joined: 20 May 2012

1. what do mean? you the tray menu then apply patch?, if so thats for the registry method...

if the registry patch is not applied, it will use the "mode con" method (default), also you could

also just add it to a startup script or just the plain old "StartUp" folder... :p

 

2. Sure, ill check it out... thanks



DataLife
  • Members
  • 993 posts
  • Last active: Yesterday, 09:30 PM
  • Joined: 27 Apr 2008

When I start the program and choose Open Command Prompt I get the command prompt window.

 

I press Alt Enter and the command prompt window resizes to half my screen and only on the left side. The dos prompt shows

 

con:cols=160 lines =300

The system cannot find the path specified.

 

I have to apply the registry patch then choose Open Command Prompt and press Alt Enter and it works great.

 

I can choose Open Command Prompt and press Alt Enter many times and it works great,  UNLESS

 

I exit the program and restart it. Then the process starts all over again and the Fullscreen will not  work unless I apply the patch again.

 

I am using windows 7 home premium with UAC turned off.



joedf
  • Members
  • 799 posts
  • Last active: Today, 08:17 AM
  • Joined: 20 May 2012

really??, so the "Mode con" method doesnt seem to work with you sad.png

 

and the registry patch is removed when the program exits... i could make a version with only the registry patch...

 

what does your command prompt display when you put this command: "mode" ?

 

also, did you compile it with AHK_L 1.1.09.02 ??



DataLife
  • Members
  • 993 posts
  • Last active: Yesterday, 09:30 PM
  • Joined: 27 Apr 2008

I don't see how the registry patch could remove itself upon exit.

 

I just tried it again and it does the exact same thing as described above.

 

When I type "mode"

 

Using the command prompt  WITH the "patch" gives me

 

Status for device COM3:

--------------------------------

Baud:                    115200

Parity:                    None

Data Bits:               8

Stop Bits:               1

Timeout:                ON

XON/XOFF:           OFF

CTS handshaking: OFF 

DSR handshaking: OFF

DSR sensitivity:      OFF

DTR circuit:            ON

RTS circuit:            OFF

 

Status for device CON:

------------------------------

Lines:                     300

Columns:                160

Keyboard rate:        31

Keyboard delay:      1

Code page:              437

 

Using the command prompt WITHOUT the "patch" gives me

 

Status for device COM3:

--------------------------------

Baud: 115200

Parity: None

Data Bits: 8

Stop Bits: 1

Timeout: ON

XON/XOFF: OFF

CTS handshaking: OFF

DSR handshaking: OFF

DSR sensitivity: OFF

DTR circuit: ON

RTS circuit: OFF

 

Status for device CON:

------------------------------

Lines: 300

Columns: 80

Keyboard rate: 31

Keyboard delay: 1

Code page: 437

 

I compiled it with Autohotkey_L Version 1.1.08.01 Ansi 32 bit



joedf
  • Members
  • 799 posts
  • Last active: Today, 08:17 AM
  • Joined: 20 May 2012

1. actually, when the program starts, it checks the registry and saves the settings in variables,

when you select quit, the program apply the saved settings, then exits.

 

2. Its very weird that "mode con" doesnt work... :p

try this command manually: "mode con:cols=80 lines=300", thats suppose to change the window's maximum size..



joedf
  • Members
  • 799 posts
  • Last active: Today, 08:17 AM
  • Joined: 20 May 2012

im having trouble, trying to make the newer version using the WinAPI method

 

;ufcpp v3 - test dllcall -> Kernel32.dll
;---------------------------------------------------------

#Include <_Struct>

;start a cmd window with a PID
Run, %comspec% /k,, , cPID
MsgBox %cPID% PID

;AttachConsole() http://msdn.microsof...ibrary/ms681952
cmdlaunched := DllCall("AttachConsole", "int", cPID, "int")
MsgBox %cmdlaunched% attached

;Create structure SMALL_RECT

cmdW := new _Struct("RECT")
cmdW.Top := 0
cmdW.Left := 0
cmdW.Right := 80
cmdW.Bottom := 200


MsgBox Structure created

;Get Console screen buffer handle, from Lexikos ; http://www.autohotke...er/#entry561509
f := FileOpen("CONOUT$", "w"), h := f.__Handle

MsgBox Got handle

;set Console window size with SMALL_RECT -> cmdW
DllCall("SetConsoleWindowInfo", "int", h, "int", "1", Ptr, &RECT)

MsgBox resized

 

 

I dont know how to create structure?, autohotkey crashes :p, can anyone help?



Lexikos
  • Administrators
  • 9449 posts
  • Last active:
  • Joined: 17 Oct 2006

What is RECT? Surely you want the address of the cmdW structure. I think cmdW[] returns the address.

 

However, RECT is the wrong type. That function requires SMALL_RECT, which uses 16-bit (short) coordinates. Since the struct is only 8 bytes (64 bits), you can use "int64*", left | (top<<16) | (right<<32) | (bottom<<48). It will fail if the size is too large (200 rows is too many).



just me
  • Members
  • 1462 posts
  • Last active:
  • Joined: 28 May 2011
You might try this:
 
Maximize(HSTDOUT) {
   ; HSTDOUT: Handle to the standard output device. Initially, this is the active console screen buffer, CONOUT$.
   If !(COORD := DllCall("Kernel32.dll\GetLargestConsoleWindowSize", "Ptr", HSTDOUT, "UInt"))
      Return False
   If !DllCall("Kernel32.dll\SetConsoleScreenBufferSize", "Ptr", HSTDOUT, "UInt", COORD, "UInt")
      Return False
   If !(HWND := DllCall("Kernel32.dll\GetConsoleWindow", "UPtr"))
      Return False
   WinMaximize, ahk_id %HWND%
   Return True
}