Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [A5] al_create_native_file_dialog() Windows source?

This thread is locked; no one can reply to it. rss feed Print
[A5] al_create_native_file_dialog() Windows source?
Neil Roy
Member #2,229
April 2002
avatar

Could someone point me to where the Windows source code for the al_create_native_file_dialog() function is? I want to dig through it and see if I can improve it, at least for my own needs anyhow.

(preferably without any sarcasm)

---
“I love you too.” - last words of Wanda Roy

Matthew Leverton
Supreme Loser
January 1999
avatar

Look in the add-ons native dialog folder.

Or, if you have git installed:

git grep al_create_native_file_dialog

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Neil Roy
Member #2,229
April 2002
avatar

Thanks. I may be in over my head here. Trying to figure out how I can get this thing to accept a default filename when opening a save dialog. :/

---
“I love you too.” - last words of Wanda Roy

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

A5 git said:

win_dialog.c#SelectExpand
191 if (flags & OFN_OVERWRITEPROMPT) { 192 ret = GetSaveFileName(&ofn); 193 } 194 else { 195 ret = GetOpenFileName(&ofn); 196 }

GetOpenFileName is called on a OPENFILENAME structure. It looks like the lpstrFile field needs to be initialized for it to accept a default selected file.

What allegro does currently :

win_dialog.c#SelectExpand
172 if (fd->fc_initial_path) { 173 ofn.lpstrInitialDir = 174 al_path_cstr(fd->fc_initial_path, ALLEGRO_NATIVE_PATH_SEP); 175 }

beoran
Member #12,636
March 2011

Thanks for trying to help out! It will be easiest if you clone Allego's git repository, so you can make a patch easily with git diff or git format-patch. The Allegro Git repository is explained here:

http://alleg.sourceforge.net/git.html

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

lpstrFile is a LPTSTR type, which is dependent on whether UNICODE is defined before including windows.h. UNICODE is not currently defined in any files included in win_dialog.c. That makes LPTSTR a typedef for unsigned char*[1]. So it should be okay to use a char* str in its place, I think...

So, we can set lpstrFile to the filename held in fc_initial_path I believe. I will test this later tonight.

Edit
Still working on this. Been busy with orientation for school.

Go to: