Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Close DOS application command

Posted on 2000-03-18
8
Medium Priority
?
404 Views
Last Modified: 2010-04-10
May I know is there any C or C++ command that will close the C++ application? To close means close the window entirely. If there isn't any C or C++ command then is there any DOS command that will close a window? Example "start" command will open an application but I want a close window command.

hongjun
0
Comment
Question by:hongjun
[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
8 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2632563
  HOWTO: Terminate an Application "Cleanly" in Win32
http://support.microsoft.com/support/kb/articles/Q178/8/93.ASP


0
 
LVL 33

Author Comment

by:hongjun
ID: 2632610
AlexVirochovsky,
I think I cannot understand the entire source code given in the webpage you gave me.

hongjun
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2633347
Hi. Next is small explanation of example from article.
1. Must enumerate all processes in Memory
   For this must use Process32First/Process32Next Api
2. Find you Apps(by name)
3. Close it (sending WM_CLOSE)
A bit other (but good too) way see in
http://www.codeguru.com/win32/ps.shtml
0
Technology Partners: 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!

 
LVL 86

Expert Comment

by:jkr
ID: 2634220
>>May I know is there any C or C++
>>command that will close the C++
>>application?

This is OS specific, not language specific...

Do you just want to hide the window or to exit/terminate the application? Are you talking about a 'real' DOS app or a Win32 console application? Are you using NT or Win9x?
0
 

Expert Comment

by:JeffP
ID: 2634463
Not sure what you are trying to do here, but if you are trying to simply close the console-window for the application you are running, there is a way to terminate your console without terminating your application.  If this is what you are after, let me know and I will comment more fully.

JeffP
0
 
LVL 33

Author Comment

by:hongjun
ID: 2636143
I have downloaded the example source code from the codeguru site but it cannot work.
I am using VC++ 6.0.

hongjun
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 150 total points
ID: 2636481
What name you use for kill apps?
For dos there is special name:
"WINOA386.MOD". Testx must be as:

if (strstr(proc.szExeFile, "WINOA386.MOD"))
          {
           // close dos process
//by kill/or sendmessang WM_CLOSE
          }

    while (Process32Next(snapshot, &proc) == TRUE)
      {
        strupr(proc.szExeFile);
        if (strstr(proc.szExeFile, "WINOA386.MOD"))
          {
             //dos process
          }
      }
/*
0
 
LVL 33

Author Comment

by:hongjun
ID: 2638776
I don't think I am able to understand a single thing. But thanks for all your help especially AlexVirochovsky.

Thanks
hongjun
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

618 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