| View previous topic :: View next topic |
| Author |
Message |
Sharel972 Newbie cheater
Reputation: 0
Joined: 02 Nov 2009 Posts: 24 Location: israel
|
Posted: Thu Dec 31, 2009 12:58 pm Post subject: [C++] Open File with button |
|
|
hi , ineed help with open file with button :
example open-"C:/1.exe"
can some one help me with that please?
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Thu Dec 31, 2009 1:03 pm Post subject: |
|
|
use OPENFILENAME struct
| Code: |
OPENFILENAME ofn;
char szFileName[MAX_PATH] = "";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0";
ofn.lpstrFile = szFileName;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = "txt";
if(GetOpenFileName(&ofn))
{
// Do something usefull with the filename stored in szFileName
}
|
|
|
| Back to top |
|
 |
Sharel972 Newbie cheater
Reputation: 0
Joined: 02 Nov 2009 Posts: 24 Location: israel
|
Posted: Thu Dec 31, 2009 1:08 pm Post subject: |
|
|
look :
| Code: | #pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
"commend here"
} |
what should i write in there to open this : C:/1.exe?
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Thu Dec 31, 2009 1:15 pm Post subject: |
|
|
that's manage C++ (aka c++.net) i don't really like that language since it's not a pure C++
but i guess there should be OpenFileDialog control to drag
other than that can't help u much since i don't know that type of c++
|
|
| Back to top |
|
 |
Henley Grandmaster Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 671
|
Posted: Thu Dec 31, 2009 4:53 pm Post subject: |
|
|
| I'm pretty sure he wants to run the file. Check out ShellExecute()
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Fri Jan 01, 2010 3:13 pm Post subject: |
|
|
| CreateProcess() or ShellExecute()
|
|
| Back to top |
|
 |
Stylo Grandmaster Cheater Supreme
Reputation: 3
Joined: 16 May 2007 Posts: 1073 Location: Israel
|
Posted: Fri Jan 01, 2010 3:18 pm Post subject: |
|
|
i guess there should be a Process class in C++.net
so just use it and use process.start
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Fri Jan 01, 2010 5:58 pm Post subject: |
|
|
| Don't use managed C++, there is no support for it any more, switch to C#.
|
|
| Back to top |
|
 |
|