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
Solved

Use DOS-based pic. converter

Posted on 1998-02-10
3
169 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
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

840 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