TriggerHappy187
February 21st, 2009, 03:43 PM
How would I convert an OpenFileDialog->FileName to a constant char.
Because as of now it is a System::String.
Thanks to all helpers
Because as of now it is a System::String.
Thanks to all helpers
|
Click to See Complete Forum and Search --> : Visual c++ OpenFileDialog TriggerHappy187 February 21st, 2009, 03:43 PM How would I convert an OpenFileDialog->FileName to a constant char. Because as of now it is a System::String. Thanks to all helpers Arjay February 21st, 2009, 03:44 PM Are you coding in C++ (w/MFC) or Managed C++? In other words, did you mean to create a managed C++ project? TriggerHappy187 February 21st, 2009, 03:49 PM Not really sure, I am new to the C++ Language but have coded in plenty of other languages. Though the only real project setting I have changed is Common Language Runtime Support (/clr). I'm coding in whatever is default for vc++ 2008 express. Arjay February 21st, 2009, 03:57 PM I'm coding in whatever is default for vc++ 2008 express.VC++ 2008 Express has the ability to create many different types of projects. What type of project are you creating? (i.e. From the File\New\Project..., etc.) TriggerHappy187 February 21st, 2009, 05:36 PM I think it's a windows form application, or something like that. Arjay February 21st, 2009, 05:53 PM I think it's a windows form application, or something like that.That's managed code. Can you explain what you are trying to do? Type of application? What you hope to accomplish, etc? TriggerHappy187 February 21st, 2009, 08:27 PM You probably will not understand. Though I'm making a tool for a game that deals with MPQ's (warcraft III), I have the library and everything working though one of the functions takes a filename as a const char. But OpenFileDialog1->Filename's type is System::String. So doing something like... MyFunc(OpenFileDialog1->Filename, other param, other param); would not work. Arjay February 21st, 2009, 10:05 PM I believe I can follow along, but you need to be able to describe what you are doing. For example: I need to write a Windows app in [insert language here] that can prompt a user for a file. Then I parse the file to.... TriggerHappy187 February 21st, 2009, 10:31 PM Here is what my code is so far.. HANDLE mpq; if (label1->Text == "No map currently open") { return; } OpenMap->Filter = "BLP Image (*.blp)|*.blp|TGA Image (*.tga)|*.tga"; OpenMap->FilterIndex = 1; OpenMap->RestoreDirectory = true; OpenMap->ShowDialog(); SFileCreateArchiveEx("test.w3x", OPEN_ALWAYS, 0, &mpq); I need SFileCreateArchiveEx("test.w3x", OPEN_ALWAYS, 0, &mpq); To work like... SFileCreateArchiveEx(OpenMap->Filename, OPEN_ALWAYS, 0, &mpq); But the first parameter of SFileCreateArchiveEx is a char type and OpenMap->Filename is a System::String Type. Paul McKenzie February 21st, 2009, 10:34 PM But OpenFileDialog1->Filename's type is System::String.That is Managed C++, and this is not a managed C++ forum. Regards, Paul McKenzie TriggerHappy187 February 21st, 2009, 10:34 PM Sorry for that, first time using the forums, surely a moderator can move it. Though I still need help with my problem, it is holding everything back. Arjay February 22nd, 2009, 04:44 PM Did you write SFileCreateArchiveEx? If so, is the first parameter a char* or LPTSTR? If the latter, then try compiling as UNICODE instead of ANSI. TriggerHappy187 February 22nd, 2009, 04:57 PM http://www.zezula.net/en/mpq/stormlib.html#SFileCreateArchiveEx The first parameter is constant char. Arjay February 22nd, 2009, 07:32 PM Compiling in ANSI isn't really the best way to go, but what are you going to do if you are using older functions that don't take LPTSTRs? As a result, you'll need to convert the system::string into a char*. http://support.microsoft.com/kb/311259 Lastly, managed C++ code may not be the best option for you depending on what you are doing (that's pretty much why I asked you earlier to describe what you are trying to accomplish). TriggerHappy187 February 24th, 2009, 10:08 PM http://support.microsoft.com/kb/311259 I have read all of those, and they either don't work with the express edition, or I couldn't get them to work. Arjay February 24th, 2009, 10:56 PM http://support.microsoft.com/kb/311259 I have read all of those, and they either don't work with the express edition, or I couldn't get them to work.It's not an express edition issue. If you want help, you're going to have to show some code and display the error or describe what didn't work. If you just say "it didn't work", we don't have anything to go on to help you out. codeguru.com
Copyright WebMediaBrands Inc., All Rights Reserved. |