News:

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

Console substitute wanted

Started by Roger, June 13, 2006, 08:57:55 PM

Previous topic - Next topic

Roger

Hi All,

Is there a GUI window/contol which performs the output functionality of the console?

I have console programmes which work well enough that I now want to intigrate into the main part of my project.

I don't expect it to be quite as simple as calling GetStdHandle followed by WriteFile but everything I try either dosn't work or appears to need so much formatting, juggling with buffers and other asorted messing about that I feel sure that there must be an easy way that I have not found.

BTW one of the problems is that the text comes from different threads and not necessarily from the keyboard.

Regards Roger

raymond

Have you looked at the TextOut function, or is that insufficient.

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

Tedd

Create a popup window with a richedit (or just simple edit) control as its child, then send the text to that. It may need a little formatting, depending on what you want, but most of that can be taken care of with wsprintf.
This is what I tend to use when I want a debug type window.
Try it and shout if you get stuck :U
No snowflake in an avalanche feels responsible.

hutch--

I agree with Tedd here, if you use a rich text edit control, all you need to do is set the selection to the end of the current buffer and append the data you like after it and its easy enough to do.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

MichaelW

The attachment uses a rich edit control and macros for the print and cls functions. Using a simple edit control I could not find any border style that looked reasonable.





[attachment deleted by admin]
eschew obfuscation

P1

If you use the RichEdit control, but sure to use a monospace font, otherwise your formatting may not look like console output.

Regards,  P1  :8)

Roger

Hi All,

Thank you for your suggestions. I have tried an edit control and it worked in the serial link prog so I used it to intigrate the serial link into the main grapical display prog.

Well at least I have all my bugs in one place now! Unfortunatly they have brought a few frends along for the ride.

One of them concerns setting the focus. I am tryng to put the serial data and keyboard data in using WM_CHAR and EM_REPLACESEL which seems to work some of the time. However at times the keyboard talks directly to the edit control bypassing WM_CHAR and the carefully crafted ( :lol ) parser that it should talk to. Using the mouse on the graphics takes the focus which can only be restored by clicking on the edit control and this is the quickest way of bypassing the parser.

Is there a way of seperating mouse and keyboard focus or the equvalent of  'UnsetFocus' ?

Regards Roger

MichaelW

You could add ES_READONLY to the dwStyle parameter of CreateWindowEX. I meant to do this in my example, but forgot.

MSDN:Edit Control Styles

MSDN:Rich Edit Control Styles
eschew obfuscation

Roger

Michael,

I have tried that. It makes it ReadOnly. So EM_REPLACESEL can't write to it.

Regards Roger

EDIT
Of course there is nothing like anouncing to the world that something won't work to make it run like a dream!

MichaelW

So I take it that it does work (actually, I tested it before I posted to verify that the read only was just from the user's perspective ).


eschew obfuscation

Roger

Michael,

Yes it works thank you.

I am finding it a bit slow to test anything because the programme doesn't always exit cleanly so sometimes when I try out a change GoLink finds that it can't write the new .exe.

Regards Roger