Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++] Open File with button

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Sharel972
Newbie cheater
Reputation: 0

Joined: 02 Nov 2009
Posts: 24
Location: israel

PostPosted: Thu Dec 31, 2009 12:58 pm    Post subject: [C++] Open File with button Reply with quote

hi , ineed help with open file with button :
example open-"C:/1.exe"

can some one help me with that please?
Back to top
View user's profile Send private message MSN Messenger
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Thu Dec 31, 2009 1:03 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sharel972
Newbie cheater
Reputation: 0

Joined: 02 Nov 2009
Posts: 24
Location: israel

PostPosted: Thu Dec 31, 2009 1:08 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Thu Dec 31, 2009 1:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
Henley
Grandmaster Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 671

PostPosted: Thu Dec 31, 2009 4:53 pm    Post subject: Reply with quote

I'm pretty sure he wants to run the file. Check out ShellExecute()
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Fri Jan 01, 2010 3:13 pm    Post subject: Reply with quote

CreateProcess() or ShellExecute()
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Fri Jan 01, 2010 3:18 pm    Post subject: Reply with quote

i guess there should be a Process class in C++.net
so just use it and use process.start
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Fri Jan 01, 2010 5:58 pm    Post subject: Reply with quote

Don't use managed C++, there is no support for it any more, switch to C#.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites