<?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>Microsonic Development &#187; Italiano</title>
	<atom:link href="http://microsonic.org/category/italiano/feed/" rel="self" type="application/rss+xml" />
	<link>http://microsonic.org</link>
	<description></description>
	<lastBuildDate>Mon, 12 Jul 2010 01:55:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Windows Programming: Creating/Using DLL&#8217;s</title>
		<link>http://microsonic.org/2009/09/08/windows-programming-creatingusing-dlls/</link>
		<comments>http://microsonic.org/2009/09/08/windows-programming-creatingusing-dlls/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 02:50:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Italiano]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[dll]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[vc++]]></category>
		<category><![CDATA[vcpp]]></category>
		<category><![CDATA[visual]]></category>

		<guid isPermaLink="false">http://microsonic.org/?p=191</guid>
		<description><![CDATA[In the world of programming, there are MANY different types. Unfortunately, programming for some systems is different than others, but it&#8217;s things like that which keep the world turning. Today, we will discuss what exactly is a Dynamic Link Library (DLL) and how to use them to keep our programming easier and more organized. I [...]]]></description>
			<content:encoded><![CDATA[<p>In the world of programming, there are MANY different types. Unfortunately, programming for some systems is different than others, but it&#8217;s things like that which keep the world turning. Today, we will discuss what exactly is a Dynamic Link Library (DLL) and how to use them to keep our programming easier and more organized. I will also include an Italian translation of this tutorial in the download source below! (Un traduzione del questo tutorial è in il download link per richiesta)</p>
<p>We&#8217;ll begin with what a DLL is and what it&#8217;s purpose is. A DLL is a wonderful tool to keep your programs organized by creating a DLL per set of functions. Also, it helps developers keep their closed source functions closed source, but also allows (with proper documentation/instructions on doing so) other users to use their work. Below we will give a few simple examples on how it all works!</p>
<p>To create the DLL we will be using Microsoft&#8217;s Visual C++. This is a free IDE compiler. I use it for any sort of Windows programming that I may do and will include the solution file in the download. Of course, I prefer GNU&#8217;s GCC which is also free, but the Windows ports of the compiler are not as good as the standard linux version.</p>
<p>The first note that I want to make is that if you&#8217;re making this project on your own (and not using my solution file), be sure to go to Project->Your Project&#8217;s Properties->Configuration Properties->General->Configuration Type and change it to &#8220;Dynamic Library (.dll)&#8221; otherwise it will not compile correctly.</p>
<p>Now in this tutorial, I am assuming you already know how to write programs, so this first file is test_dll.cpp. It contains the actual definitions, etc. of our functions:</p>
<blockquote><p><code>/**<br />
 * Test Dynamic Library File<br />
 *<br />
 * (C) 2009 Dennis J. McWherter, Jr. All Rights Reserved.<br />
 *<br />
 */</p>
<p>#define WIN32_LEAN_AND_MEAN // No need for the extra stuff.<br />
							// Non includere i file cui non hanno un scopo<br />
#include &lt;windows.h&gt;<br />
#include &lt;iostream&gt;<br />
#include "test_dll.h" // Our header file<br />
					  // Il nostro header file</p>
<p>using namespace std;</p>
<p>// Initiate the DLL (For programs)<br />
// Iniziare il DLL (per i programmi)<br />
BOOL APIENTRY DllMain(HINSTANCE dllHinst, DWORD reason, LPVOID lpvReserved){<br />
	// Use a switch to tell the program how to cycle the processes<br />
	// Usare un switch per fare il programma funziona<br />
	switch(reason){<br />
		case DLL_PROCESS_ATTACH:<br />
		break;<br />
		case DLL_PROCESS_DETACH:<br />
		break;<br />
		case DLL_THREAD_ATTACH:<br />
		break;<br />
		case DLL_THREAD_DETACH:<br />
		break;<br />
	}<br />
	return true;<br />
}</p>
<p>// The functions of our class. These are defined in "test_dll.h"<br />
// Le funzioni del nostro class. Gli questi sono definire in "test_dll.h"</p>
<p>// Constructor<br />
test_dll::test_dll(){}</p>
<p>// Basically a pointless function just to see how we can make them work together XD<br />
// Una funziona senza la usa. è più di un demonstrazione.<br />
char test_dll::func1(char lang){<br />
	return lang;<br />
}</p>
<p>int test_dll::func2(float x,float y,char op){<br />
	// Simple math function!<br />
	// Semplice funziona della matematica<br />
	switch(op){<br />
		case 'a':<br />
			cout&lt;&lt; x &lt;&lt; "+" &lt;&lt; y &lt;&lt; "=" &lt;&lt; x+y;<br />
			return 0;<br />
		break;<br />
		case 's':<br />
			cout&lt;&lt; x &lt;&lt; "-" &lt;&lt; y &lt;&lt; "=" &lt;&lt; x-y;<br />
			return 0;<br />
		break;<br />
		case 'd':<br />
			cout&lt;&lt; x &lt;&lt; "/" &lt;&lt; y &lt;&lt; "=" &lt;&lt; x/y;<br />
			return 0;<br />
		break;<br />
		default:<br />
			cout&lt;&lt; x &lt;&lt; "*" &lt;&lt; y &lt;&lt; "=" &lt;&lt; x*y;<br />
			return 0;<br />
		break;<br />
	}<br />
	return 0;<br />
}<br />
</code></p></blockquote>
<p>Again, a fairly straightforward example. What you do have to notice in this that is different from most programs is that fact that we&#8217;re not really calling a &#8220;Main&#8221; function to be run. We call BOOL WINAPI <strong>DllMain</strong> instead. This next file is the header file. A rather important file overall as it let&#8217;s us know what to export.</p>
<blockquote><p><code><br />
 /**<br />
 * Test Dynamic Library File<br />
 *<br />
 * (C) 2009 Dennis J. McWherter, Jr. All Rights Reserved.<br />
 *<br />
 */</p>
<p>#ifndef HEADER<br />
#define HEADER<br />
	// To keep the code clean we'll define this with a macro but this tells the processor<br />
		// to export whichever function/class it preceeds.<br />
	// Ci definiamo il questo con un macro ma ci vedremmo come lo funziona in più ritardo<br />
#define EXPORT_DLL __declspec(dllexport)</p>
<p>// Now our class - If you export a class, all its functions come with! <img src='http://microsonic.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  else do each function<br />
// Adesso il nostro class! Se exporti un class poi i tutti funzione di lo sono exportare.<br />
	// se individuale ti exporti poi si deve __declspec(dllexport) per ogni<br />
class EXPORT_DLL test_dll{ // = class __declspec(dllexport) test_dll{<br />
public:<br />
	test_dll(); // Constructor/Costruttore<br />
	char func1(char lang); // First function definition/La definizione della prima funziona<br />
	int func2(float x,float y,char op);<br />
};</p>
<p>#endif<br />
</code></p></blockquote>
<p>The comments explain it, but it&#8217;s really worth going over again. EXPORT_DLL is defined just for the purpose that we could potentially have more than a single class to export. This goes both ways for the dllexport and dllimport options, so really, EXPORT_DLL just translates to __declspec(dllexport) which would also work if you replaced EXPORT_DLL. Now, compile that code and VC++ should provide you with a .dll file and a .lib file with whatever name you gave the project (in our case: &#8220;DLL_Tutorial.lib/.dll&#8221;).</p>
<p>Now, you cannot run DLL files by themselves; you need a client program (.exe) which is what we&#8217;re getting to now. For the sake of brevity, we will just make this a simple console program which runs the proper functions. Now, create a new project and make sure you copy the &#8220;DLL_Tutorial.lib&#8221; file into the source directory. You need the .lib file to compile the client program, but you only need the .dll to run the program.</p>
<p>So here is the client main file. A console program of course to keep things simple <img src='http://microsonic.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  We&#8217;ll call this test_client.cpp</p>
<blockquote><p><code>/**<br />
 * Test Dynamic Library File<br />
 *<br />
 * (C) 2009 Dennis J. McWherter, Jr. All Rights Reserved.<br />
 *<br />
 */</p>
<p>#include &lt;iostream&gt;<br />
#include &lt;string&gt;<br />
#include "test_client.h"</p>
<p>using namespace std;</p>
<p>int main(){<br />
	// Create object to class<br />
	// Creare l'oggetto a class<br />
	test_dll test;</p>
<p>	// Init var<br />
	string num1,num2,addition,subtraction,division,multiplication,ans,operation;<br />
	float x,y;<br />
	char choice[5], op[5]; // Allow more chars just in case - otherwise we'll break the script <img src='http://microsonic.org/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /><br />
						   // Permettere dei più caratteri così non ci romperiamo il script! <img src='http://microsonic.org/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /><br />
	cout&lt;&lt; "Please select a language\r\n\r\nEnglish - en\r\nItaliano - it\r\n \r\nSelect: ";<br />
	cin&gt;&gt;choice;<br />
	switch(test.func1(choice[0])){<br />
		case 'i':<br />
			num1 = "Numero 1: ";<br />
			num2 = "Numero 2: ";<br />
			addition = "Per piacere selezi i tuoi numeri per aggiungiere";<br />
			subtraction = "Per piacere selezi i tuoi numeri per sottrarre";<br />
			division = "Per piacere selezi i tuoi numeri per dividere";<br />
			multiplication = "Per piacere selezi i tuoi numeri per moltiplicare";<br />
			ans = "La tua risposta: ";<br />
			operation = "\r\nPer piacere selezi il tuo operazione:\r\na - Aggiungiere\r\ns - Sottrarre\r\nd - Divisione\r\nm - Moltiplicazione\r\n\r\nSelection: ";<br />
		break;<br />
		default:<br />
			num1 = "Number 1: ";<br />
			num2 = "Number 2: ";<br />
			addition = "Please select your numbers to add";<br />
			subtraction = "Please select your numbers to subtract";<br />
			division = "Please select your numbers to divide";<br />
			multiplication = "Please select your numbers to multiply";<br />
			ans = "Your answer: ";<br />
			operation = "\r\nPlease select your option:\r\na - Addition\r\ns - subtraction\r\nd - Division\r\nm - Multiplication\r\n\r\nSelection: ";<br />
		break;<br />
	}</p>
<p>	cout&lt;&lt; operation;<br />
	cin&gt;&gt;op;<br />
	cout&lt;&lt; endl &lt;&lt; endl &lt;&lt; num1;<br />
	cin&gt;&gt;x;<br />
	cout&lt;&lt; endl &lt;&lt; num2;<br />
	cin&gt;&gt;y;</p>
<p>	test.func2(x,y,op[0]);</p>
<p>	cout&lt;&lt; endl &lt;&lt; endl &lt;&lt; "Type in anything to exit...";<br />
	cin&gt;&gt;op;</p>
<p>	return 0;<br />
}</code></p></blockquote>
<p>Naturally, the header file that follows is test_client.h</p>
<blockquote><p><code>/**<br />
 * Test Dynamic Library File<br />
 *<br />
 * (C) 2009 Dennis J. McWherter, Jr. All Rights Reserved.<br />
 *<br />
 */</p>
<p>#ifndef TEST_HEADER<br />
#define TEST_HEADER<br />
#define DLL_IMPORT __declspec(dllimport) // Same concept as export<br />
									     // Il stesso concepto come export</p>
<p>// Define the class</p>
<p>// What is the purpose of redefining? That's all you need to do is redefine structure <img src='http://microsonic.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
	// and not function <img src='http://microsonic.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
// Perchè ti deve ridefinire la class? Perché solo lo struttura si deve essere definire!<br />
	// e no funziona <img src='http://microsonic.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
class DLL_IMPORT test_dll{<br />
public:<br />
	test_dll(); // Constructor/Costruttore<br />
	char func1(char lang); // First function definition/La definizione della prima funziona<br />
	int func2(float x,float y,char op);<br />
};</p>
<p>#endif</code></p></blockquote>
<p>Within these two files, they are essentially creating a calculator. Since I wrote this program in dual languages, I added SIMPLE (meaning hard-coded) dual language support into the program. Also, this gives a reason for the first function, just to see how one can use multiple functions from a DLL just as if they were in the source.</p>
<p>If anyone has further questions or is receiving errors, feel free to let me know and I will be glad to help! Now make sure, however, that everything is set right as well. I ran into an error compiling the client the first time because my project subsystem (found in project properties->linker->System) was set to WINDOWS rather than CONSOLE so it was looking for the WINMAIN where there was none. So just a word of caution to anyone trying this without my source and you are receiving a WINMAIN compilation error.</p>
<p>So the land of DLL&#8217;s really aren&#8217;t as complex as it seems. It&#8217;s simply a closed source utility which helps other developers in WINDOWS programs.</p>
<p>Regards,<br />
Dennis M.</p>
<p><a href='http://microsonic.org/2009/09/08/windows-programming-creatingusing-dlls/dll_tutorial/' rel='attachment wp-att-192'>DLL Tutorial Source Code and Binaries</a></p>
]]></content:encoded>
			<wfw:commentRss>http://microsonic.org/2009/09/08/windows-programming-creatingusing-dlls/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Converting a String to a Vector</title>
		<link>http://microsonic.org/2009/08/24/converting-a-string-to-a-vector/</link>
		<comments>http://microsonic.org/2009/08/24/converting-a-string-to-a-vector/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 03:52:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Italiano]]></category>
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://microsonic.org/?p=187</guid>
		<description><![CDATA[It has been a long while since I&#8217;ve posted a C or C++ tutorial, but here comes another one! I try to help with programming tips on various forums across the internet. I am a fluent English and Italian speaker, so naturally I work on forums of both languages. While browsing an Italian forum, I [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a long while since I&#8217;ve posted a C or C++ tutorial, but here comes another one! I try to help with programming tips on various forums across the internet. I am a fluent English and Italian speaker, so naturally I work on forums of both languages. While browsing an Italian forum, I came across an interesting question. How does one convert a C++ string to a vector. I decided I would lend a hand, and it bears repeating on here.</p>
<p>Vectors can be used for various things in C++, but they are for the more advanced programmer really. They are not really necessary if it is not a complex program, but this tutorial could serve useful for many I&#8217;m sure.</p>
<p>I myself was at first puzzled by the question. I had never thought of a reason to do this and so, frankly, I never have. After some thought, it wasn&#8217;t too bad, but still an interesting concept. I&#8217;ll post the code below and then explain further below that. Comments are in both English and Italian. The reason being is what I previously mentioned about the original reason I wrote this code.</p>
<blockquote><p><code>/**<br />
 * String to Vector Tutorial by Dennis M.<br />
 *<br />
 * un tutorial di microsonic.org<br />
 *<br />
 */</p>
<p>// Include files ~ Includere i file<br />
#include &lt;string&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;vector&gt;</p>
<p>using namespace std;</p>
<p>int main()<br />
{<br />
	// Declare Variables ~ Definire i varibili<br />
	string data = "one - uno";<br />
	vector&lt;string&gt; vect;</p>
<p>	// Insert data into vector ~ Inserire l'informazione in il vector<br />
	vect.push_back(data);<br />
	data = "two - due";<br />
	vect.push_back(data);<br />
	data = "three - tre";<br />
	vect.push_back(data);</p>
<p>	// Loop to view the contents of the vector ~ Loop per vedere i contenti di il vector<br />
	for(unsigned int i=0;i&lt;vect.size();i++){<br />
		cout&lt;&lt; i &lt;&lt; ": " &lt;&lt; vect.at(i) &lt;&lt; endl;<br />
	}</p>
<p>	// Memory Management ~ Ci sicuriamo la memoria!<br />
	vect.clear();</p>
<p>	return 0;<br />
}<br />
</code></p></blockquote>
<p>Now the code is pretty self-explanatory and the comments I think do a pretty good job. The only thing one may be perplexed about is where the functions and pointers come from. If you examine the documentation (header file?) for a vector, all is clearly defined. This example will also print the vector and clear it before it exits.</p>
<p>So I hope this post is of some service to someone and as usual, I have included the source and binaries in the post!</p>
<p><a href='http://microsonic.org/2009/08/24/converting-a-string-to-a-vector/string-vector-tar/' rel='attachment wp-att-188'>String to Vector Tutorial</a></p>
<p>Regards,<br />
Dennis M.</p>
]]></content:encoded>
			<wfw:commentRss>http://microsonic.org/2009/08/24/converting-a-string-to-a-vector/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I Più Esempi nell&#8217;Inglese</title>
		<link>http://microsonic.org/2009/04/04/esempi-codici/</link>
		<comments>http://microsonic.org/2009/04/04/esempi-codici/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 12:07:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Italiano]]></category>
		<category><![CDATA[codice]]></category>
		<category><![CDATA[guida]]></category>
		<category><![CDATA[inglese]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[prima]]></category>
		<category><![CDATA[sito]]></category>

		<guid isPermaLink="false">http://microsonic.org/?p=14</guid>
		<description><![CDATA[Ciao, Presto mi farò scrivendo un&#8217;articolo di PHP e salt encryption per i passwords. L&#8217;questo articolo sarà in inglese. Cosi se non c&#8217;è nessuno che lo ha un bisogno di un traduzione mi non farò uno. Comunque a voi mi continuò scrivere su qui! Grazie per i tuoi supporti e suggerimenti. Ciao Ciao, Dennis]]></description>
			<content:encoded><![CDATA[<p>Ciao,</p>
<p>Presto mi farò scrivendo un&#8217;articolo di PHP e salt encryption per i passwords. L&#8217;questo articolo sarà in inglese. Cosi se non c&#8217;è nessuno che lo ha un bisogno di un traduzione mi non farò uno. Comunque a voi mi continuò scrivere su qui! Grazie per i tuoi supporti e suggerimenti.</p>
<p>Ciao Ciao,<br />
Dennis</p>
]]></content:encoded>
			<wfw:commentRss>http://microsonic.org/2009/04/04/esempi-codici/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Chiedi me!</title>
		<link>http://microsonic.org/2009/03/12/chiedi-me/</link>
		<comments>http://microsonic.org/2009/03/12/chiedi-me/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 03:24:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Italiano]]></category>
		<category><![CDATA[chiedi]]></category>
		<category><![CDATA[me]]></category>

		<guid isPermaLink="false">http://microsonic.org/?p=15</guid>
		<description><![CDATA[Non sono certo dei cose vorrete a chiedere me! Come ho parlato &#8211; sono americano. cosi` se vogli si puoi chidere me della america! (o il codice ) Ciao, Dennis M.]]></description>
			<content:encoded><![CDATA[<p>Non sono certo dei cose vorrete a chiedere me! Come ho parlato &#8211; sono americano. cosi` se vogli si puoi chidere me della america! (o il codice <img src='http://microsonic.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> )</p>
<p>Ciao,<br />
Dennis M.</p>
]]></content:encoded>
			<wfw:commentRss>http://microsonic.org/2009/03/12/chiedi-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Benvenuti!</title>
		<link>http://microsonic.org/2009/03/11/benvenuti/</link>
		<comments>http://microsonic.org/2009/03/11/benvenuti/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 02:26:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Italiano]]></category>
		<category><![CDATA[benvenuto]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[codice]]></category>
		<category><![CDATA[nuovo]]></category>

		<guid isPermaLink="false">http://microsonic.org/?p=9</guid>
		<description><![CDATA[Benvenuti a tutti! Oggi ho iniziato il questo blog e sarà del codice e la tutta tecnologica. Se hai ogni questioni, per piacere chiedi! Anch&#8217;io  scrivò un articolo oggi forse. Sì io sono Americano comunque non uso un traduttore &#8211; parlo l&#8217;italiano veramente! Ciao, Dennis M.]]></description>
			<content:encoded><![CDATA[<p>Benvenuti a tutti!</p>
<p>Oggi ho iniziato il questo blog e sarà del codice e la tutta tecnologica. Se hai ogni questioni, per piacere chiedi! Anch&#8217;io  scrivò un articolo oggi forse. Sì io sono Americano comunque non uso un traduttore &#8211; parlo l&#8217;italiano veramente!</p>
<p>Ciao,<br />
Dennis M.</p>
]]></content:encoded>
			<wfw:commentRss>http://microsonic.org/2009/03/11/benvenuti/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
