0
0

Hi,

Please could you tell where i can find the code for a “browse…” button, where the user clicks to choose a file from their Hard Drive.

Also I want to incorporate this into he “stream” example, to stop it requiring a commnd line argument. Is there anything i should take into account before doing this? or would it be straightforward?

Thanks very much,

Jon Winstanley

  • You must to post comments
0
0

In your fmod samples folder, there is a sample folder called fmod. Double-click on the file named “main” and you will find the browsing code.
[code:109ddr59]
void LoadSong(HWND LB_Parent_Hwnd, HWND LB_Hwnd)
[/code:109ddr59]

As for the implementation… I don’t really know, I was refered to Fmod this morning. ๐Ÿ˜€

  • You must to post comments
0
0

Sorry, didnt explain very well!

I want the code for the function thats used by windows when it lets you “browse..” for a file within the system. (Like when selecting a pathname for an install directory or chosing a file)

I realise its not to do with fmod, but i want to use it in my fmod project, just wondered if any of you knew where it can be found??

Thanks a lot

  • You must to post comments
0
0

I guess something like this should work:

[code:1smo5sg9]
void DoFileOpen(HWND hwnd, int extension)
{
OPENFILENAME ofn;
char szFileName[MAX_PATH] = "";

ZeroMemory(&ofn, sizeof(ofn));

ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwnd;
if(extension == 1)
ofn.lpstrFilter = "Humanities' Files 1750-1775 (*.hha)\0*.hha\0All Files (*.*)\0*.*\0";
else if(extension == 2)
ofn.lpstrFilter = "Humanities' Files 1776-1800 (*.hhb)\0*.hhb\0All Files (*.*)\0*.*\0";
else if(extension == 3)
ofn.lpstrFilter = "Humanities' Files 1801-1825 (*.hhc)\0*.hhc\0All Files (*.*)\0*.*\0";
else if(extension == 4)
ofn.lpstrFilter = "Humanities' Files 1826-1850 (*.hhd)\0*.hhd\0All Files (*.*)\0*.*\0";
else if(extension == 5)
ofn.lpstrFilter = "Humanities' Files 1851-1875 (*.hhe)\0*.hhe\0All Files (*.*)\0*.*\0";
else if(extension == 6)
ofn.lpstrFilter = "Humanities' Files 1876-1900 (*.hhf)\0*.hhf\0All Files (*.*)\0*.*\0";
else if(extension == 7)
ofn.lpstrFilter = "Humanities' Files Vocabuary (*.hhg)\0*.hhg\0All Files (*.*)\0*.*\0";
else if(extension == 8)
ofn.lpstrFilter = "Humanities' Files Key Terms (*.hhh)\0*.hhh\0All Files (*.*)\0*.*\0";   
else
ofn.lpstrFilter = "All Files (*.*)\0*.*\0";
ofn.lpstrFile = szFileName;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = "txt";

if(GetOpenFileName(&ofn))
{
    HWND hEdit = GetDlgItem(hwnd, IDC_MAIN_EDIT);
    LoadTextFileToEdit(hEdit, szFileName);
}

}

[/code:1smo5sg9]
This is from my history project some time back, although this is meant to read open text files with the call of “LoadTextFileToEdit(…)” It should get you started. ๐Ÿ˜€

  • You must to post comments
0
0

Sounds like you want a GUI application, and the demo is a console application. Are you using an IDE? If so, which one? Consult the IDE documentation on how to build a Win32 Gui app. Most have a generic “Open File” Dialog control.

Assuming you’re doing C/C++, I recommend Borland C++ Builder. The standard addition is all you need. Costs $70 USD. A great RAD environment for Win32. Just drag-n-drop the “File Open” Dialog control onto your Window, and cut n paste 2 lines of code….and you’re done.

Microsoft VC++ is almost as easy, and a little more $$.

If you don’t want to spend money on an IDE, get Open Watcom (http://www.openwatcom.org/). Pretty slick for free!

If you’re not doing C/C++, then my next suggestion would be Delphi. Madd RAD for Win32 and sexier than VB.

  • sugo
  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.