I am busy to make a program that starts with a menu, where
you can choose different options.
One of these options to execute a program.
for example :
download software in an flash-prom with loader.exe
loader idpartno.sr(where idpartno.sr is the code to be
downloaded.

Thanks for helping.

Recommended Answers

All 5 Replies

Use the shellExecute function. There's plenty of documentation on it in the MSDN. I copied this from a piece of one of my functions which wouldn't actually open notepad, it opens from a filename, in which case if it was a file with a *.txt extension it would open up the default application for that extension, in the case of .txt, Notepad. Hope this helps!

int iReturn = (int) ShellExecute(NULL, "open", "c:\\windows\\system32\\notepad.exe", NULL, NULL, SW_SHOWNORMAL);
// If ShellExecute returns an error code, let the user know.

if (iReturn <= 32)

{

MessageBox ("Cannot open file. File may have been moved or deleted.", "Error!", MB_OK | MB_ICONEXCLAMATION) ;

}

This should work:

#include <stdlib.h>
#include<stdio.h>

int main()
{
    (void)system("C:\\Windows\\System32\\notepad.exe");
    return(0);
}

This should work:

#include <stdlib.h>
#include <stdio.h>
int main()
{
    (void)system("C:WindowsSystem32notepad.exe");
    return(0);
}

Hi Dude,
This code is not working.
the system(); is compiled and returned a TRUE value. But couldn't get the output.

Try some other code.

I am busy to make a program that starts with a menu, where
you can choose different options.
One of these options to execute a program.
for example :
download software in an flash-prom with loader.exe
loader idpartno.sr(where idpartno.sr is the code to be
downloaded.

Thanks for helping.

#include <stdlib.h>
#include<stdio.h>
#include<windows.h>

int main()
{

ShellExecute(NULL,"open","d:\\vlc.exe",NULL,NULL,SW_SHOWNORMAL);

return(0);
}

This works good fellas.

please check the dates before posting. youre responding to someone who posted over two years ago, who was posting to someone else from four years prior to that.

nobody cares about this thread or is paying attention, all its doing now is cluttering forum space and wasting time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.