Unattended application...

E

Eric Robert

Hi,



I think I've tried everything I can without success. I want to bundle an
application that can run unattended or not. That's means it can behave like
a normal window application or a command line one i.e. with a standard
input, output and error.



If I make a console application, I can't seem to be able to get rid of the
console window by any means. Anyway, it would probably popup in "window
mode" since it has to execute a bit before being hidden and that would be
kind of ugly.



If I make a window application, I don't have standard streams. I've been
trying to find the process that started me to see if I could use its
standard streams. I don't know if it's even possible!



If it is, can someone show me some pointers? If not, any alternative besides
having two executable?




Thanks!




Eric Robert
 
E

Eric Robert

Sorry but this is not what I want. The console window isn't my child window.
It "could" be my parent (if only I could find how to know that...). But your
suggestion is to hide the child window. This makes no sense...
 
E

Eric Robert

Just to clarify things. If you create a C# window application and change it
to console after (via the property menu), you have 2 windows poping up - one
is the console and the other is the form. If I put a button and break in it,
I see only one thread. If I look at both windows, the form isn't responding
(that's fine) and the other behave normaly. So, they must be in separate
process... right? I don't see how it could be otherwise.

So, it can't be my parent window. It is my "parent" process's window. And it
is those streams that I'm after!

Eric Robert
 
A

AlexS

You can rid of console using SetParent (Win32 api) with HWND_MESSAGE
parameter.
Check both in Platform SDK.

Tested and works
HTH
Alex
 
E

Eric Robert

Well, I've tried to use that function... And I have look in the Platform SDK
but maybe you're right and I have miss something. I just wish I'd know what
;-)

Thanks anyway!
Eric
 
A

AlexS

Eric,

just try the suggestion. To understand what's going on and who's whose child
you might need to read Platform SDK docs on consoles. It's very different
type of beast than standard forms. Console class in .Net exposes some of
properties of this beast, but not all of them. That's why to do this trick
you have to use SetParent. You can forget about child windows...

I suggested this because it works for me - I can hide/show console at will,
control its size and location, colors etc. and make it my child window

HTH
Alex
 
E

Eric Newton

Maybe try system tray? and not basing code in a form but instead in a class
instantiated by the Main method?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top