News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

GUI console

Started by Michael, July 29, 2009, 09:22:40 AM

Previous topic - Next topic

Michael

Hello,
I've written a small program that puts up a GUI console like windows DOS box. It does look a bit nicer though because it isn't a console application. Clunky monitors had phosphor coating inside the tube, so I called it Phos  :U
I thought people could use it if they just needed a text interface, but wanted something nicer than a console app.
Use the software by adding code to procedure phos_thread, which is run in a separate thread each time a prompt line is submitted by hitting return.

A bitmap font is included, the linked exe is only 11k. It's freeware and anyone can do what they like with it - download from http://ok-schalter.typepad.com/phos-win32-standalone.zip.


ecube

welcome to the board, and nice job  :U project looks good, and the source is clean and commented.

Michael

#2
Thanks E^cube! I'm trying to factor the whole GUI part out into a DLL for using it from other languages, too. So I've transformed the asm file into DLL format by adding a DLL entry proc and making the entry code into a callable procedure. It works in the sense that the DLL builds and I can call the exported procedure from "test.asm".

The procedure naively just calls WinMain. Test.asm does create a working window, but the message loop doesn't run. I suppose test.asm already has it's own message loop and it's non-trivial to "merge" it with the one from the DLL... I'll post a DLL version as soon as I understand this message loop business better :8)

Michael

#3
If anyone is interested, I've made phos into a DLL (source + test files attached)...

[attachment deleted by admin]

Vortex

Hi Michael,

Welcome to the forum.

Nice work :U

dedndave

welcome to the forum, Michael
it looks very cool - i really like the character cell shading

ecube

a nice addition would it be able to pipe cmds to cmd.exe/command.exe and display results, I might write it for it, this really is a neat simple project, looks great. Icezlion has example pipn code

dedndave

Slugsnack has been playing wth piping, as well (in both directions)
he may also be interested in the console window
it sounds like the two of you together could be close to replacing the windows dos-box, which has several bugs

Michael

Thanks everyone for your comments :thumbu
I will do more work on it, but I just got tied in with my day job until next week  :eek.  @E^cube, brilliant idea to rework phos to behave more like cmd.exe!
Perhaps I overestimate what cmd.exe is doing besides putting up a line editor - I will look at Iczelions pipn example code... I guess it would need to use windows fonts, resizing logic etc.

Besides documentation (there is none so far), up on my list is a very simple lexical scanner and making phos work together with an sqlite db (sqlite is cool; no bloat, public domain, just a tiny dll and one DB file) in which I store lexer tokens. I've so far extended the DLL version to attach to sqlite3.dll using the ProcAddress method and execute queries, works fine. This would make it still easier to use phos for text interface. My logic is that if you're using a command line, you will need to recognize words, too, so the command line component should simplify that. I would also like to work on cleaning up and deciding on a nicer export interface. I guess what I have in mind is make Phos into a very small, semi-cool console with a small built-in command language (instead of a menu bar ;-)

p.s. please don't pull from github as I said in my first post - my repository is broken somehow and I will just post any code here - I can't get git to upload to github under windows for some reason, so I just use it locally.

Slugsnack

here's my code for a working pipe for both directions for cmd.exe. it's not what you'd call 'good code' right now since that is more a proof of concept snippet for a larger project for myself.

9dt.zwit.org

what i mean by good practice is all functions should be as independent on each other as possible. right now a lot is happening via global variables and there is a lot of dependency on them. ideally each function would work regardless of the other. how i did that in my larger project was defined my own structure that had a bunch of variables associated with it :

PIPE_WINDOW_INFORMATION STRUCT

dwID DWORD ?
hwnd DWORD ?
IDC_EDT DWORD ?
IDD DWORD ?
IDC_BTN DWORD ?
lpszInitButton DWORD ?
lpszDeactButton DWORD ?
hEdt DWORD ?
lpszExpandedCommandLine DWORD ?
dwCurrentPipeState DWORD ?
hProcess DWORD ?

PIPE_WINDOW_INFORMATION ENDS


for that project the read/write pipes are actually created as local variables which is why they aren't in there, for the rest of it it works very very similarly to how an OOP program would handle the solution i'm trying to create

Michael

The 9dt.zwit.org pipe code is very cool :dance: I hadn't thought that piping through cmd.exe was as clean as that...

I'm puzzled about the actual console window (the black default window when cmd.exe is run) and where it comes from. How does a console app get its ugly window :bg

dedndave

QuoteClunky monitors had phosphor coating inside the tube, so I called it Phos
must be ms wanted a clunky console to match - lol
i kind of liked the green p7 phospher, so long as you didn't have to look at it for too long - lol
unless i am mistaken the window comes from cmd.exe
it wouldn't be too bad, if it wasn't so buggish
especially the copy/paste debockle
with this window, you could make a nice, well-behaved console, i think

MusicalMike

I love this. Please make it possible to host the windows shell inside your console window. I would so use this over cmd.exe if it could host the windows shell.

Michael

 ::)
I've got it to do vertical resizing to get more/less lines.

The only thing that bothers me is that if you pull up/push down the top border of the window, it's sort of wobbly.
Will try to sort this out next...

Horizontal resizing will be tougher - growing the window is noob, but making the lines smaller will need to
break them into several lines :red not sure I'm to the challenge...

dedndave

i dragged the bottom down to resize - crash
exception error 0xc0000095 - integer overflow