<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Misterdom's World &#187; Visual Studio .Net</title>
	<atom:link href="http://www.guinard.org/~misterdom/category/loogbook/visual-studio-net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.guinard.org/~misterdom</link>
	<description>My Computing Logbook</description>
	<lastBuildDate>Fri, 25 Jun 2010 14:12:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Distributing a Visual Studio C++ Exe That Does not Need the Windows .NET Framework</title>
		<link>http://www.guinard.org/~misterdom/2009/09/17/distributing-a-visual-studio-c-exe/</link>
		<comments>http://www.guinard.org/~misterdom/2009/09/17/distributing-a-visual-studio-c-exe/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 11:49:24 +0000</pubDate>
		<dc:creator>misterdom</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Visual Studio .Net]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[exe]]></category>
		<category><![CDATA[framework]]></category>

		<guid isPermaLink="false">http://www.guinard.org/~misterdom/?p=108</guid>
		<description><![CDATA[If like me you export your Visual Studio (2008) .NET C++ project as an EXE, copy it on another machine and get: &#8220;This application has failed to start because the application configuration is incorrect&#8221;. Then it might be because the target machine is actually missing the Microsoft .NET Framework.
Since I did not really felt like [...]]]></description>
			<content:encoded><![CDATA[<p>If like me you export your Visual Studio (2008) .NET C++ project as an EXE, copy it on another machine and get: &#8220;This application has failed to start because the application configuration is incorrect&#8221;. Then it might be because the target machine is actually missing the Microsoft .NET Framework.</p>
<p>Since I did not really felt like asking all the future users of my app to install the .NET framework, I started looking for a way of embedding these libs in my final app.</p>
<p>While it is apparently not possible to do so without requiring a special (commercial) tool, there is a workaround that worked for me. By forcing the C/C++ to by statically linked the framework functions actually are embedded into the EXE (which, btw, gets much bigger then).</p>
<p>To do so (in Visual Studio .NET 2008 C/C++, Express) do:<br />
Property Page -> Configuration Properties -> C/C++ -> Code Generation then &#8220;Runtime Library&#8221; should be set to an &#8220;non-dll&#8221; option such as Multi-threaded (for the release target) or Multi-threaded Debug (to debug your app).</p>
<p>Here we go!</p>
<p>Sources:<br />
<a href="http://stackoverflow.com/questions/271290/can-visual-studio-2008-standard-create-a-single-exe-that-does-not-require-net-fr">http://stackoverflow.com/questions/271290/can-visual-studio-2008-standard-create-a-single-exe-that-does-not-require-net-fr</a></p>
<p><a href="http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/36971526-95f3-4a9f-a601-1843c86332c1">http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/36971526-95f3-4a9f-a601-1843c86332c1</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guinard.org/~misterdom/2009/09/17/distributing-a-visual-studio-c-exe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Giving some REST to your C++ code: embedding the SHTTPD server.</title>
		<link>http://www.guinard.org/~misterdom/2008/10/27/giving-some-rest-to-your-c-code-embedding-the-shttp-server/</link>
		<comments>http://www.guinard.org/~misterdom/2008/10/27/giving-some-rest-to-your-c-code-embedding-the-shttp-server/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 14:28:33 +0000</pubDate>
		<dc:creator>misterdom</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Dev Logbook]]></category>
		<category><![CDATA[Plogg and Smart Meters]]></category>
		<category><![CDATA[Visual Studio .Net]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[visualstudio]]></category>
		<category><![CDATA[webserver]]></category>

		<guid isPermaLink="false">http://www.guinard.org/~misterdom/?p=21</guid>
		<description><![CDATA[Wanting to turn the Ploggs, into more RESTful devices, I needed to add a web server (HTTP) to the C++ code managing the Ploggs.
After comparing and trying a number of lightweight web servers (Apache was not an option for this kind of small app) I picked SHTTPD, mainly because:

 It was one of the few [...]]]></description>
			<content:encoded><![CDATA[<p>Wanting to turn the <a href="?cat=4">Ploggs</a>, into more RESTful devices, I needed to add a web server (HTTP) to the C++ code managing the Ploggs.</p>
<p>After comparing and trying a number of lightweight web servers (Apache was not an option for this kind of small app) I picked <a href="http://shttpd.sourceforge.net/">SHTTPD</a>, mainly because:</p>
<ol>
<li> It was one of the few I managed to embed in my C++ code (I&#8217;m not a C expert&#8230;)</li>
<li> It offered the possibility of registering call back methods when a particular URL is called, which makes it a quite good candidate for a REST interface.</li>
</ol>
<p>Here is how I did proceed to integrate it to my Microsoft Visual C++ project:</p>
<ol>
<li>Compile the project (the core, not the example), this should create a <code>shttpd.lib</code> file. (<a href="?p=17">This post might in case you do not succeed this step </a>).</li>
<li>Copy the shttpd.lib, shttpd.h to your src folder (the one of your Visual Studio project).</li>
<li>Download <a href="http://shttpd.sourceforge.net/shttpd.pem">shttpd.pem</a> and copy it to your src folder as well.</li>
<li>Add the <code>shttpd.h</code> file to your project.</li>
<li>Add the following lib references to your project: <code>shttpd.lib ws2_32.lib</code>, see <a href="?p=15">to get details on how to add it.</a></li>
<li>Add the code to start and setup the server. Snippets can be found in the example folder of the SHTTPD distrib. That in my case:</li>
</ol>
<p><code><br />
// TestSHTTPD.cpp : Defines the entry point for the console application.<br />
#include<br />
#include<br />
#include<br />
#include<br />
#include </code></p>
<p>#include &#8220;stdafx.h&#8221;<br />
#include &#8220;shttpd.h&#8221;</p>
<p>#define ALIAS_URI &#8220;/my_c&#8221;<br />
#define ALIAS_DIR &#8220;c:\\&#8221;</p>
<p>static void show_index(struct shttpd_arg *arg) {<br />
shttpd_printf(arg, &#8220;%s&#8221;,<br />
&#8220;HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n&#8221;<br />
&#8220;Welcome to embedded example of SHTTPD&#8221;);<br />
arg-&gt;flags |= SHTTPD_END_OF_OUTPUT;<br />
}</p>
<p>int _tmain(int argc, char* argv[])<br />
{<br />
/*<br />
* Initialize SHTTPD context.<br />
* Attach folder c:\ to the URL /my_c  (for windows), and<br />
* /etc/ to URL /my_etc (for UNIX). These are Apache-like aliases.<br />
* Set WWW root to current directory.<br />
* Start listening on ports 8080 and 8081<br />
*/<br />
int	data = 1234567;<br />
struct shttpd_ctx	*ctx;<br />
ctx = shttpd_init(argc, argv);<br />
shttpd_set_option(ctx, &#8220;ssl_cert&#8221;, &#8220;shttpd.pem&#8221;);<br />
shttpd_set_option(ctx, &#8220;aliases&#8221;, ALIAS_URI &#8220;=&#8221; ALIAS_DIR);<br />
shttpd_set_option(ctx, &#8220;ports&#8221;, &#8220;8080,8081s&#8221;);</p>
<p>/* Register an index page under two URIs */<br />
shttpd_register_uri(ctx, &#8220;/&#8221;, &amp;show_index, (void *) &amp;data);<br />
shttpd_register_uri(ctx, &#8220;/abc.html&#8221;, &amp;show_index, (void *) &amp;data);</p>
<p>/* Serve connections infinitely until someone kills us */<br />
for (;;)<br />
shttpd_poll(ctx, 1000);</p>
<p>/* Probably unreached, because we will be killed by a signal */<br />
shttpd_fini(ctx);</p>
<p>return 0;<br />
}</p>
<p>You should now be able to use the web server within your application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guinard.org/~misterdom/2008/10/27/giving-some-rest-to-your-c-code-embedding-the-shttp-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running a makefile from the command line on Windows</title>
		<link>http://www.guinard.org/~misterdom/2008/10/23/running-a-makefile-from-the-command-line-on-windows/</link>
		<comments>http://www.guinard.org/~misterdom/2008/10/23/running-a-makefile-from-the-command-line-on-windows/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 13:33:14 +0000</pubDate>
		<dc:creator>misterdom</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Dev Logbook]]></category>
		<category><![CDATA[Ubicomp / Pervasive]]></category>
		<category><![CDATA[Visual Studio .Net]]></category>

		<guid isPermaLink="false">http://www.guinard.org/~misterdom/?p=17</guid>
		<description><![CDATA[Running a makefile in command-line on Windows can be painful if you try to set all the environment variables (path, bin folder for the nmake utility, and so forth) manually, luckily enough, Visual Studio (Express edition as well) comes bundled with a batch file that does it for you: vcvars32.bat.
The tool is located in the [...]]]></description>
			<content:encoded><![CDATA[<p>Running a makefile in command-line on Windows can be painful if you try to set all the environment variables (path, bin folder for the nmake utility, and so forth) manually, luckily enough, Visual Studio (Express edition as well) comes bundled with a batch file that does it for you: <code>vcvars32.bat</code>.</p>
<p>The tool is located in the <code>bin</code> folder of your Visual Studio install.</p>
<p>Source: <a href="http://www.codeguru.com/forum/archive/index.php/t-419379.html">http://www.codeguru.com/forum/archive/index.php/t-419379.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guinard.org/~misterdom/2008/10/23/running-a-makefile-from-the-command-line-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using a dll library from one Visual Studio Express 2008 project in another</title>
		<link>http://www.guinard.org/~misterdom/2008/10/23/using-a-dll-library-from-one-visual-studio-express-2008-project-in-another/</link>
		<comments>http://www.guinard.org/~misterdom/2008/10/23/using-a-dll-library-from-one-visual-studio-express-2008-project-in-another/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 08:07:08 +0000</pubDate>
		<dc:creator>misterdom</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Dev Logbook]]></category>
		<category><![CDATA[Visual Studio .Net]]></category>
		<category><![CDATA[dll]]></category>
		<category><![CDATA[linker]]></category>
		<category><![CDATA[visualstudio]]></category>

		<guid isPermaLink="false">http://www.guinard.org/~misterdom/?p=15</guid>
		<description><![CDATA[Coming from the Java world I would describe dlls as sort of jar files. A dll represents the component part of an application, that is: not the end-user part but rather the re-usable part of a Windows app. The so-called API of a dll is the .h file. That means the .h file contains all [...]]]></description>
			<content:encoded><![CDATA[<p>Coming from the Java world I would describe dlls as sort of jar files. A dll represents the component part of an application, that is: not the end-user part but rather the re-usable part of a Windows app. The so-called API of a dll is the .h file. That means the .h file contains all the methods, or functions that one can call on the dll.</p>
<p>To use the dll of Visual Studio (Express 2008) project A in project B we do what microsoft calls an implicit linking (<a href="http://msdn.microsoft.com/en-us/library/d14wsce5(VS.80).aspx">http://msdn.microsoft.com/en-us/library/d14wsce5(VS.80).aspx</a>). In more concrete terms here are the steps to follow:</p>
<p>1) Generate the dll of project A. When you do this, the linker (after-compiler thingy) creates both a dll and a lib file.<br />
2) Copy the dll and the lib file to project B, namely to a place accessible by the compiler and the linker, a place that&#8217;s on the classpath to use the Java terminology.<br />
3) Right-click on the project B in Visual Studio and select Configuration Properties -&gt; Linker -&gt; Input -&gt; Additional Dependencies<br />
4) There you can select the .lib counterpart of the dll (e.g. swill.lib in my case).</p>
<div id="attachment_14" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.guinard.org/~misterdom/wp-content/uploads/2008/10/implicit_link.jpg"><img class="size-medium wp-image-14" title="implicit_link" src="http://www.guinard.org/~misterdom/wp-content/uploads/2008/10/implicit_link-300x187.jpg" alt="Add additional dependencies" width="300" height="187" /></a><p class="wp-caption-text">Add additional dependencies</p></div>
<p>5) Add the header file (.h) of the dll to your project.</p>
<p>That&#8217;s it you should now be able to use the dll of A from project B, at least it worked fine for me.<br />
Btw, being mainly a Java developer, I&#8217;m rather new to C++ so if that&#8217;s a silly way of doing it please do comment the post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guinard.org/~misterdom/2008/10/23/using-a-dll-library-from-one-visual-studio-express-2008-project-in-another/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Showing line number in Visual Studio .Net</title>
		<link>http://www.guinard.org/~misterdom/2008/10/17/showing-line-number-in-visual-studio-net/</link>
		<comments>http://www.guinard.org/~misterdom/2008/10/17/showing-line-number-in-visual-studio-net/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 13:02:40 +0000</pubDate>
		<dc:creator>misterdom</dc:creator>
				<category><![CDATA[Dev Logbook]]></category>
		<category><![CDATA[Visual Studio .Net]]></category>

		<guid isPermaLink="false">http://www.guinard.org/~misterdom/?p=9</guid>
		<description><![CDATA[How can one do anything without having line number listed next to his/her code? Um?
To display them in Visual Studio .Net 2008 Express goto:
Tools-&#62;Options-&#62;Text Editor-&#62;All languages and select show line numbers.
Took me half an our to find that out, good old Netbeans fellow, where it takes just a right click on the text zone to [...]]]></description>
			<content:encoded><![CDATA[<p>How can one do anything without having line number listed next to his/her code? Um?<br />
To display them in Visual Studio .Net 2008 Express goto:</p>
<p>Tools-&gt;Options-&gt;Text Editor-&gt;All languages and select show line numbers.</p>
<p>Took me half an our to find that out, good old Netbeans fellow, where it takes just a right click on the text zone to switch the line numbers on/off&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guinard.org/~misterdom/2008/10/17/showing-line-number-in-visual-studio-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to reformat your code in Visual Studio</title>
		<link>http://www.guinard.org/~misterdom/2008/10/17/how-to-reformat-your-code-in-visual-studio/</link>
		<comments>http://www.guinard.org/~misterdom/2008/10/17/how-to-reformat-your-code-in-visual-studio/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 12:43:02 +0000</pubDate>
		<dc:creator>misterdom</dc:creator>
				<category><![CDATA[Dev Logbook]]></category>
		<category><![CDATA[Visual Studio .Net]]></category>

		<guid isPermaLink="false">http://www.guinard.org/~misterdom/?p=6</guid>
		<description><![CDATA[Select your code and do CTRL-K, CTRL-F. That&#8217;s it!
]]></description>
			<content:encoded><![CDATA[<p>Select your code and do CTRL-K, CTRL-F. That&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guinard.org/~misterdom/2008/10/17/how-to-reformat-your-code-in-visual-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
