Solved

Use DOS-based pic. converter

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now