<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>using only one window (not win32)</title>
		<link>http://www.allegro.cc/forums/view/255090</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 28 Mar 2003 04:59:43 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>i want to use only one window. when it starts the program it opens a console and then another window. how do i keep it to one window. i looked in docs and it said win_set_window(HWND wnd); ... but im not using win32 in the program and i cant use the HWND. how do i get it to only one window outside of win32.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (IronBob)</author>
		<pubDate>Thu, 27 Mar 2003 08:21:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Compile (or rather, link) with the -mwindows switch.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Thu, 27 Mar 2003 08:22:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>ok it works. but ive got one more question. how can i stop it from saying the thing about &quot;closing the program my cause errors&quot; when i click the X.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (IronBob)</author>
		<pubDate>Thu, 27 Mar 2003 08:24:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Check the manual under Using Allegro.</p><p><span class="source-code"><span class="k1">int</span> <a href="http://www.allegro.cc/manual/set_close_button_callback" target="_blank"><span class="a">set_close_button_callback</span></a><span class="k2">(</span><span class="k1">void</span> <span class="k2">(</span><span class="k3">*</span>proc<span class="k2">)</span><span class="k2">(</span><span class="k1">void</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (DanielH)</author>
		<pubDate>Thu, 27 Mar 2003 08:31:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>ok i cant find set_close_button_callback(). all i see is set_window_close_hook() and set_window_close_button().</p><p>[edit]i figured out that its set_window_close_hook() that im looking for but i dont know what i need to enter as an argument for it to close without asking for the &quot;loss of data&quot; thing.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (IronBob)</author>
		<pubDate>Thu, 27 Mar 2003 09:38:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>void close_my_game()<br />{<br />// do something which will cause your game to close like:<br />gameover = true;<br />}</p><p>in main:<br />set_window_close_hook(close_my_game);
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Wetimer)</author>
		<pubDate>Thu, 27 Mar 2003 11:58:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Aren&#039;t the set_windows_close_XXX functions depricated?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Thu, 27 Mar 2003 15:25:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Compile (or rather, link) with the -mwindows switch.</p></div></div><p>

Better still, link with --Wl,--subsystem,windows instead. -mwindows, while shorter and easier to remember, is depricated.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Aren&#039;t the set_windows_close_XXX functions depricated?</p></div></div><p>

Yes, but emulated for backward compatibility.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Thu, 27 Mar 2003 16:09:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>How &#039;bout <span class="source-code"><span class="k1">int</span> <a href="http://www.allegro.cc/manual/set_close_button_callback" target="_blank"><span class="a">set_close_button_callback</span></a><span class="k2">(</span><span class="k1">void</span> <span class="k2">(</span><span class="k3">*</span>proc<span class="k2">)</span><span class="k2">(</span><span class="k1">void</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span></span> then - that one isn&#039;t deprecated, right?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Thu, 27 Mar 2003 16:27:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>But if they are depricated, doesn&#039;t this mean that they <br />a) won&#039;t work as expected (so they go dpericated in the first place) <br />b) there&#039;s a better alternative to use (and that&#039;s why they got depricated)</p><p>Just curious...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Thu, 27 Mar 2003 16:29:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>But if they are depricated, doesn&#039;t this mean that they </p></div></div><p>

they didn&#039;t work as expected. By default, the closebutton handler would close the Allegro window from a callback function, which was something the docs explicidly told you not to do.<br />Hence, a better alternative was introduced, which makes the old broken functions obsolete. However, some programs used these functions, and in order not to break old sourecode, backward comptaibility inline functions were added.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Thu, 27 Mar 2003 17:41:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Hence, a better alternative was introduced,</p></div></div><p>
Ok, what is the better alternative?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Thu, 27 Mar 2003 17:55:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>Ok, what is the better alternative? </p></div></div><p>

Disable the close button unless the user registers a callback function (using set_close_button_callback()), because it doesn&#039;t do anything useful if s/he doesn&#039;t.</p><p>Frankly, it looks more like a bugfix to me, since Allegro&#039;s original handler was broken...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Thu, 27 Mar 2003 19:08:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>ok well i already tryed using the <span class="source-code"><span class="k1">int</span> <a href="http://www.allegro.cc/manual/set_close_button_callback" target="_blank"><span class="a">set_close_button_callback</span></a><span class="k2">(</span><span class="k1">void</span> <span class="k2">(</span><span class="k3">*</span>proc<span class="k2">)</span><span class="k2">(</span><span class="k1">void</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span></span> and it says &quot;proc&quot; not found. if i cant get that to work should i just use an empty function?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (IronBob)</author>
		<pubDate>Fri, 28 Mar 2003 03:17:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>and it says &quot;proc&quot; not found. if i cant get that to work should i just use an empty function?</p></div></div><p>

Post some code, please.<br />It should look something like this:</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">void</span> my_callback<span class="k2">(</span><span class="k1">void</span><span class="k2">)</span>
<span class="k2">{</span>
   <span class="c">//do some stuff</span>
<span class="k2">}</span>

...


<a href="http://www.allegro.cc/manual/set_close_button_callback" target="_blank"><span class="a">set_close_button_callback</span></a><span class="k2">(</span>my_callback<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Fri, 28 Mar 2003 03:33:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code snippet"><div class="inner"><pre><span class="p">#include &lt;allegro.h&gt;</span>

<span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span>
<span class="k2">{</span>
    <a href="http://www.allegro.cc/manual/allegro_init" target="_blank"><span class="a">allegro_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
    <a href="http://www.allegro.cc/manual/install_keyboard" target="_blank"><span class="a">install_keyboard</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
    <a href="http://www.allegro.cc/manual/set_color_depth" target="_blank"><span class="a">set_color_depth</span></a><span class="k2">(</span><span class="n">16</span><span class="k2">)</span><span class="k2">;</span>
    <a href="http://www.allegro.cc/manual/set_gfx_mode" target="_blank"><span class="a">set_gfx_mode</span></a><span class="k2">(</span>GFX_AUTODETECT_WINDOWED, <span class="n">640</span>, <span class="n">480</span>, <span class="n">0</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
    set_window_close_hook<span class="k2">(</span><span class="k1">void</span> <span class="k2">(</span><span class="k3">*</span>proc<span class="k2">)</span><span class="k2">(</span><span class="k1">void</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
    <a href="http://www.allegro.cc/manual/readkey" target="_blank"><span class="a">readkey</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
    <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="k2">}</span> <a href="http://www.allegro.cc/manual/END_OF_MAIN" target="_blank"><span class="a">END_OF_MAIN</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (IronBob)</author>
		<pubDate>Fri, 28 Mar 2003 03:43:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It should be:<br />&lt;code&gt;<br />#include &lt;allegro.h&gt;</p><p>void func_name(void)<br />{<br />   // do something<br />}</p><p>int main()<br />{<br />    allegro_init();<br />    install_keyboard();<br />    set_color_depth(16);<br />    set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);<br />    set_window_close_hook(func_name);<br />    readkey();<br />    return 0;<br />} END_OF_MAIN();
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (MiquelFire)</author>
		<pubDate>Fri, 28 Mar 2003 03:50:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Oh come on.. Winston posted the solution to your problem already.<br />Please read the replies you get. Please. Please. Please.</p><p>Please.</p><p>Pleeeeeeeeeeeeeeeeeeeeeeeeeeeeease.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Fri, 28 Mar 2003 03:51:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>ok fine ... i got it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (IronBob)</author>
		<pubDate>Fri, 28 Mar 2003 04:59:43 +0000</pubDate>
	</item>
</rss>
