<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>[A5] al_create_native_file_dialog() Windows source?</title>
		<link>http://www.allegro.cc/forums/view/614568</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 23 Aug 2014 04:41:33 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>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.</p><p>(preferably without any sarcasm)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Mon, 18 Aug 2014 04:07:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Look in the add-ons native dialog folder.</p><p>Or, if you have git installed:</p><p><span class="source-code">git grep <a href="http://www.allegro.cc/manual/al_create_native_file_dialog"><span class="a">al_create_native_file_dialog</span></a></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Mon, 18 Aug 2014 04:10:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>addons/native_dialog/dialog.c line 43</p><p>although you are probably more interested in _al_show_native_file_dialog which is in<br />addons/native_dialog/win_dialog.c line 135
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 18 Aug 2014 04:12:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>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. :/
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Roy)</author>
		<pubDate>Mon, 18 Aug 2014 04:36:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">A5 git said:</div><div class="quote"><p>
</p><div class="source-code"><div class="toolbar"><span class="name">win_dialog.c</span><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number"> 191</span>   <span class="k1">if</span> <span class="k2">(</span>flags <span class="k3">&amp;</span> OFN_OVERWRITEPROMPT<span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 192</span>      ret <span class="k3">=</span> GetSaveFileName<span class="k2">(</span><span class="k3">&amp;</span>ofn<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 193</span>   <span class="k2">}</span>
<span class="number"> 194</span>   <span class="k1">else</span> <span class="k2">{</span>
<span class="number"> 195</span>      ret <span class="k3">=</span> GetOpenFileName<span class="k2">(</span><span class="k3">&amp;</span>ofn<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 196</span>   <span class="k2">}</span>
</div></div><p>
</p></div></div><p>


<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms646927%28v=vs.85%29.aspx">GetOpenFileName</a> is called on a <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms646839%28v=vs.85%29.aspx">OPENFILENAME</a> structure. It looks like the lpstrFile field needs to be initialized for it to accept a default selected file.</p><p>What allegro does currently :
</p><div class="source-code"><div class="toolbar"><span class="name">win_dialog.c</span><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number"> 172</span>   <span class="k1">if</span> <span class="k2">(</span>fd-&gt;fc_initial_path<span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 173</span>      ofn.lpstrInitialDir <span class="k3">=</span>
<span class="number"> 174</span>         <a href="http://www.allegro.cc/manual/al_path_cstr"><span class="a">al_path_cstr</span></a><span class="k2">(</span>fd-&gt;fc_initial_path, ALLEGRO_NATIVE_PATH_SEP<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 175</span>   <span class="k2">}</span>
</div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Mon, 18 Aug 2014 05:26:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks for trying to help out! It will be easiest if you clone Allego&#39;s git repository, so you can make a patch easily with git diff or git format-patch. The Allegro Git repository is explained here:</p><p><a href="http://alleg.sourceforge.net/git.html">http://alleg.sourceforge.net/git.html</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (beoran)</author>
		<pubDate>Mon, 18 Aug 2014 20:03:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>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*<span class="ref"><sup>[<a href="#">1</a>]</sup></span>. So it should be okay to use a char* str in its place, I think...</p><p>So, we can set lpstrFile to the filename held in fc_initial_path I believe. I will test this later tonight.</p><p>Edit<br />Still working on this. Been busy with orientation for school.
</p><div class="ref-block"><h2>References</h2><ol><li><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd374131%28v=vs.85%29.aspx">http://msdn.microsoft.com/en-us/library/windows/desktop/dd374131%28v=vs.85%29.aspx</a></li></ol></div></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sat, 23 Aug 2014 04:41:33 +0000</pubDate>
	</item>
</rss>
