Solved

Hiding MS-DOS prompt from taskbar

Posted on 2000-02-26
15
338 Views
Last Modified: 2010-05-18
Hi!

Is there any way to hide the MS-DOS prompt in such a way that it wouldn't be visible anywhere? ( It shouldn't be possible to ALT-TAB it, it should not be visible on the taskbar...it should not be visible anywhere)

Thanx
0
Comment
Question by:xmary
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 4
  • +2
15 Comments
 

Author Comment

by:xmary
ID: 2561798
Maybe i should be more specific. I'd like to run a MS-DOS application in the background of my Delphi application, and I wouldn't like that it would be displayed in the taskbar or anywhere else.
0
 
LVL 1

Expert Comment

by:cobramania
ID: 2561846
Use this to hide it:

ShowWindow(WindowHandle,SW_HIDE);

But at first you have to get the window handle first...
0
 
LVL 7

Expert Comment

by:ahalya
ID: 2561917
xmary,
if you just call ShowWindow(handle, SW_Hide), the use will still SEE it in the tasklist (by pressing CTRL-ALT-DEL).  It wouldn't be called MS-DOS prompt, but as "WinOLDAp".

The proper solution would be hide the window, and then remove it from task list. Sample code follows:


function RegisterServiceProcess (ThreadID : THandle; Flags : Integer):
Integer; stdcall; external kernel32 name 'RegisterServiceProcess';

procedure CompletelyHideWindow(classname, caption:pchar);

var h  : HWND ;
     PID : THandle;


begin;
h := FindWindow(className, Caption);
ShowWindow(h, SW_HIDE);
GetWindowThreadProcessID(h, @PID);
RegisterServiceProcess (PID, 1);
end;

assuming the window caption is "MS-DOS Prompt" then you'll call the funtion as

CompletelyHideWindow('tty', 'MS-DOS Prompt');

to fully hide it from the user.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 7

Expert Comment

by:ahalya
ID: 2561919
I guess that's good enough to be an answer :-)
0
 

Author Comment

by:xmary
ID: 2562236
To ahalya:

Hi!  Your answer is excellent and I will certainly evaluate but i have a little request. I run the MS-DOS program or the MS-DOS prompt simpy by calling the WinExec function. After that call i put the call of your function, for example: CompletelyHideWindow('tty', 'MSCDEX'); , but it does not hide it. You code works if you manually run the MS-DOS window and then call your CompletelyHideWindow function. Have i done something wrong?

Thanx again
0
 
LVL 7

Accepted Solution

by:
ahalya earned 80 total points
ID: 2562626
xmary,

Well, you are. Here are the possibilities:

(1)  you probably are not giving enough time for mscdex to start.
(2) you are not giving the correct window caption.

The following code works fine on my machine !
Here I make loop to make sure mscdex has started & give the correct caption as it appears in the prompt. You will have to change the Caption as necessary.  (Also note I'm using SW_Hide in WinExec)

begin;
if (FindWindow('tty', 'Finished - mscdex') <> 0) then exit;

WinExec('mscdex', sw_Hide);
repeat
  application.processmessages;
until IsWindow(FindWindow('tty', 'Finished - mscdex'));
CompletelyHideWindow('tty', 'Finished - mscdex');

end;


> Your answer is excellent and I will certainly evaluate
i thank you for the complement, but you DID reject my answer !!

>  but i have a little request
in the future if you think someone's answer is excellent then make your requests/comments without rejecting the answer.  
0
 
LVL 7

Expert Comment

by:ahalya
ID: 2562628
btw, you also have to make sure that there is only one instance of mscdex running (otherwise FindWindow may find the "wrong" window)
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2563981
Why don't you simply use

  WinExec('blabla', SW_HIDE);

?
0
 
LVL 3

Expert Comment

by:gandalf_the_white
ID: 2564057
listening...
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2564266
Hey gandalf, I always thought, it was "Gandalf the Gray"!?
0
 
LVL 3

Expert Comment

by:gandalf_the_white
ID: 2565224
yes you are right
at the beginning he was gandalf the gray
in the mountains the party met balrog and it looked like gandalf hadn't survived the battle

but he came back as gandalf the white :-)

btw normally i log in as gandalf but it was already occupied
so i had to switch
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2565431
Ohmm... I guess I should read the books again. I had in mind that Saruman (was that his name?) was "the white" one...   :-)
0
 
LVL 3

Expert Comment

by:gandalf_the_white
ID: 2579739
saruman at isengart was had brown as color
(at least in the german version never got a chance to get
the "real" english version)
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2579879
Na, rat' mal, welche Ausgabe ich gelesen habe...   (-:

Sorry, xmary for misusing your question for chatting.
0
 
LVL 3

Expert Comment

by:gandalf_the_white
ID: 2601697
bin es gar nicht gewohnt, etwas auf deutsch zu posten :-)

and sorry for chatting...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month6 days, 15 hours left to enroll

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question