Solved

Use DOS-based pic. converter

Posted on 1998-02-10
3
172 Views
Last Modified: 2010-04-10
I am wondering how I can use a DOS-based pic. converter from a self-made program.
I have not made the program I am going to use it in, but I am probably  going to use VC++. One of the things my program is going to do is to take a picture in Targa format and convert it to another format. There are only one program that can convert to the format I need and it is a DOS-program.
The syntax for using it is: converter.exe pic.tga pic.fff

So my question is:
Can this be done?
And if it can:
How?
0
Comment
Question by:Krafer
[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
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 150 total points
ID: 1181700
STARTUPINFO StartupInfo =
{
    sizeof(STARTUPINFO),
    NULL,
    NULL,
    NULL,
    0, 0,
    0, 0,
    0, 0,
    0,
    STARTF_USESHOWWINDOW,
    SW_HIDE,
    0,
    NULL,
    NULL,
    NULL,
    NULL
};

PROCESS_INFORMATION ProcessInformation;

CString strCmdLine = _T("converter.exe pic.tga pic.fff");

if (!::CreateProcess(NULL,
                     strCmdLine,
                     NULL,
                     NULL,
                     TRUE,
                     0,
                     NULL,
                     NULL,
                     &StartupInfo,
                     &ProcessInformation))
{
    // Failed!

    LPVOID lpMsgBuf;
    ::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
                    FORMAT_MESSAGE_FROM_SYSTEM,
                    NULL,
                    ::GetLastError(),
                    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                    (LPTSTR)&lpMsgBuf,
                    0,
                    NULL);
   
    // Display the string.
    ::AfxMessageBox((LPCTSTR)lpMsgBuf);
   
    // Free the buffer.
    ::LocalFree(lpMsgBuf);
}

0
 
LVL 2

Expert Comment

by:Ready4Dis
ID: 1181701
It is easier to use the system command.

system("converter.exe pic.tga pic.fff");
0
 
LVL 23

Expert Comment

by:chensu
ID: 1181702
Using system(), you will see the black command window. Using CreateProcess(), you are able to hide it.
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

717 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