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

Managed C++/CLI

 
QuestionHow to interact between C# and VC++ applications Pin
Mary Chennai28-Apr-09 19:47
Mary Chennai28-Apr-09 19:47 
AnswerRe: How to interact between C# and VC++ applications Pin
led mike29-Apr-09 4:31
led mike29-Apr-09 4:31 
AnswerRe: How to interact between C# and VC++ applications Pin
Randor 4-May-09 15:58
professional Randor 4-May-09 15:58 
QuestionWMI copy file to remote host Pin
Jack Rong28-Apr-09 8:43
Jack Rong28-Apr-09 8:43 
QuestionLooking for guidance with regards to System::String variables and functions. Pin
BubbaGeeNH28-Apr-09 5:32
BubbaGeeNH28-Apr-09 5:32 
AnswerRe: Looking for guidance with regards to System::String variables and functions. Pin
Mark Salsbery28-Apr-09 5:46
Mark Salsbery28-Apr-09 5:46 
AnswerRe: Looking for guidance with regards to System::String variables and functions. Pin
Dave Doknjas28-Apr-09 12:57
Dave Doknjas28-Apr-09 12:57 
QuestionTesting if Elevated Process Pin
turkmeistr127-Apr-09 5:23
turkmeistr127-Apr-09 5:23 
I've got my Visual C++ form to display properly based on whether or not the user is using XP or Vista, but I need the program to open up with Administrator rights on Vista. I've tried doing it based on file existence, but even if the file is not created it shows that "it exists" because there is an open filestream. There are also random message boxes I used to verify that I was using the updated version of this app.

This is my code so far:
(If there are any bracket errors, please ignore, the code compiles fine, I just copied a portion of the code from the header file)

public: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
bool retValue;
bool ret;
String^ path = "C:\\Program Files\\CenturyTel Self Repair\\VistaUAC.fts";
if (File::Exists(path))
{
MessageBox::Show("Successful second time loading.","Beta 2");
}
else
{
retValue = OsIsAtLeastVista(); // Returns true if user has Vista
if (!retValue)
MessageBox::Show("NOTE: This is XP.","Beta Test");
MessageBox::Show("Second Box?!","Yup");
if (retValue)
{
MessageBox::Show("NOTE: this is Vista","Beta Test");

if (File::Exists(path))
MessageBox::Show("Voila! File was created.","Hehe, worked.");
else
{
MessageBox::Show("Creating File.","Creating file.");
FileStream^ fs = gcnew FileStream(path,FileMode::OpenOrCreate,FileAccess::Write );
try
{
AddText(fs, "I exist\n");
fs->Close();
}
finally
{
if (fs)
delete (IDisposable^)fs;
}
ret = subFunc();
if (File::Exists(path))
MessageBox::Show("I'm here.","I'm here.");

if (!ret)
{
System::Diagnostics::Process ^process = gcnew System::Diagnostics::Process();
process->StartInfo->FileName = "CTEL.exe";
process->StartInfo->Verb = "runas";
process->Start();
Application::Exit();
}

}
}
}



and the subfunc

bool subFunc ()
{
bool val;
if (File::Exists("C:\\Program Files\\CenturyTel Self Repair\\VistaUAC.fts"))
val = 1;
else
val = 0;
return val;
}
AnswerRe: Testing if Elevated Process Pin
Mark Salsbery27-Apr-09 6:53
Mark Salsbery27-Apr-09 6:53 
GeneralRe: Testing if Elevated Process Pin
turkmeistr127-Apr-09 9:01
turkmeistr127-Apr-09 9:01 
GeneralRe: Testing if Elevated Process Pin
Mark Salsbery27-Apr-09 9:05
Mark Salsbery27-Apr-09 9:05 
GeneralRe: Testing if Elevated Process Pin
turkmeistr127-Apr-09 10:08
turkmeistr127-Apr-09 10:08 
GeneralRe: Testing if Elevated Process Pin
Mark Salsbery27-Apr-09 11:11
Mark Salsbery27-Apr-09 11:11 
QuestionGetting the Brush to apply to pictureBox instead of Form Pin
Jeffrey Webster26-Apr-09 19:55
Jeffrey Webster26-Apr-09 19:55 
AnswerRe: Getting the Brush to apply to pictureBox instead of Form Pin
Luc Pattyn27-Apr-09 0:58
sitebuilderLuc Pattyn27-Apr-09 0:58 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Jeffrey Webster27-Apr-09 3:13
Jeffrey Webster27-Apr-09 3:13 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Luc Pattyn27-Apr-09 3:43
sitebuilderLuc Pattyn27-Apr-09 3:43 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Jeffrey Webster27-Apr-09 4:26
Jeffrey Webster27-Apr-09 4:26 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Luc Pattyn27-Apr-09 4:34
sitebuilderLuc Pattyn27-Apr-09 4:34 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Jeffrey Webster27-Apr-09 6:20
Jeffrey Webster27-Apr-09 6:20 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Luc Pattyn27-Apr-09 6:23
sitebuilderLuc Pattyn27-Apr-09 6:23 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Jeffrey Webster27-Apr-09 6:34
Jeffrey Webster27-Apr-09 6:34 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Luc Pattyn27-Apr-09 6:52
sitebuilderLuc Pattyn27-Apr-09 6:52 
GeneralRe: Getting the Brush to apply to pictureBox instead of Form Pin
Jeffrey Webster27-Apr-09 8:01
Jeffrey Webster27-Apr-09 8:01 
QuestionHow to Convert Strings[] to LPWSTR*??? Pin
ANURAG VISHNOI22-Apr-09 21:14
ANURAG VISHNOI22-Apr-09 21:14 

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.