473,395 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to get ShellExecute () in vc++/c++

Hi,

I am developing an application using vc++, in that, i have to execute shell command. I executed successfully using ShellExecute(). Now i want to know how to get the return value of that shell command, while executing mountvol like this command, it return list of drives, if I run using the above method, how can i get that return value.. can any one help me
Jan 19 '10 #1
3 4313
Banfa
9,065 Expert Mod 8TB
You can't get any return data using ShellExecute to execute a command. It is a fire and forget type of launch.

What you could do is call CreateProcess to run your command and then you could intercept stdin, stdout, stderr and pipe the input/output of thoser streams back to you program to interpret the data.

However a far better idea would be to just call 1 or more of the volume management functions that are part of the WIN32 API.
Jan 19 '10 #2
Thank you for your response, could you explain in details if possible with some code snippets....
Jan 19 '10 #3
Banfa
9,065 Expert Mod 8TB
If you read the help pages at the end of the link I posted you will find example code and explainations of how to use the API.

Personally I have never used that part of the API so the best I could do is read those pages and re-iterate them to you but, frankly, I am a little too busy to be doing the reading you should be doing for yourself.
Jan 19 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Wiktor Zychla | last post by:
I have a problem I cannot solve. My application hosts IE activex control. I follow the standard procedure: I just aximp shdocvw.dll. Note that this gives you two files: axshdocvw.dll and...
0
by: the_openFace | last post by:
I'm trying to display the shell's property page for various files and I'm using this code: class Win32Shell { // ... other stuff here public static extern Int32 ShellExecute( Int32 hwnd,...
0
by: the openBack | last post by:
I'm trying to display the shell's property page for various files and I'm using this code: class Win32Shell { // ... other stuff here public static extern Int32 ShellExecute( Int32 hwnd,...
0
by: David | last post by:
We have an mfc application in which we use ShellExecute to launch the browser with an initial web site. {ShellExecute( NULL, "open", "http://www.SomeWebSite.com", NULL, NULL, SW_SHOWNORMAL ) } ...
12
by: DavidS | last post by:
Is there an equivalent ShellExecute() command (like in VB/VC apps) for opening up Excel files from within ASP.NET web application. I create an Excel format of a crystal report. I'd like to next...
1
by: magix | last post by:
Dear Guru, From Dos Command, I can execute like C:\Converter TextFile.txt or C:\Converter D:\TextFile.txt I wrote an application (using VC++) to call a dos command, where sztxtBuffer1 is the...
3
by: Lionel | last post by:
Hi, I'm currently busy writing an MSI custom action DLL, inside this DLL I'm trying to open a file with the default associated program, if I use standard ShellExecute call from EXE it works, but...
5
by: =?Utf-8?B?VG9tYXM=?= | last post by:
Hello, Somebody knows which is the equivalent one in C++/CLI ? HINSTANCE ShellExecute(HWND hwnd, LPCTSTR lpOperation, LPCTSTR lpFile, LPCTSTR lpParameters, LPCTSTR lpDirectory, INT nShowCmd
2
by: =?Utf-8?B?R2FyeQ==?= | last post by:
I'm ported several existing projects from VC++6.0 to .NET2003. I seem to have a problem with ShellExecute() however, as in: // Opens a browser HINSTANCE rc; rc = ShellExecute (NULL, "open",...
5
by: =?Utf-8?B?aGtNaWNybw==?= | last post by:
Having problems compiling the following code in C USING CL.EXE // shell.c LANGUAGE = .NET 2003 #include <iostream.h> #include <windows.h> int main() { SHELLEXECUTE(NULL, "open",...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.