Click here to Skip to main content

Managed C++/CLI

 
GeneralRe: Passing a C# string to C++/CLI does not show up from a CPP program PinmvpRichard MacCutchan30-Mar-13 0:00 
AnswerRe: Passing a C# string to C++/CLI does not show up from a CPP program Pinmemberjschell30-Mar-13 14:33 
QuestionDidn't Understand to logic of calculation of this program.? PinmemberTaqi_Shah11-Mar-13 8:26 
AnswerRe: Didn't Understand to logic of calculation of this program.? PinmemberThePhantomUpvoter11-Mar-13 8:55 
SuggestionRe: Didn't Understand to logic of calculation of this program.? PinmemberMicroVirus13-Mar-13 13:16 
QuestionNeed Urgent Help!! PinmemberMember 933160011-Mar-13 3:18 
AnswerRe: Need Urgent Help!! PinmemberMarco Bertschi14-Mar-13 11:36 
Questionhow to call vcvarsall.bat with Process::Start method? Pinmemberaupres9-Mar-13 0:43 
I try to invoke oracle pro*c in C++/CLI project. This is my sample code.

#include "stdafx.h"

using namespace System;
using namespace System::IO;
using namespace System::Diagnostics;


void call_Process (ProcessStartInfo^ info) {

try {

Process^ exeP = Process::Start(info);
StreamReader^ reader = exeP->StandardOutput;
String^ result = reader->ReadToEnd();

Console::Write(result);
Console::ReadLine();
}
catch(Exception^ e) {
Console::WriteLine(e->Message);
Console::ReadLine();
}
}

int main(array ^args)
{
ProcessStartInfo^ pStartInfo = gcnew ProcessStartInfo();

pStartInfo->UseShellExecute = false;
pStartInfo->RedirectStandardOutput = true;
pStartInfo->WindowStyle = ProcessWindowStyle::Hidden;

pStartInfo->FileName = "\"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat\"";
pStartInfo->Arguments = "x64";

call_Process(pStartInfo);

pStartInfo->FileName = "proc.exe";
pStartInfo->Arguments = "oracle_connect.pc";

call_Process(pStartInfo);

pStartInfo->FileName = "\"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\bin\\amd64\\cl.exe\"";
String^ arg1 = " /I C:\\app\\Administrator\\product\\11.2.0\\dbhome_1\\precomp\\public";
String^ arg2 = " /link C:\\app\\Administrator\\product\\11.2.0\\dbhome_1\\precomp\\LIB\\ORASQL11.LIB";
pStartInfo->Arguments = arg1 + " oracle_connect.c" + arg2;

call_Process(pStartInfo); // throws exception.

pStartInfo->FileName = "oracle_connect.exe";

call_Process(pStartInfo);

return 0;
}

When I type in ,call vcvarsall.bat in command prompt window myself and run this codes, it works. No exception. But when I run this code in another command prompt window without calling vcvarsall.bat, it throws exception. Calling vcvarsall.bat with Process::Start method doesn't work!

Pls, advise me how to call vcvarsall.bat with Process::Start method. Thanks in advance.
Best Regards!
Joseph Hwang

AnswerRe: how to call vcvarsall.bat with Process::Start method? PinmemberThePhantomUpvoter9-Mar-13 4:06 
GeneralRe: how to call vcvarsall.bat with Process::Start method? Pinmemberaupres9-Mar-13 14:09 
AnswerRe: how to call vcvarsall.bat with Process::Start method? PinmvpRichard MacCutchan9-Mar-13 23:46 
Questioncandidate function not accessible Pinmemberbonosa1-Mar-13 18:35 
AnswerRe: candidate function not accessible PinmvpRichard MacCutchan2-Mar-13 1:01 
GeneralRe: candidate function not accessible Pinmemberbonosa2-Mar-13 8:59 
GeneralRe: candidate function not accessible PinmvpRichard MacCutchan2-Mar-13 10:13 
Questionsqrt() function strange behavouir PinmemberAmrit Agr1-Mar-13 0:44 
AnswerRe: sqrt() function strange behavouir PinmvpRichard MacCutchan1-Mar-13 1:56 
Questionbatch files PinmemberMember 981569020-Feb-13 23:42 
AnswerRe: batch files PinmvpRichard MacCutchan20-Feb-13 23:57 
GeneralRe: batch files PinmemberMember 981569021-Feb-13 0:11 
GeneralRe: batch files PinmvpRichard MacCutchan21-Feb-13 0:53 
GeneralRe: batch files PinmemberDirquez Marquez21-Feb-13 21:24 
GeneralRe: batch files PinmvpRichard MacCutchan21-Feb-13 23:36 
GeneralRe: batch files PinmemberDirquez Marquez22-Feb-13 3:58 
QuestionWhat is the CLI/C++ equivalent to the C# using statement Pinmembersujayg14-Feb-13 22:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.150414.1 | Last Updated 17 Apr 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid