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 1672
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: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |