Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Use DOS-based pic. converter

Posted on 1998-02-10
3
Medium Priority
?
175 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 600 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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.

824 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