Click here to Skip to main content
15,909,199 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: Comparing values Pin
Herboren8-Mar-07 9:27
Herboren8-Mar-07 9:27 
GeneralRe: Comparing values Pin
George L. Jackson8-Mar-07 13:16
George L. Jackson8-Mar-07 13:16 
QuestionCeate an executable [modified] Pin
abbd7-Mar-07 11:06
abbd7-Mar-07 11:06 
AnswerRe: Ceate an executable Pin
George L. Jackson7-Mar-07 12:53
George L. Jackson7-Mar-07 12:53 
QuestionHow to execute another application Pin
abbd7-Mar-07 5:03
abbd7-Mar-07 5:03 
AnswerRe: How to execute another application Pin
Nish Nishant7-Mar-07 5:16
sitebuilderNish Nishant7-Mar-07 5:16 
AnswerRe: How to execute another application Pin
led mike7-Mar-07 5:18
led mike7-Mar-07 5:18 
AnswerRe: How to execute another application [modified] Pin
darkcloud.42o9-Mar-07 23:12
darkcloud.42o9-Mar-07 23:12 
first of all the type of formas application you need is.... CLR Windows Forms Aplication

create a process outside the namespace.. and use these headers..
#include string
#include windows.h
#include process.h
using namespace std;
unsigned __stdcall execplz(void *params);
string cl;

somewhere in your program you need to place the following line to execute the command;
<br />
unsigned sID; (HANDLE)_beginthreadex( NULL, 0, execplz, NULL, 0, &sID);<br />


and keep in mind the command line string is std::string cl;
which i have set as global string at top so you can use anywhere..
the process below will create a process invisibly to yours ok.. so
to change that you need to remove... si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;

<br />
unsigned __stdcall execplz(void *params){<br />
string fnn;<br />
int nLen = cl.length();<br />
bl=cl; std::string::size_type idx; idx=bl.rfind("\\");<br />
bl=bl.substr(idx, string::npos);<br />
cl=cl.substr(0, idx-1);<br />
int nLeng = bl.length();<br />
<br />
LPWSTR szCmdLine = new WCHAR[nLen+1];<br />
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,cl.c_str(),nLen,szCmdLine,nLen);<br />
szCmdLine[nLen] = '\0';<br />
<br />
LPWSTR fnonly = new WCHAR[nLeng+1];<br />
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,bl.c_str(),nLeng,fnonly,nLeng);<br />
fnonly[nLeng]='\0';<br />
<br />
    STARTUPINFO si;<br />
    PROCESS_INFORMATION pi;<br />
   GetStartupInfo(&si);<br />
   si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;<br />
   si.wShowWindow = SW_HIDE;<br />
    ZeroMemory( &si, sizeof(si) );<br />
    si.cb = sizeof(si);<br />
    ZeroMemory( &pi, sizeof(pi) );<br />
<br />
	if( !CreateProcess( szCmdLine, fnonly, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi) ) { printf( "CreateProcess failed (%d).\n", GetLastError() ); }<br />
return 0;<br />
}<br />


ok so the reason why i have this a separate process.. is because its using threads..
you can use this at anytime even when soemthing else is going on..multiple times at once
if wished.. good for creating webservers and such...


-- modified at 5:26 Saturday 10th March, 2007
QuestionRequested registry access is not allowed. Pin
abbd7-Mar-07 4:31
abbd7-Mar-07 4:31 
AnswerRe: Requested registry access is not allowed. Pin
Nish Nishant7-Mar-07 5:17
sitebuilderNish Nishant7-Mar-07 5:17 
GeneralRe: Requested registry access is not allowed. Pin
abbd7-Mar-07 5:52
abbd7-Mar-07 5:52 
GeneralRe: Requested registry access is not allowed. Pin
Nish Nishant7-Mar-07 5:56
sitebuilderNish Nishant7-Mar-07 5:56 
GeneralRe: Requested registry access is not allowed. Pin
abbd7-Mar-07 6:24
abbd7-Mar-07 6:24 
GeneralRe: Requested registry access is not allowed. Pin
abbd8-Mar-07 3:54
abbd8-Mar-07 3:54 
Questiongood refrence for c++ Pin
faradgi6-Mar-07 10:59
faradgi6-Mar-07 10:59 
AnswerRe: good refrence for c++ Pin
George L. Jackson6-Mar-07 16:46
George L. Jackson6-Mar-07 16:46 
AnswerRe: good refrence for c++ Pin
Christian Graus7-Mar-07 7:17
protectorChristian Graus7-Mar-07 7:17 
Questionhow to programming in c++? Pin
faradgi6-Mar-07 10:32
faradgi6-Mar-07 10:32 
AnswerRe: how to programming in c++? Pin
Christian Graus6-Mar-07 10:40
protectorChristian Graus6-Mar-07 10:40 
Questionexecute an application Pin
abbd6-Mar-07 8:12
abbd6-Mar-07 8:12 
AnswerRe: execute an application Pin
led mike6-Mar-07 9:02
led mike6-Mar-07 9:02 
GeneralRe: execute an application Pin
abbd6-Mar-07 9:25
abbd6-Mar-07 9:25 
GeneralRe: execute an application Pin
led mike6-Mar-07 9:36
led mike6-Mar-07 9:36 
GeneralRe: execute an application Pin
Nish Nishant6-Mar-07 10:09
sitebuilderNish Nishant6-Mar-07 10:09 
GeneralRe: execute an application Pin
led mike6-Mar-07 10:45
led mike6-Mar-07 10:45 

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

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