AutoHotkey Community

It is currently May 26th, 2012, 10:48 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Cmd Wrapper
PostPosted: August 13th, 2008, 8:37 pm 
Offline

Joined: February 17th, 2008, 12:30 am
Posts: 14
Hi,

I'm playing around with this code to wrap window's cmd.exe into a gui, right now I have this, but the command window inside moveable, and I want to restrict that. Also there is some refresh problems too. Does anyone have any experience working with the console?
Code:
run,cmd,,,CmdPid
WinWait, ahk_pid %CmdPid%
; Get Windows Properties
WinGetPos,,,CmdW,CmdH, ahk_pid %CmdPid%
WinMove, ahk_pid %CmdPid%,,2,22
; Disable command from being interacted with
; WinSet,Disable,, ahk_pid %CmdPid%
; Create Gui
Gui,+Lastfound +Resize
Gui,Margin,2,2
GUI_ID := WinExist()               
WinGet, CmdId, ID, ahk_pid %CmdPid%
DllCall("SetParent", "uint", CmdId, "uint", GUI_ID)
Gui,Add,StatusBar,,Start Dyna
Gui,Add,Button,Ym gRefresh, Refresh
Gui,Show,% "W" CmdW "H" CmdH+40 ,%KillFile%

Refresh:
    WinSet,Redraw,, ahk_id %CmdId%
return

GuiClose:
    WinClose, ahk_id %CmdId%
    Exitapp
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 14th, 2008, 2:41 pm 
Offline

Joined: April 9th, 2007, 4:43 pm
Posts: 172
???
That isn't a cmd wrapper - you use the original cmd.exe (I wouldn't call it a console, it's a command prompt).

But what about a real cmd-wrapper?
Then you wouldn't have problems.

_________________
COMPLETELY INACTIVE - I do not use AHK anymore.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 14th, 2008, 3:45 pm 
Offline

Joined: November 8th, 2004, 12:46 am
Posts: 1271
It seems the cmd window doesn't respond to changes in style.

Code:
WinSet, ExStyle, +0x80, ahk_pid %CmdPid% ; WS_EX_TOOLWINDOW
WinSet, Style, -0xC00000, ahk_pid %CmdPid% ; WS_CAPTION
WinSet, Style, +0x40000000, ahk_pid %CmdPid% ; WS_CHILD


You could add GuiSize so the cmd window automatically refreshes, or even use OnMessage to refresh on mouse movements etc.

Code:
GuiSize:
Refresh:
    WinSet,Redraw,, ahk_id %CmdId%
return

_________________
"Anything worth doing is worth doing slowly." - Mae West
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 14th, 2008, 4:30 pm 
Offline

Joined: February 17th, 2008, 12:30 am
Posts: 14
Serenity wrote:
It seems the cmd window doesn't respond to changes in style.

Code:
WinSet, ExStyle, +0x80, ahk_pid %CmdPid% ; WS_EX_TOOLWINDOW
WinSet, Style, -0xC00000, ahk_pid %CmdPid% ; WS_CAPTION
WinSet, Style, +0x40000000, ahk_pid %CmdPid% ; WS_CHILD


You could add GuiSize so the cmd window automatically refreshes, or even use OnMessage to refresh on mouse movements etc.

Code:
GuiSize:
Refresh:
    WinSet,Redraw,, ahk_id %CmdId%
return


Yea, for some reason, the ConsoleClass doesn't seem to be a real window (as far as configuring the style is concerned.)

I'd like to be able to turn off the titlebar and caption buttons.

John:
I don't know what the technical term of what I'm doing is called. But I'm putting a gui around the original cmd.exe.

I don't have a purpose for this program, I'm just playing around trying to embed the prompt inside a gui so I can add controls around it later, so it's more of a test of an idea. Do you have any experience with this?

I'm not looking to write something that polls the cmd window for changes and mirrors that on a separate window, yet. Again, I'm just playing around with what I can do with this.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 14th, 2008, 4:53 pm 
Offline

Joined: April 9th, 2007, 4:43 pm
Posts: 172
Now I understand. But it isn't hard to code a cmd - but it gives much advantages:
You can add every function you like, maybe loops like in bash (a *nix shell)
You can insert code very fast (no need to simulate input)
You can make a history and a list of windows internal-programmes with description, search and other stuff (code completion...).

_________________
COMPLETELY INACTIVE - I do not use AHK anymore.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 14th, 2008, 5:10 pm 
Offline

Joined: February 17th, 2008, 12:30 am
Posts: 14
John W wrote:
Now I understand. But it isn't hard to code a cmd - but it gives much advantages:
You can add every function you like, maybe loops like in bash (a *nix shell)
You can insert code very fast (no need to simulate input)
You can make a history and a list of windows internal-programmes with description, search and other stuff (code completion...).


You sound like you already know of code that does this? Maybe I am not searching the right terms.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 20th, 2008, 3:16 pm 
Offline

Joined: April 9th, 2007, 4:43 pm
Posts: 172
Quote:
You sound like you already know of code that does this?

No, but I know what the cmd.exe does, and I can imagine how it works - it's not important what the code is or what it's written in, it's important what you want to do and how you can do the actions needed to do.

"Show me your code, but hide your data structures, and I'll trap in darkness, but show me your data structures, and I won't need your code, because I know how it should look like" (free translation of a rule of 'SelfLinux').

_________________
COMPLETELY INACTIVE - I do not use AHK anymore.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: [VxE], Google [Bot], iBob35555VR, Klark92, Tilter_of_Windmills and 60 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group