<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Blog di Sara</title>
        <link>http://blogs.ugidotnet.org/ProgettoDiInstallazione/Default.aspx</link>
        <description>Il blog di Sara Fabris</description>
        <language>it-IT</language>
        <copyright>Sara Fabris</copyright>
        <generator>Subtext Version 2.6.0.0</generator>
        <image>
            <title>Blog di Sara</title>
            <url>http://blogs.ugidotnet.org/images/RSS2Image.gif</url>
            <link>http://blogs.ugidotnet.org/ProgettoDiInstallazione/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>Libreria di Classi C++ - Conversione da String a char</title>
            <link>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2007/05/08/77679.aspx</link>
            <description>&lt;H2&gt;&lt;FONT face=Arial size=2&gt;In questi giorni ho trovato un po' di difficolt&amp;#224; nel trovare documentazione e informazioni sulla conversione di Stringhe in char.&lt;BR&gt;Il problema non&amp;nbsp;&amp;#232; tanto in un progetto WindowsForms o Console (linguaggi C++ .NET) dove l'operazione&amp;nbsp;&amp;#232; piuttosto semplice, ovvero basta scrivere:&lt;/FONT&gt;&lt;/H2&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;#include &amp;lt;stdlib.h&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR&gt;#include &amp;lt;&lt;FONT color=#000000&gt;malloc&lt;/FONT&gt;.h&amp;gt;&lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;void main( void )&lt;BR&gt;{&lt;BR&gt;DWORD len =50;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial&gt;//ESEGUO L'ALLOCAZIONE DELL'ARRAY DI CHAR DI DIMENSIONE 50&lt;BR&gt;&lt;FONT color=#000000&gt;&lt;STRONG&gt;char* c1 = (char&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000000&gt;&lt;STRONG&gt; *) malloc( len ); //&lt;/STRONG&gt;oppure basta scrivere char* c1 = new char[50];&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000000 size=2&gt;&lt;STRONG&gt;String *str = "Hello World";&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial&gt;//INSERISCO I VARI CARATTERI ALL'INTERNO DELL'ARRAY DI CHAR&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000000&gt;&lt;STRONG&gt;for (int&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000000 size=2&gt;&lt;STRONG&gt; i=0;i&amp;lt;str-&amp;gt;Length; i++){&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c1[i] = Convert::ToChar(str-&amp;gt;Substring(i,1));&lt;BR&gt;}}}&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Per&amp;#242; se voglio fare lo stesso per un progetto DLL libreria di classi scritto in C++ come faccio?&lt;BR&gt;C'&amp;#232; un esempio di microsoft piuttosto interessante che spiega come risolvere il problema.&lt;BR&gt;L'esempio di trova a questo &lt;A href="http://support.microsoft.com/kb/311259/"&gt;http://support.microsoft.com/kb/311259/&lt;/A&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT face=Arial size=2&gt;In particolare il codice&amp;nbsp;&amp;#232; questo:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;using namespace System::Runtime::InteropServices;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;int _tmain(void)&lt;BR&gt;{&lt;/STRONG&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;//Grazie al Metodo Marshal::StringToHGlobalAnsi riesco a convertire una stringa in un'array di char e mi ritorna il puntatore al primo elemento &lt;BR&gt;//dell'array.&lt;BR&gt;&lt;STRONG&gt;char* str2 = (char*)(void*)Marshal::StringToHGlobalAnsi(str);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;....eseguo le operazioni su str2&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;//E' molto importante ricorda che la classe Marshal offre un insieme di metodi per l'allocazione della memoria non gestita. &lt;BR&gt;//&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;Quindi quando si lavora con la memoria non gestita non &amp;#232; pi&amp;#249; il Garbage ad occuparsi della deallocazione della memoria, &lt;BR&gt;//ma&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;sar&amp;#224; nostro compito (cio&amp;#232; compito del programmatore) occuparsi di ci&amp;#242;. Per la classe Marshal il metodo da richiamare &amp;#232;:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;Marshal::FreeHGlobal(str2);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;BR&gt;}&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Spero possa esservi d'aiuto questo blog.&lt;BR&gt;Ciao&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Sara&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.ugidotnet.org/ProgettoDiInstallazione/aggbug/77679.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sara Fabris</dc:creator>
            <guid>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2007/05/08/77679.aspx</guid>
            <pubDate>Tue, 08 May 2007 18:02:00 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2007/05/08/77679.aspx#feedback</comments>
            <slash:comments>1143</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/ProgettoDiInstallazione/comments/commentRss/77679.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/ProgettoDiInstallazione/services/trackbacks/77679.aspx</trackback:ping>
        </item>
        <item>
            <title>ImageButton e LinkButton nel Datagrid</title>
            <link>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2007/04/24/76459.aspx</link>
            <description>&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Arial"&gt;&lt;STRONG&gt;Come si pu&amp;#242; inserire nel codice di un progetto Asp.net un'ImageButton oppure un linkButton in un Datagrid?? &lt;?xml:namespace prefix = u1 /&gt;&lt;u1:p&gt;&lt;/u1:p&gt;&lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Arial"&gt;&lt;STRONG&gt;Nei forum si trovano notizie frammentate e quindi ho deciso di raccogliere tutte qui in questo post. &lt;u1:p&gt;&lt;/u1:p&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Arial"&gt;&lt;STRONG&gt;Vediamo come creare intanto un ImageButton:&lt;/STRONG&gt; &lt;BR style="mso-special-character: line-break"&gt;&lt;BR style="mso-special-character: line-break"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;u1:p&gt;&lt;/u1:p&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;B&gt;&lt;SPAN lang=EN-GB style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial; mso-ansi-language: EN-GB"&gt;public class ImageButtonColumn : TemplateColumn&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN lang=EN-GB style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial; mso-ansi-language: EN-GB; mso-bidi-font-weight: bold"&gt; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN-GB style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial; mso-ansi-language: EN-GB"&gt;{ &lt;BR&gt;private ImageButtonItem imgItem; &lt;u1:p&gt;&lt;/u1:p&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN lang=EN-GB style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial; mso-ansi-language: EN-GB"&gt;public event ImageClickEventHandler Click &lt;BR&gt;{ &lt;BR&gt;add &lt;BR&gt;{ &lt;BR&gt;imgItem.Click += value; &lt;BR&gt;} &lt;BR&gt;remove &lt;BR&gt;{ &lt;BR&gt;imgItem.Click -= value; &lt;BR&gt;}} &lt;u1:p&gt;&lt;/u1:p&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN lang=EN-GB style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial; mso-ansi-language: EN-GB"&gt;&lt;u1:p&gt;&amp;nbsp;&lt;/u1:p&gt;public bool AutoPostBack &lt;BR&gt;{ &lt;BR&gt;set &lt;BR&gt;{ &lt;BR&gt;imgItem.AutoPostBack = value; &lt;BR&gt;} &lt;BR&gt;get &lt;BR&gt;{ &lt;BR&gt;return imgItem.AutoPostBack; &lt;BR&gt;}} &lt;u1:p&gt;&lt;/u1:p&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN lang=EN-GB style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial; mso-ansi-language: EN-GB"&gt;public ImageButtonColumn() &lt;BR&gt;{ &lt;BR&gt;imgItem = new ImageButtonItem(false); &lt;BR&gt;imgItem.AutoPostBack = false; &lt;BR&gt;this.ItemTemplate = imgItem as ITemplate; &lt;BR&gt;}} &lt;u1:p&gt;&lt;/u1:p&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN lang=EN-GB style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial; mso-ansi-language: EN-GB"&gt;&lt;u1:p&gt;&amp;nbsp;&lt;/u1:p&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;B&gt;&lt;SPAN lang=EN-GB style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial; mso-ansi-language: EN-GB"&gt;internal class ImageButtonItem : ITemplate&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN lang=EN-GB style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial; mso-ansi-language: EN-GB; mso-bidi-font-weight: bold"&gt; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN-GB style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial; mso-ansi-language: EN-GB"&gt;{ &lt;u1:p&gt;&lt;/u1:p&gt;&lt;BR&gt;private bool readOnly = true; &lt;BR&gt;public event ImageClickEventHandler Click; &lt;u1:p&gt;&lt;/u1:p&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN lang=EN-GB style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial; mso-ansi-language: EN-GB"&gt;public ImageButtonItem(bool editable)&amp;nbsp;&lt;BR&gt;{&amp;nbsp;&lt;BR&gt;readOnly = (editable==true)?false:true; &lt;BR&gt;} &lt;u1:p&gt;&lt;/u1:p&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN lang=EN-GB style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial; mso-ansi-language: EN-GB"&gt;&lt;u1:p&gt;void ITemplate.InstantiateIn(Control container) &lt;BR&gt;{ &lt;BR&gt;ImageButton ib = new ImageButton(); &lt;BR&gt;ib.ImageUrl = "info.gif";&amp;nbsp; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN-GB style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: Arial; mso-ansi-language: EN-GB"&gt;//Immagine da Associare al Controllo &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN-GB style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial; mso-ansi-language: EN-GB"&gt;ib.Click += new ImageClickEventHandler(this.OnClick); &lt;BR&gt;container.Controls.Add(ib); &lt;BR&gt;} &lt;u1:p&gt;&lt;/u1:p&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN lang=EN-GB style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial; mso-ansi-language: EN-GB"&gt;private void OnClick(object sender, ImageClickEventArgs e) &lt;BR&gt;{ &lt;BR&gt;Click(sender, e); &lt;BR&gt;} &lt;BR&gt;private bool autoPostBack=false; &lt;BR&gt;&lt;BR&gt;public bool AutoPostBack &lt;BR&gt;{ &lt;BR&gt;set &lt;BR&gt;{ &lt;BR&gt;autoPostBack = value; &lt;BR&gt;} &lt;BR&gt;get &lt;BR&gt;{ &lt;BR&gt;return autoPostBack; &lt;BR&gt;}}} &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN lang=EN-GB style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial; mso-ansi-language: EN-GB"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Arial"&gt;&lt;STRONG&gt;&lt;FONT size=2&gt;e ora vediamo la definizione della classe LinkButton:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial"&gt;internal class LinkButtonItem: ITemplate&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial"&gt; &lt;BR&gt;{ &lt;BR&gt;private bool readOnly = true; &lt;BR&gt;public event EventHandler Click; &lt;BR&gt;&lt;BR&gt;public LinkButtonItem(bool editable) { &lt;BR&gt;readOnly = (editable==true)?false:true; &lt;BR&gt;} &lt;BR&gt;&lt;BR&gt;void ITemplate.InstantiateIn(Control container) { &lt;BR&gt;LinkButton lb = new LinkButton(); &lt;BR&gt;lb.DataBinding += new EventHandler(this.BindLabelColumn); &lt;BR&gt;lb.Click += new EventHandler(this.OnClick); &lt;BR&gt;container.Controls.Add(lb); &lt;BR&gt;} &lt;BR&gt;&lt;BR&gt;public void BindLabelColumn(object sender, EventArgs e) { &lt;BR&gt;LinkButton lb = (LinkButton)sender; &lt;BR&gt;DataGridItem container =(DataGridItem)lb.NamingContainer;&lt;BR&gt;lb.Text = Convert.ToString(System.Web.UI.DataBinder.Eval(container, "DataItem.ID")); &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: Arial"&gt;//CAMPO ASSOCIATO AL DATAGRID - ESTRAZIONE DEL CAMPO ID &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial"&gt;&lt;BR&gt;} &lt;BR&gt;&lt;BR&gt;private void OnClick(object sender, EventArgs e) { &lt;BR&gt;Click(sender, e); &lt;BR&gt;} &lt;BR&gt;&lt;BR&gt;private bool autoPostBack=true; &lt;BR&gt;public bool AutoPostBack { &lt;BR&gt;set &lt;BR&gt;{ &lt;BR&gt;autoPostBack = value; &lt;BR&gt;} &lt;BR&gt;get&lt;BR&gt;{ &lt;BR&gt;return autoPostBack; &lt;BR&gt;} } } &lt;BR&gt;&lt;BR&gt;&lt;B&gt;public class LinkButtonColumn : TemplateColumn&lt;/B&gt; &lt;BR&gt;{ &lt;BR&gt;private LinkButtonItem imgItem; &lt;BR&gt;public string idRecord; &lt;BR&gt;&lt;BR&gt;public event EventHandler Click { &lt;BR&gt;add { &lt;BR&gt;imgItem.Click += value; &lt;BR&gt;} &lt;BR&gt;remove { &lt;BR&gt;imgItem.Click -= value; &lt;BR&gt;} } &lt;BR&gt;&lt;BR&gt;public bool AutoPostBack { &lt;BR&gt;set &lt;BR&gt;{ &lt;BR&gt;imgItem.AutoPostBack = value; &lt;BR&gt;} &lt;BR&gt;get &lt;BR&gt;{ &lt;BR&gt;return imgItem.AutoPostBack; &lt;BR&gt;} } &lt;BR&gt;&lt;BR&gt;public LinkButtonColumn() &lt;BR&gt;{ &lt;BR&gt;imgItem = new LinkButtonItem(false); &lt;BR&gt;imgItem.AutoPostBack = false; &lt;BR&gt;this.ItemTemplate = imgItem as ITemplate; &lt;BR&gt;}&lt;BR&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Arial"&gt;&lt;STRONG&gt;ora prima di eseguire il Bind del Datagrid sar&amp;#224; necessario l'ImageButton o il LinkButton&lt;o:p&gt;&lt;/o:p&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: Arial"&gt;//Supponiamo che il nostro DataTable si componga di pi&amp;#249; colonne. La colonna "ID" per&amp;#242; la visualizzo&lt;BR&gt;//come campo LinkButton e la colonna "Colore" la visualizzo come ImageButton&lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial"&gt;foreach (DataColumn dc in dt.Columns) { &lt;BR&gt;&lt;BR&gt;if (dc.ColumnName.ToLower() == "id") {&lt;BR&gt;&lt;BR&gt;LinkButtonColumn linkcol = new LinkButtonColumn();&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: Arial"&gt;// LINKBUTTON NELLA COLONNA ID&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial"&gt;&lt;BR&gt;linkcol .HeaderText= dc.ColumnName; &lt;BR&gt;linkcol .Click +=new EventHandler(linkcol_Click);&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: Arial"&gt;//ASSOCIO L'EVENTO CLICK&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial"&gt;&lt;BR&gt;MyDataGrid.Columns.Add(linkcol); &lt;BR&gt;} &lt;BR&gt;&lt;BR&gt;else if (dc.ColumnName.ToLower() == "colore") { &lt;BR&gt;&lt;BR&gt;ImageButtonColumn imgcol = new ImageButtonColumn();&amp;nbsp; //&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: Arial"&gt;IMAGEBUTTON NELLA COLONNA COLORE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial"&gt;&lt;BR&gt;imgcol.HeaderText= dc.ColumnName; &lt;BR&gt;imgcol.Click +=new EventHandler(imgcol_Click);&amp;nbsp;&amp;nbsp; //ASSOCIO L'EVENTO CLICK&lt;BR&gt;MyDataGrid.Columns.Add(imgcol); &lt;BR&gt;&lt;BR&gt;} &lt;BR&gt;else { &lt;BR&gt;BoundColumn b=new BoundColumn(); &lt;BR&gt;b.DataField=dc.ColumnName; &lt;BR&gt;b.DataFormatString="{0}"; &lt;BR&gt;b.HeaderText=dc.ColumnName; &lt;BR&gt;MyDataGrid.Columns.Add(b); &lt;BR&gt;} } &lt;BR&gt;&lt;BR&gt;MyDataGrid.DataSource = dt; &lt;BR&gt;MyDataGrid.DataBind();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: green; FONT-FAMILY: Arial"&gt;//I DUE EVENTI SARANNO DEFINITI COME SEGUE:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial"&gt;private void imgcol_Click(object sender, ImageClickEventArgs e) {&amp;nbsp;&lt;BR&gt;//CODICE&lt;BR&gt;} &lt;BR&gt;&lt;BR&gt;private void linkcol_Click(object sender, EventArgs e) { &lt;BR&gt;&lt;BR&gt;LinkButton lbtn = (LinkButton)sender; &lt;BR&gt;DataGridItem dgi = (DataGridItem)lbtn.NamingContainer;&amp;nbsp; //estraggo la colonna del datagrid&lt;BR&gt;//....&lt;BR&gt;&lt;BR&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-margin-bottom-alt: auto"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: navy; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"&gt;&lt;STRONG&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Arial"&gt;Ciao a tutti e spero possa essere&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Arial"&gt;d'aiuto il post.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: Arial"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/u1:p&gt;&lt;img src="http://blogs.ugidotnet.org/ProgettoDiInstallazione/aggbug/76459.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sara Fabris</dc:creator>
            <guid>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2007/04/24/76459.aspx</guid>
            <pubDate>Tue, 24 Apr 2007 18:17:00 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2007/04/24/76459.aspx#feedback</comments>
            <slash:comments>28</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/ProgettoDiInstallazione/comments/commentRss/76459.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/ProgettoDiInstallazione/services/trackbacks/76459.aspx</trackback:ping>
        </item>
        <item>
            <title>Classe per leggere e scrivere da Registro</title>
            <link>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2007/02/27/71819.aspx</link>
            <description>&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT face=Arial color=#000080 size=2&gt;using&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;EM&gt;&lt;FONT face=Arial color=#000080 size=2&gt; namespace&lt;/FONT&gt;&lt;/EM&gt;&lt;EM&gt;&lt;FONT face=Arial color=#000080 size=2&gt; Microsoft::Win32;&lt;BR&gt;using namespace System;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000000 size=2&gt;&lt;STRONG&gt;La classe seguente permette di leggere e scrivere nel Registro di Sistema&lt;BR&gt;(classe in C++.net - Framework 1.1)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;public&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; __gc class&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;&lt;FONT color=#000080&gt;&lt;EM&gt; Registro&lt;BR&gt;{&lt;BR&gt;private&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&lt;EM&gt;:&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;String *CU; &lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;//= S"CU"; //current user&lt;BR&gt;String *LM; &lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;// = S"LM"; //Local_Machine&lt;BR&gt;String *CR; &lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;// = S"CR"; //classes_root&lt;BR&gt;String *UR; &lt;/EM&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&lt;EM&gt;&lt;FONT face=Arial size=2&gt;// = S"UR"; // Users&lt;BR&gt;String *CC; // = S"CC"; // current_config&lt;/FONT&gt;&lt;/P&gt;&lt;/EM&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;public&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;:&lt;BR&gt;Registro(){&lt;BR&gt;CU = S"CU"; &lt;BR&gt;LM = S"LM";&lt;BR&gt;CR = S"CR";&lt;BR&gt;UR = S"UR";&lt;BR&gt;CC = S"CC";&lt;BR&gt;};&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;&lt;FONT color=#000080&gt;&lt;EM&gt;String* GetValue(String* key, String* subKey, String* entry);&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&lt;EM&gt;int&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; CreateKey(String* key, String* subKey);&lt;BR&gt;int&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; setValue(String* key, String* subKey, String* item, Object* _value);&lt;BR&gt;int&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; deleteValue(String* key, String *subKey, String *entry);&lt;BR&gt;};&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#000080&gt;
&lt;P&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000000 size=2&gt;&lt;STRONG&gt;Il seguente metodo permette di ottenere un valore da una chiave di Registro.&lt;BR&gt;Il primo parametro deve essere CU,LM,CR,UR oppure CC.&lt;BR&gt;Il secondo parametro &amp;#232; il nodo di Registro ad es. "Software\Microsoft\Microsoft Sql Server"&lt;BR&gt;Il terzo parametro &amp;#232; la stringa di Registro dal quale ottenere il valore&lt;BR&gt;In caso di errore ritorna il valore&amp;nbsp;null altrimenti ritorna il valore della chiave di Registro.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&lt;BR&gt;&lt;EM&gt;&lt;FONT face=Arial size=2&gt;String* Registro::GetValue(String* key, String* subKey, String* entry){&lt;BR&gt;RegistryKey *reg;&lt;BR&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;try&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;{&lt;BR&gt;if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == S"CU")&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;&amp;nbsp; reg = Registry::CurrentUser-&amp;gt;OpenSubKey(subKey);&lt;BR&gt;else if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == S"LM")&lt;BR&gt;&amp;nbsp; reg = Registry::LocalMachine-&amp;gt;OpenSubKey(subKey);&lt;BR&gt;else if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == S"UR")&lt;BR&gt;&amp;nbsp; reg = Registry::Users-&amp;gt;OpenSubKey(subKey);&lt;BR&gt;else if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == "CC")&lt;BR&gt;&amp;nbsp; reg = Registry::CurrentConfig-&amp;gt;OpenSubKey(subKey);&lt;BR&gt;else if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == "CR")&lt;BR&gt;&amp;nbsp; reg = Registry::Users-&amp;gt;OpenSubKey(subKey);&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;else&lt;BR&gt;&amp;nbsp; &lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;reg = Registry::LocalMachine-&amp;gt;OpenSubKey(subKey);&lt;BR&gt;&lt;BR&gt;return&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; reg-&amp;gt;GetValue(entry, 0)-&amp;gt;ToString();&lt;BR&gt;}&lt;BR&gt;catch&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;(Exception* ){&lt;BR&gt;return&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; 0;&lt;BR&gt;}};&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial size=2&gt;Il seguente metodo permette di cancellare una chiave di Registro.&lt;BR&gt;Il primo parametro deve essere CU,LM,CR,UR oppure CC.&lt;BR&gt;Il secondo parametro &amp;#232; il nodo di Registro ad es. "Software\Microsoft\Microsoft Sql Server"&lt;BR&gt;Il terzo parametro &amp;#232; la stringa di Registro da cancellare&lt;BR&gt;In caso di errore ritorna il valore 1, altrimenti valore 0.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;BR&gt;&lt;/STRONG&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;int&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; Registro::deleteValue(String *key, String *subKey, String *entry){&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;RegistryKey *reg;&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;&lt;FONT color=#000080&gt;&lt;EM&gt;try&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == S"CU")&lt;BR&gt;&amp;nbsp; reg = Registry::CurrentUser-&amp;gt;CreateSubKey(subKey);&lt;BR&gt;else if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == S"LM")&lt;BR&gt;&amp;nbsp; reg = Registry::LocalMachine-&amp;gt;CreateSubKey(subKey);&lt;BR&gt;else if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == S"UR")&lt;BR&gt;&amp;nbsp; &lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;reg = Registry::Users-&amp;gt;CreateSubKey(subKey);&lt;BR&gt;else if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == "CC")&lt;BR&gt;&amp;nbsp; reg = Registry::CurrentConfig-&amp;gt;CreateSubKey(subKey);&lt;BR&gt;else if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == "CR")&lt;BR&gt;&amp;nbsp; reg = Registry::Users-&amp;gt;CreateSubKey(subKey);&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;else&lt;BR&gt;&amp;nbsp; &lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;reg = Registry::Users-&amp;gt;CreateSubKey(subKey);&lt;BR&gt;&lt;BR&gt;reg-&amp;gt;DeleteValue(entry);&lt;BR&gt;return&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; 0;&lt;BR&gt;}&lt;BR&gt;catch&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;(Exception* ){&lt;BR&gt;return&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; 1;&lt;BR&gt;}};&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000080&gt;&lt;BR&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;&lt;FONT color=#000000&gt;Il seguente metodo permette di creare un nodo di Registro.&lt;BR&gt;Il primo parametro deve essere CU,LM,CR,UR oppure CC.&lt;BR&gt;Il secondo parametro &amp;#232; il nodo di&amp;nbsp;Registro da creare&amp;nbsp;ad es. "Software\Microsoft\Microsoft Sql Server\Test"&lt;BR&gt;In caso di errore ritorna il valore 1, altrimenti valore 0.&lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;EM&gt;int&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; Registro::CreateKey(String* key, String* subKey){&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;RegistryKey* reg;&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;&lt;FONT color=#000080&gt;&lt;EM&gt;try&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == S"CU")&lt;BR&gt;&amp;nbsp; reg = Registry::CurrentUser-&amp;gt;CreateSubKey(subKey);&lt;BR&gt;else if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == S"LM")&lt;BR&gt;&amp;nbsp; reg = Registry::LocalMachine-&amp;gt;CreateSubKey(subKey);&lt;BR&gt;else if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == S"UR")&lt;BR&gt;&amp;nbsp; reg = Registry::Users-&amp;gt;CreateSubKey(subKey);&lt;BR&gt;else if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == "CC")&lt;BR&gt;&amp;nbsp; reg = Registry::CurrentConfig-&amp;gt;CreateSubKey(subKey);&lt;BR&gt;else if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == "CR")&lt;BR&gt;&amp;nbsp; reg = Registry::Users-&amp;gt;CreateSubKey(subKey);&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;else&lt;BR&gt;&amp;nbsp; &lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;&lt;FONT color=#000080&gt;&lt;EM&gt;reg = Registry::Users-&amp;gt;CreateSubKey(subKey);&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#000080&gt;&lt;EM&gt;return&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; 0;&lt;BR&gt;}&lt;BR&gt;catch&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;(Exception* )&lt;BR&gt;{&lt;BR&gt;return&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; 1;&lt;BR&gt;}};&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;&lt;FONT color=#000080&gt;&lt;STRONG&gt;&lt;FONT color=#000000&gt;Il seguente metodo permette di creare una chiave di Registro e di assegnargli un valore.&lt;BR&gt;Il primo parametro deve essere CU,LM,CR,UR oppure CC.&lt;BR&gt;Il secondo parametro &amp;#232;&amp;nbsp;il nodo di Registro gi&amp;#224; presente ad es. "Software\Microsoft\Microsoft Sql Server"&lt;BR&gt;Il terzo parametro &amp;#232; la chiave di Registro da creare e l'ultimo parametro &amp;#232; il valore che vogliamo assegnargli.&lt;BR&gt;In caso di errore ritorna il valore 1, altrimenti valore 0.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR&gt;&lt;EM&gt;int&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&lt;EM&gt; Registro::setValue(String* key, String* subKey, String* item, Object* _value){&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;RegistryKey* reg;&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;&lt;FONT color=#000080&gt;&lt;EM&gt;try&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == S"CU")&lt;BR&gt;&amp;nbsp; reg = Registry::CurrentUser-&amp;gt;OpenSubKey(subKey, true&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;);&lt;BR&gt;else if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == S"LM")&lt;BR&gt;&amp;nbsp; reg = Registry::LocalMachine-&amp;gt;OpenSubKey(subKey, true&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;);&lt;BR&gt;else if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == S"UR")&lt;BR&gt;&amp;nbsp; reg = Registry::Users-&amp;gt;OpenSubKey(subKey, true&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;);&lt;BR&gt;else if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == "CC")&lt;BR&gt;&amp;nbsp; reg = Registry::CurrentConfig-&amp;gt;OpenSubKey(subKey, true&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;);&lt;BR&gt;else if&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt; (key == "CR")&lt;BR&gt;&amp;nbsp; reg = Registry::Users-&amp;gt;OpenSubKey(subKey, true&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;);&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;else&lt;BR&gt;&amp;nbsp; reg = Registry::Users-&amp;gt;OpenSubKey(subKey, true&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;);&lt;BR&gt;&lt;BR&gt;reg-&amp;gt;SetValue(item, _value);&lt;BR&gt;reg-&amp;gt;Close();&lt;BR&gt;return&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;&lt;FONT color=#000080&gt;&lt;EM&gt; 0;&lt;BR&gt;}&lt;/EM&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;catch&lt;/FONT&gt;(Exception* )&lt;BR&gt;{&lt;BR&gt;&lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; 1;&lt;BR&gt;}};&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.ugidotnet.org/ProgettoDiInstallazione/aggbug/71819.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sara Fabris</dc:creator>
            <guid>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2007/02/27/71819.aspx</guid>
            <pubDate>Tue, 27 Feb 2007 15:36:00 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2007/02/27/71819.aspx#feedback</comments>
            <slash:comments>553</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/ProgettoDiInstallazione/comments/commentRss/71819.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/ProgettoDiInstallazione/services/trackbacks/71819.aspx</trackback:ping>
        </item>
        <item>
            <title>Apertura PDF su una determinata pagina</title>
            <link>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2005/08/04/24719.aspx</link>
            <description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;In questo post vediamo come poter aprire un PDF da un'applicazione e come poter aprire il file specificando la pagina desiderata.&lt;BR&gt;Se si apre una command line e si prova ad aprire un file direttamente da qui alla pagina desiderata baster&amp;#224; scrivere:&lt;BR&gt;&lt;STRONG&gt;C:\Programmi\Adobe\..\acrobat.exe /A page=2 C:\abc.pdf&lt;/STRONG&gt;&lt;BR&gt;Ovvero con l'opzione "/A" si specificano i parametri con cui aprire il pdf e di seguito si indica il path dello stesso file da aprire.&lt;BR&gt;Per maggiori informazioni sui parametri da specificare basta guardare &lt;A href="http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf"&gt;qui&lt;/A&gt;. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;In questo caso per&amp;#242; nella mia macchina &amp;#232; installato Adobe Acrobat, se invece &amp;#232; installato solamente l'Acrobat Reader allora da command line si dovr&amp;#224; scrivere:&lt;BR&gt;&lt;STRONG&gt;C:\Programmi\Adobe\..\acrord32.exe /A page = 2 C:\abc.pdf&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;A questo punto dobbiamo fare lo stesso da codice!&lt;BR&gt;Dobbiamo recuperare il path di Installazione di Adobe, prestando attenzione alla versione e a quale Adobe &amp;#232; stato installato.&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT face=Arial color=#000000 size=2&gt;(Codice VB.NET)&lt;/FONT&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&lt;FONT face=Arial size=2&gt;Dim&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt; buf As &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT color=#000080 size=2&gt;String = "C:\abc.pdf" &lt;FONT color=#000000&gt;&lt;EM&gt;'Path del file PDF da aprire&lt;/EM&gt;&lt;/FONT&gt;&lt;BR&gt;Dim pathKey As &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&lt;FONT face=Arial size=2&gt;String&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;Dim key As RegistryKey&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000080&gt;&lt;FONT face=Arial color=#000000 size=2&gt;&lt;EM&gt;'Setto il percorso di Adobe nel Registro di Sistema&lt;BR&gt;'Controllo prima la presenza di Acrobat Reader e in seguito quella di Adobe Acrobat standard.&lt;/EM&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&lt;FONT face=Arial size=2&gt;pathKey = "Software\Adobe\Acrobat Reader\"&lt;BR&gt;key = Registry.LocalMachine.OpenSubKey(pathKey)&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT face=Arial size=2&gt;If&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt; (key Is Nothing) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;Then&lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;&lt;FONT color=#000080&gt;pathKey = "Software\Adobe\Adobe Acrobat\"&lt;BR&gt;&amp;nbsp; key = Registry.LocalMachine.OpenSubKey(pathKey)&lt;BR&gt;End If&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;FONT color=#000080 size=2&gt;If (key Is Nothing) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;Then&lt;BR&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT face=Arial color=#000000 size=2&gt;&lt;EM&gt;'Non sono state trovate n&amp;#232; le chiavi di Acrobat Reader n&amp;#232; quelle di Adobe Acrobat&lt;BR&gt;&amp;nbsp;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT color=#000080 size=2&gt;&lt;EM&gt;&lt;FONT color=#000000&gt;'Viene aperto il pdf sulla prima pagina!&lt;/FONT&gt;&lt;BR&gt;&lt;/EM&gt;&amp;nbsp;ApriFile(buf, Nothing&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;)&lt;BR&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;Return&lt;BR&gt;End &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000000 size=2&gt;&lt;EM&gt;'Per trovare dove &amp;#232; installato l'Adobe dobbiamo&amp;nbsp;trovare la chiave di registro corretta che solitamente si trova in:&lt;BR&gt;' Software\Adobe\Adobe Acrobat\7.0\InstallPath oppure&lt;BR&gt;' Software\Adobe\Acrobat Reader\5.0\InstallPath&lt;BR&gt;'Quello che &amp;#232; importante trovare &amp;#232; la versione di Adobe&amp;nbsp;installata. Se ci sono pi&amp;#249; versioni installate, &lt;BR&gt;'viene presa l'ultima versione presente&lt;/EM&gt;.&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/P&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&lt;FONT face=Arial size=2&gt;Dim&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt; values As String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000080&gt;&lt;FONT face=Arial&gt;() = key.GetSubKeyNames()&lt;BR&gt;Dim maxVersion As String&lt;/FONT&gt;&lt;FONT face=Arial&gt; = "0"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;FONT color=#000080 size=2&gt;For Each s As String In&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt; values&lt;BR&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT color=#000080 size=2&gt;Try&lt;BR&gt;&amp;nbsp;&amp;nbsp; If (Double.Parse(s) &amp;gt; Double.Parse(maxVersion)) &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;maxVersion = s&lt;BR&gt;&amp;nbsp;&amp;nbsp; End &lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT color=#000080 size=2&gt;If&lt;BR&gt;&amp;nbsp;Catch ex As&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt; Exception&lt;BR&gt;&amp;nbsp;End &lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;Try&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT color=#000080 size=2&gt;Next&lt;BR&gt;&lt;BR&gt;If (maxVersion = "0") &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;&lt;FONT color=#000080&gt;Then&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000000&gt;&amp;nbsp; &lt;EM&gt;'Se non &amp;#232; stata trovata una versione di Adobe installata, il pdf viene aperto sulla prima pagina&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;FONT color=#000080&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT color=#000080 size=2&gt;ApriFile(buf, Nothing&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;)&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;Else&lt;BR&gt;&amp;nbsp;&amp;nbsp; &lt;FONT color=#000000&gt;&lt;EM&gt;'Il percorso nel registro &amp;#232; stato costruito.&amp;nbsp;Estraiamo il percorso di installazione di Adobe che solitamente &amp;#232;:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;' C:\Programmi\Adobe\Acrobat 7.0\Acrobat&amp;nbsp;oppure C:\Programmi\Adobe\Acrobat 7.0\Reader&lt;BR&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Arial color=#000000 size=2&gt;&lt;FONT color=#000080&gt;pathKey = pathKey &amp;amp; maxVersion &amp;amp; "\InstallPath\"&lt;BR&gt;&amp;nbsp;&amp;nbsp; key = Registry.LocalMachine.OpenSubKey(pathKey)&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &lt;EM&gt;'La variabile pathAdobe dovr&amp;#224; contenere il percorso di installazione di Adobe.E' necessario controllare su &amp;#232; presente Acrobat Reader &lt;BR&gt;&amp;nbsp;&amp;nbsp; '(l'eseguibile &amp;#232; acrord32.exe) oppure Adobe Acrobat (l'eseguibile &amp;#232; acrobat.exe)&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000000 size=2&gt;&amp;nbsp;&amp;nbsp; &lt;FONT color=#000080&gt;Dim pathAdobe As &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT color=#000080 size=2&gt;String&lt;BR&gt;&amp;nbsp;&amp;nbsp; pathAdobe = key.GetValue("") &amp;amp; "\acrord32.exe"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&amp;nbsp;&amp;nbsp; If (New FileInfo(pathAdobe).Exists = False) &lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;Then&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;pathAdobe = key.GetValue("") &amp;amp; "\acrobat.exe"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If (New FileInfo(pathAdobe).Exists = False) &lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT color=#000080 size=2&gt;Then &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ApriFile(buf, Nothing&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT color=#000080 size=2&gt;Return&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;End &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT color=#000080 size=2&gt;If&lt;BR&gt;&amp;nbsp;&amp;nbsp; End &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;If&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&amp;nbsp; ApriFile(pathAdobe, "/A page=" &amp;amp; pagina &amp;amp; " " &amp;amp; buf)&lt;BR&gt;End &lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;If&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#0000ff&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000000 size=2&gt;&lt;STRONG&gt;Infine il metodo per lanciare l'apertura del pdf:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#0000ff&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;Private&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial color=#000080&gt; Sub ApriFile(ByVal pathFile As String, ByVal argomenti As String&lt;/FONT&gt;&lt;FONT face=Arial color=#000080&gt;)&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial color=#000080&gt;Dim info As System.Diagnostics.ProcessStartInfo = New&lt;/FONT&gt;&lt;FONT face=Arial color=#000080&gt; System.Diagnostics.ProcessStartInfo(pathFile)&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial color=#000080&gt;info.UseShellExecute = &lt;/FONT&gt;&lt;FONT face=Arial color=#000080&gt;True&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;info.Verb = "Open"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;FONT color=#000080 size=2&gt;If (argomenti &amp;lt;&amp;gt; Nothing And argomenti &amp;lt;&amp;gt; "") Then&lt;BR&gt;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&lt;FONT face=Arial size=2&gt;info.Arguments = argomenti&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;End If&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT color=#000080&gt;&lt;FONT face=Arial size=2&gt;System.Diagnostics.Process.Start(info)&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;End &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;Sub&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000080 size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;&lt;STRONG&gt;&lt;U&gt;P.S:&lt;/U&gt;&lt;/STRONG&gt; &lt;U&gt;Questo post l'ho potuto scrivere anche grazie all'aiuto di Raffaele Rialdi che mi ha aiutato nella risoluzione del problema nel forum di microsoft &lt;/U&gt;(&lt;A href="http://support.microsoft.com/newsgroups/default.aspx"&gt;qui&lt;/A&gt;). &lt;U&gt;Quindi un doveroso grazie va anche a lui!!!&lt;/U&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.ugidotnet.org/ProgettoDiInstallazione/aggbug/24719.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sara Fabris</dc:creator>
            <guid>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2005/08/04/24719.aspx</guid>
            <pubDate>Thu, 04 Aug 2005 15:18:00 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2005/08/04/24719.aspx#feedback</comments>
            <slash:comments>2326</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/ProgettoDiInstallazione/comments/commentRss/24719.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/ProgettoDiInstallazione/services/trackbacks/24719.aspx</trackback:ping>
        </item>
        <item>
            <title>Richieste Http e Proxy</title>
            <link>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2005/06/27/21779.aspx</link>
            <description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;In questo post vediamo come poter scrivere del codice C# per effettuare richieste Http da un'applicazione.&lt;BR&gt;I problemi che si possono incontrare in queste richieste Http possono essere soprattutto relativi al Proxy, in quanto non &lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;permette all'applicazione di effettuare richieste internet.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Per prima cosa vediamo quali sono le classi che verranno utilizzate:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;using System.Net.Sockets;&lt;BR&gt;using System.Net;&lt;BR&gt;using System.IO;&lt;BR&gt;using System.Text;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Nel mio progetto ho inserito un oggetto Button e quando questo viene premuto viene richiamato l'evento click che effettua la &lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;richiesta Http. Questo &amp;#232; il codice:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;FONT color=#000080&gt;private void button2_Click(object sender, System.EventArgs e)&lt;BR&gt;{&lt;BR&gt;string valVerifica= "";&lt;BR&gt;try&lt;BR&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT color=#000080&gt;//Indirizzo dell'url Http o Https&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt; &lt;BR&gt;&lt;FONT color=#000080&gt;string urlRegistro = @http://www......;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;FONT color=#000080&gt;HttpWebRequest wrInfoCam =(HttpWebRequest) HttpWebRequest.Create(urlRegistro);&lt;BR&gt;wrInfoCam.KeepAlive = false;&lt;/FONT&gt; &lt;BR&gt;&lt;FONT color=#000080&gt;&lt;EM&gt;&lt;STRONG&gt;//La propriet&amp;#224; KeepAlive a false permette di NON impostare connessione persistenti ai server che&lt;BR&gt;//le supportano.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;&lt;STRONG&gt;//IMPOSTAZIONI PROXY.&lt;BR&gt;//questa parte di codice pu&amp;#242; essere omessa nel caso non si utilizzi un proxy&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;&lt;STRONG&gt;//Definizione credenziali&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR&gt;NetworkCredential cred = new NetworkCredential("sara", "xxx");&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;CredentialCache myCache = new CredentialCache(); &lt;BR&gt;myCache.Add(new Uri("&lt;/FONT&gt;&lt;A href="http://master.lan.xxxx.it:8080/"&gt;&lt;FONT face=Arial color=#000080 size=2&gt;http://master.lan.xxxx.it:8080/&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial color=#000080 size=2&gt;"), "Basic", cred); &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;WebProxy _proxy = new WebProxy();&lt;BR&gt;_proxy = (WebProxy)(wrInfoCam.Proxy);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;Uri _uri = new Uri("&lt;/FONT&gt;&lt;A href="http://master.lan.xxxx.it:8080/"&gt;&lt;FONT face=Arial color=#000080 size=2&gt;http://master.lan.xxxx.it:8080/&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial color=#000080 size=2&gt;");&lt;BR&gt;_proxy.Address = _uri;&lt;BR&gt;_proxy.Credentials = myCache;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;wrInfoCam.Proxy = _proxy;&lt;BR&gt;&lt;EM&gt;&lt;STRONG&gt;//FINE IMPOSTAZIONE PROXY&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;RequestStateHttp reqState = new RequestStateHttp();&lt;BR&gt;reqState.request = wrInfoCam;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;reqState.request.Method="POST";&lt;BR&gt;wrInfoCam.ContentType= "application/x-www-form-urlencoded";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;IAsyncResult result =(IAsyncResult) (wrInfoCam.BeginGetRequestStream(new AsyncCallback(ReadCallbackHttp), reqState));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&lt;EM&gt;&lt;STRONG&gt;//Attendo la risposta del sito http o https mediante l'oggetto HttpWebResponse.&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR&gt;HttpWebResponse myHttpWebResponse=(HttpWebResponse) (wrInfoCam.GetResponse());&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;Stream streamResponse=myHttpWebResponse.GetResponseStream();&lt;BR&gt;StreamReader streamRead = new StreamReader(streamResponse);&lt;BR&gt;char [] readBuff = new Char[256];&lt;BR&gt;int count = streamRead.Read(readBuff, 0, 256);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;while (count &amp;gt; 0) &lt;BR&gt;{&lt;BR&gt;valVerifica = new String(readBuff, 0, count);&lt;BR&gt;count = streamRead.Read(readBuff, 0, 256);&lt;BR&gt;}&lt;BR&gt;streamResponse.Close();&lt;BR&gt;streamRead.Close();&lt;BR&gt;myHttpWebResponse.Close();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;MessageBox.Show(valVerifica);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;}&lt;BR&gt;catch(Exception ex)&lt;BR&gt;{&lt;BR&gt;MessageBox.Show(ex.ToString());&lt;BR&gt;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;A questo punto manca da definire la nostra classe RequestStateHttp, che consente di passare i dati su chiamate asincrone:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;public class RequestStateHttp &lt;BR&gt;{&lt;BR&gt;&amp;nbsp;static int BUFFER_SIZE = 1024;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&amp;nbsp;public StringBuilder requestData;&lt;BR&gt;&amp;nbsp;public Byte [] bufferRead;&lt;BR&gt;&amp;nbsp;public HttpWebRequest&amp;nbsp; request;&lt;BR&gt;&amp;nbsp;public HttpWebResponse&amp;nbsp; response;&lt;BR&gt;&amp;nbsp;public Stream responseStream;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&amp;nbsp;public RequestStateHttp() &lt;BR&gt;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;bufferRead = new Byte[BUFFER_SIZE];&lt;BR&gt;&amp;nbsp;&amp;nbsp;requestData = new StringBuilder("");&lt;BR&gt;&amp;nbsp;&amp;nbsp;request = null;&lt;BR&gt;&amp;nbsp;&amp;nbsp;responseStream = null;&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;E rimane da definire il metodo ReadCallbackHttp che consente di implementare il metodo di callback asincrono per la lettura &lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;del flusso di risposta. I dati ricevuti dalla risorsa Internet vengono trasferiti nella propriet&amp;#224; ResponseData dell'istanza &lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;di RequestStateHttp, quindi si inizia un'altra lettura asincrona del flusso di risposta finch&amp;#233; non viene pi&amp;#249; restituito alcun &lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;dato. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;void ReadCallbackHttp(IAsyncResult async)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;try&lt;BR&gt;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;RequestStateHttp myRequestState=(RequestStateHttp)(async.AsyncState);&lt;BR&gt;&amp;nbsp;&amp;nbsp;HttpWebRequest myHttpWebRequest2=(HttpWebRequest)(myRequestState.request);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;Stream postStream=myHttpWebRequest2.EndGetRequestStream(async);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&amp;nbsp;&amp;nbsp;ASCIIEncoding encoder = new ASCIIEncoding();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&amp;nbsp;&amp;nbsp;string parametriUrl = "...eventuali parametri da passare all'url...";&lt;BR&gt;&amp;nbsp;&lt;STRONG&gt;&amp;nbsp;//se ci sono pi&amp;#249; parametri richiesti da passare all'url allora &amp;#232; necessario utilizzare l'&amp;amp;, ovvero:&lt;BR&gt;&amp;nbsp;&amp;nbsp;//"USer=xx&amp;amp;Password=yy"&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&amp;nbsp;&amp;nbsp;Byte [] byteArray = encoder.GetBytes(parametriUrl);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;&amp;nbsp;&amp;nbsp;postStream.Write(byteArray,0,parametriUrl.Length);&lt;BR&gt;&amp;nbsp;&amp;nbsp;postStream.Close();&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;catch (Exception ex)&lt;BR&gt;&amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;MessageBox.Show(ex.ToString());&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Tutto il codice qui inserito &amp;#232; testato e funzionante.&lt;BR&gt;Se avete un proxy impostato sulla vostra rete e durante l'esecuzione del codice nel metodo ReadCallBackHttp, nel metodo EndGetRequestStream si genera un'eccezione del tipo "Connessione sottostate chiusa. Errore 407: Autenticazione Proxy mancante" ci possono essere due tipo di errori principalmente:&lt;BR&gt;1. i dati relativi all'indirizzo del proxy o le credenziali sono errate. Per es. l'indirizzo del proxy deve essere scritto come: &lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;http://master.lan.xxxx.it&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;, mentre l'uri dev'essere nel formato: &lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;http://master.lan.xxxx.it:PORTA/&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;2. Il proxy utilizza due tipi di autenticazione, quella Basic e quella NTLM ovvero autenticazione windows. Ho potuto notare che la sola autenticazione Basic settata, la richiesta all'indirizzo http/https funziona correttamente, mentre se &amp;#232; settata anche l'autenticazione NTLM ci possono essere dei problemi con le credenziali, che possono non venire riconosciute.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;&lt;U&gt;P.S:&lt;/U&gt;&lt;/STRONG&gt; &lt;U&gt;Questo post l'ho potuto scrivere anche grazie all'aiuto di Gabriele Gaggi che mi ha aiutato nella risoluzione del problema. Quindi un doveroso grazie va anche a lui!!!&lt;/U&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.ugidotnet.org/ProgettoDiInstallazione/aggbug/21779.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sara Fabris</dc:creator>
            <guid>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2005/06/27/21779.aspx</guid>
            <pubDate>Mon, 27 Jun 2005 11:22:00 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2005/06/27/21779.aspx#feedback</comments>
            <slash:comments>1754</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/ProgettoDiInstallazione/comments/commentRss/21779.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/ProgettoDiInstallazione/services/trackbacks/21779.aspx</trackback:ping>
        </item>
        <item>
            <title>File Resources</title>
            <link>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2005/02/07/10414.aspx</link>
            <description>&lt;P&gt;&lt;FONT face=Arial color=#000000 size=2&gt;Per poter creare un file resources dove inserire Icone o Immagini da poter utilizzare all'interno del vostro applicativo baster&amp;#224; scrivere:&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#000080&gt;&lt;FONT face=Arial size=2&gt;Icon ic = new &lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;Icon(@"C:\myIco.ico"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000080&gt;&lt;FONT face=Arial size=2&gt;;); &lt;BR&gt;IResourceWriter rw = new &lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;ResourceWriter(@"C:\Image.resources"&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;;); &lt;BR&gt;rw.AddResource("Icon", ic); &lt;BR&gt;rw.Close(); &lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000000 size=2&gt;oppure basta scaricarsi il programmino Resources a questo link:&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000000 size=2&gt;http://www.aisto.com/roeder/dotnet/&lt;/FONT&gt;&lt;FONT face=Arial color=#000000 size=2&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000000 size=2&gt;A questo basta aggiungere il file resources al&amp;nbsp;vostro progetto. (Menu File-&amp;gt;Aggiungi Elemento Esistente).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000000 size=2&gt;Per poter invece caricare un'immagine da file resources:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT color=#000080&gt;&lt;FONT face=Arial&gt;ResourceManager rm = &lt;/FONT&gt;&lt;FONT face=Arial&gt;new ResourceManager("nomeNamespace.NomeFileResources", this&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080&gt;.GetType().Assembly);&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;Icon iconaForm = (Icon)rm.GetObject("Icon");&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000000 size=2&gt;La stessa cosa pu&amp;#242; essere fatta per gli oggetti Image.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.ugidotnet.org/ProgettoDiInstallazione/aggbug/10414.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sara Inzaghi</dc:creator>
            <guid>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2005/02/07/10414.aspx</guid>
            <pubDate>Mon, 07 Feb 2005 16:19:00 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2005/02/07/10414.aspx#feedback</comments>
            <slash:comments>839</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/ProgettoDiInstallazione/comments/commentRss/10414.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/ProgettoDiInstallazione/services/trackbacks/10414.aspx</trackback:ping>
        </item>
        <item>
            <title>Progetto di Installazione</title>
            <link>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2005/02/03/10281.aspx</link>
            <description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Il seguente articolo chiarisce 4 punti:&lt;BR&gt;1- come creare un progetto di distribuzione (o installazione);&lt;BR&gt;2- come inserire nuove finestre di dialogo al progetto di distribuzione;&lt;BR&gt;3- come estendere la classe Installer (creazione dll) ed associarla al progetto di distribuzione;&lt;BR&gt;4- come poter effettuare il passaggio dei parametri tra il progetto di distribuzione&lt;BR&gt;e la dll che estende la classe Installer.&lt;BR&gt;(Codice C#)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Partiamo dal primo punto, come creare un progetto di distribuzione:&lt;BR&gt;per prima cosa vi conviene creare per esempio una semplice applicazione Windows con C# che chiameremo Test.&lt;BR&gt;Una volta creata, andare nel menu File, cliccare su Aggiungi Progetto -&gt; Nuovo progetto.&lt;BR&gt;Scegliere la voce "Progetto di Installazione e Distribuzione", assegnare un nome al Progetto e dare Ok.&lt;BR&gt;A questo punto si dovrebbe aprire in automatico il File System del progetto di Installazione, se non fosse cos&amp;#236; selezionare il progetto di distribuzione in Esplora Soluzioni e dal menu Visualizza, scegliere la voce Editor-&gt;File System.&lt;BR&gt;Sar&amp;#224; possibile vedere 3 cartelle: Cartella Applicazione, Desktop utente e Manu Programmi Utente.&lt;BR&gt;Cliccare su cartella applicazione con il tasto sx del mouse e cliccare su Aggiungi-&gt;Output Progetto.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;In automatico verr&amp;#224; scelto il progetto da associare, ovvero Test.&lt;BR&gt;Selezionare la voce "Output primario" e dare ok.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;A questo punto aggiungiamo una finestra di dialogo al progetto.&lt;BR&gt;Dal menu Visualizza, scegliere la voce Editor-&gt; Interfaccia Utente, cos&amp;#236; facendo possiamo vedere l'elenco delle finestre di dialogo che verranno visualizzate durante l'installazione del programma Test.&lt;BR&gt;Per esempio inseriamo una finestra di dialogo con 2 CheckBox. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Per fare questo bisogna cliccare con il tasto sinistro del mouse sulla voce "Avvio" e cliccare su Agguingi &lt;BR&gt;finestra di dialogo.A questo punto viene visualizzato un elenco di finestre di dialogo che si possono aggiungere, alcune contengono radio button, altre semplici label, ecc...&lt;BR&gt;Nel nostro caso aggiungiamo una Casella di Controllo e la inseriamo tra "Introduzione" e "Cartella di Installazione". &lt;BR&gt;N.B. Per spostare le finestre di dialogo basta trascinarle con il mouse.&lt;BR&gt;Se guardiamo le propriet&amp;#224; della finestra di dialogo possiamo notare che ci sono 4 CheckBox ognuna delle quali ha:&lt;BR&gt;- una Label o etichetta della casella di controllo;&lt;BR&gt;- una Property ovvero il nome della casella di controllo. Questo valore &amp;#232; molto importante perch&amp;#232; servir&amp;#224; quando dovremmo passare dei valori alla classe Installer.&lt;BR&gt;- un valore che indica se la check Box risult&amp;#224; gi&amp;#224; spuntata;&lt;BR&gt;- un valore che indica se la check Box &amp;#232; visibile.&lt;BR&gt;Per es. sulla label della prima check Box scriviamo "Crea File" e sulla label della seconda check box scriviamo "Elimina File" mentre le altre due check box le rendiamo "non visibili".&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Passiamo al p.to 3 ovvero alla creazione della dll.&lt;BR&gt;E' necessario avviare un'altro progetto come libreria di classi.&lt;BR&gt;A questo punto la classe la definiamo cos&amp;#236;:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;using System;&lt;BR&gt;using System.ComponentModel;&lt;BR&gt;using System.Collections;&lt;BR&gt;using System.Configuration.Install;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;namespace XXInstaller&lt;BR&gt;{&lt;BR&gt; [RunInstaller(true)]&lt;BR&gt; public class MyInstaller: Installer&lt;BR&gt; {&lt;BR&gt;  public MyInstaller()&lt;BR&gt;  {&lt;BR&gt;  }&lt;BR&gt;  &lt;BR&gt;  public override void Install(IDictionary savedState)&lt;BR&gt;  {&lt;BR&gt;   base.Install(savedState);&lt;BR&gt;  }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;  public override void Commit(IDictionary savedState)&lt;BR&gt;  {&lt;BR&gt;   base.Commit(savedState);&lt;BR&gt;  }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;  public override void Rollback(IDictionary savedState)&lt;BR&gt;  {&lt;BR&gt;   base.Rollback(savedState);&lt;BR&gt;  }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;  public override void Uninstall(IDictionary savedState)&lt;BR&gt;  {&lt;BR&gt;   base.Uninstall(savedState);&lt;BR&gt;  }&lt;BR&gt; }&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;In questo modo ridefiniamo le funzioni Install, Commit, Rollback e Unistall.&lt;BR&gt;Compiliamo il progetto e generiamo la dll.&lt;BR&gt;La nostra dll per ora non fa niente di particolare..richiama solamente le funzioni della classe Installer.&lt;BR&gt;Attenzione che MSDN dice che &amp;#232; necessario, senza darne un motivo ben preciso, che la chiamata alla classe base avvenga prima del codice "custom"!!!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;A questo associamo la dll al nostro progetto di distribuzione.&lt;BR&gt;Visualizzare l'editor del file system e con il tasto destro del mouse cliccare su "Cartella Applicazione" e aggiungere la dll appena creata al progetto di installazione. &lt;BR&gt;A questo punto visualizzare l'editor delle azioni personalizzate, cliccare sempre con il tasto destro del mouse su "Azione personalizzata" e sceglire la voce "Aggiungi azione personalizzata". Viene aperta una finestra dalla quale effettuare la scelta, quindi cliccare su "Cartella Applicazione" e scegliere la dll che &amp;#232; stata aggiunta&lt;BR&gt;precedentemente al progetto di installazione.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;4. Ora passiamo ad analizzare come effettuare il passaggio dei parametri dal progetto di installazione&lt;BR&gt;alla dll che estende la classe Installer.&lt;BR&gt;Per prima cosa nel progetto di installazione dobbiamo:&lt;BR&gt;1. visualizzare l'editor delle azioni personalizzate dove precedentemente avevamo associato la nostra dll ai metodi Install, Commit, Rollback e Unistall.&lt;BR&gt;2.Visualizzaziamo le propriet&amp;#224; della dll relativa al metodo Install.&lt;BR&gt;Possiamo notare la propriet&amp;#224; CustomActionData che serve proprio per passare i parametri al metodo Install relativo.&lt;BR&gt;Allora su CustomActionData scriveremo:&lt;BR&gt;/nome1=[CHECKBOXA1] /nome2=[CHECKBOXA2]&lt;BR&gt;dove CHECKBOXA1 e CHECKBOXA2 sono i nomi delle caselle di controllo.&lt;BR&gt;Mentre nome1 e nome2 siamo noi ad assegnarli, sono praticamente i nomi delle variabili che passaremo alla dll.&lt;BR&gt;La propriet&amp;#224; CustomActionData assume il formato /nome=valore. &lt;BR&gt;Pi&amp;#249; valori devono essere separati da uno spazio singolo: /nome1=valore1 /nome2=valore2. &lt;BR&gt;Se un valore ha uno spazio al suo interno, deve essere racchiuso fra virgolette: &lt;BR&gt;/nome="un valore". &lt;BR&gt;Le propriet&amp;#224; di Windows Installer possono essere passate utilizzando le parentesi quadre: /nome=[NOMEPROPRIET&amp;#192;]. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;A questo punto passiamo ad aggiungere un po' di codice sul progetto di estensione della classe Installer. In questo caso inserisco solamente il codice delle modifiche al metodo Install:&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial color=#000080 size=2&gt;public override void Install(IDictionary savedState)&lt;BR&gt;  {&lt;BR&gt;   base.Install(savedState);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;   //System.Diagnostics.Debugger.Break();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;   string nome1 = this.Context.Parameters["nome1"];&lt;BR&gt;   string nome2 = this.Context.Parameters["nome2"];&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;   /*&lt;BR&gt;   Le variabili nome1 e nome2 possono assumere valore 1 se sono&lt;BR&gt;   state spuntate, altrimenti possono assumere valore 0 oppure&lt;BR&gt;   valore nullo. Per non dover controllare sempre se nome1 e nome2&lt;BR&gt;   sono uguali a 0 o a null...eseguo l'assegnazione seguente.&lt;BR&gt;   */&lt;BR&gt;   if (nome1 != "1")&lt;BR&gt;    nome1 = "0";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;   if (nome2 != "1")&lt;BR&gt;    nome2 = "0";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;   /*&lt;BR&gt;    * Se per caso non &amp;#232; spuntata n&amp;#232; nome1 n&amp;#232; nome2 allora blocco l'installazione&lt;BR&gt;    **/&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;   if (nome1 == "0" &amp;&amp; nome2 == "0")&lt;BR&gt;   {&lt;BR&gt;    throw new Exception("Deve essere spuntata almeno una delle due opzioni!");&lt;BR&gt;   }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;   if (nome1 == "1")&lt;BR&gt;   {&lt;BR&gt;    //Creazione di un file&lt;BR&gt;    try&lt;BR&gt;    {&lt;BR&gt;     FileInfo fi = new FileInfo(@"C:\testInstaller.txt");&lt;BR&gt;     if (fi.Exists == false)&lt;BR&gt;      fi.Create();&lt;BR&gt;    }&lt;BR&gt;    catch(Exception){}&lt;BR&gt;   }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;FONT color=#000080 size=2&gt;   if (nome2=="1")&lt;BR&gt;   {&lt;BR&gt;    //Eliminazione del file&lt;BR&gt;    try&lt;BR&gt;    {&lt;BR&gt;     FileInfo fi = new FileInfo(@"C:\testInstaller.txt");&lt;BR&gt;     if (fi.Exists == true)&lt;BR&gt;      fi.Delete();&lt;BR&gt;    }&lt;BR&gt;    catch(Exception){}&lt;BR&gt;   }&lt;BR&gt;  }&lt;BR&gt;  &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;A questo punto ricreare la dll. &lt;BR&gt;Creare il progetto di installazione, fare attenzione a prendere la dll con l'estensione della classe Installer appena creata!&lt;BR&gt;  &lt;BR&gt;A questo punto il nostro progetto di installazione &amp;#232; completato!&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.ugidotnet.org/ProgettoDiInstallazione/aggbug/10281.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sara Inzaghi</dc:creator>
            <guid>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2005/02/03/10281.aspx</guid>
            <pubDate>Thu, 03 Feb 2005 13:49:00 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/ProgettoDiInstallazione/archive/2005/02/03/10281.aspx#feedback</comments>
            <slash:comments>252</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/ProgettoDiInstallazione/comments/commentRss/10281.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/ProgettoDiInstallazione/services/trackbacks/10281.aspx</trackback:ping>
        </item>
    </channel>
</rss>