Hey,
I've got a C++ program that runs fine and a VB program that I made into an exe file and that runs fine by itself. It does an Excel to Word mailmerge and prints the document. However, when I try to run the VB program from the C++ program it just flashes the command prompt and does nothing. I'm using the system(char *) command to run it.
Any help is much appreciated, thank you.
Larry
6 1662
Can you post the exact line for us? You have the right function, as far as I can tell...
You might try using the full path and/or backwhacking the slashes in the path to the VB script.
Hi,
Thanks for the reply, here's the code segment. -
System::IntPtr temp = System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi("C:\\Documents and Settings\\jsheffield\\My Documents\\Visual Studio 2005\\Projects\\timesheet_\\timesheet_\\Merge.exe " + usern);
-
char* action = (char*)(void*)temp;
-
system(action);
-
System::Runtime::InteropServices::Marshal::FreeHGlobal(temp);
-
Thanks.
NOTE: Some how the post printed a space in the StringToHGlobalAnsi, where there isn't one, so that's not the problem
Larry
However, when I try to run the VB program from the C++ program it just flashes the command prompt and does nothing.
Are you sure the VB script isn't running? Is there a prompt in the VB script, or can you give it a pause (to keep the cmd line up)? I'm thinking it might execute and return, so the window is closed.
Perhaps part of it runs, but when I run it outside of the C++ program, it always comes up with a prompt saying it will perform an SQL statement (the mail merge) and then it says it is printing the document.
When running it from the C++ program it never displays either of these, and nothing comes out of the printer.
Thanks.
Are you sure the VB script isn't running? Is there a prompt in the VB script, or can you give it a pause (to keep the cmd line up)? I'm thinking it might execute and return, so the window is closed.
I should mention that the exe takes an argument. Someone suggested using System::Diagnostics::Process::Start(String^) and that worked, but I had to take out the argument. However, using system(char*) should have no problem with an argument, right, cause it's a system command?
Thanks.
Larry
Are you sure the VB script isn't running? Is there a prompt in the VB script, or can you give it a pause (to keep the cmd line up)? I'm thinking it might execute and return, so the window is closed.
Hey, never mind, I got it to work using the System::Diagnostics::Process::Start(String^,String ^) function. Thank you so much for your help.
Larry
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Fabio Pliger |
last post by:
Hi,
is it possibile, in python, to check for an already running instance of an
application?
My problem is that, if my program i running and the user relaunch it, i
don't want to open a new...
|
by: Pierre-Yves |
last post by:
Hello,
I would like to prevent my perl program to be executed several times
simultaneously (if the program is already running, I would like to display a
message like "another instance of this...
|
by: Amit Nath |
last post by:
Hi!
I am running a C program and need to pause the program and change some
of the variables. Is there any function that checks if there is a
character in the Standard Input Buffer, else the...
|
by: MgGuigg |
last post by:
Hello all, This is my first time posting a question to this forum, so here is
hoping I am following protocol. I am scraping the rust off my old Basic
programming skills, and have just recently...
|
by: tshad |
last post by:
What would be a good way to check programmatically whether a service was
running?
We have a service that dies periodically and I need to check to see if this
service is running. I know how to...
|
by: Michael.Suarez |
last post by:
Suppose I have a program that prompts you with a dialogbox to enter a
password. If you get the password correct, it allows you into the
program, else it kills the program.
Suppose that when I...
|
by: dspfun |
last post by:
I would like to analyze my running c-program.
What I would like to know for example is the range of the entire
address space of my running c-program (memory reserved for/by the
running program),...
|
by: upperclass |
last post by:
Hi,
I'm trying to find a decent way to measure program running time.
I know clock() is probably the standard way of doing it but clock_t
overflows too quickly.
The target program running time...
|
by: Jimmy |
last post by:
Well, i know it may be a little non-python thing, however, I can think
of no place better to post this question :)
can anyone tell me, in python, how to obtain some information of a
running...
|
by: Shadlan |
last post by:
Hi.
I need to know if a service is running on my server. Is there any PHP
instruction that I can use to do this?
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
| |