07/09/09 9:49
Thejuster
Si invece.
Mentre testavo le API del MessageBox avevo trovato la giusta combinazione per disattivare il Pulsante X.
ti posto il mio vecchio sorgente
prova un pò a fare delle prove non ricordo bene
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Runtime.InteropServices;
namespace DomainQuery
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
class MsgBox
{
[DllImport("user32.dll", EntryPoint = "MessageBox")]
public static extern int MesgBox(int HWND, String caption, String title, uint MsgType);
//Pulsanti
public enum Pulsanti : uint
{
PULSANTE_OK = 0x000,
PULSANTE_INTERROMPI_RIPROVA_IGNORA = 0x002,
PULSANTE_SI_NO_ANNULLA = 0x003,
PULSANTE_SI_NO = 0x004,
PULSANTE_RIPROVA_ANNULLA = 0x005,
PULSANTE_ANNULLA_RIPROVA_CONTINUA = 0x006,
}
public enum PDialog : uint
{
CHIUSURA_ON = 0x001,
CHIUSURA_OFF = 0x002
}
public static void Show(String Titolo,String messaggio,uint Pulsanti )
{
MesgBox(0, Titolo, messaggio, (uint) Pulsanti);
}
}
private void button1_Click(object sender, EventArgs e)
{
MsgBox.Show("Ciao", "test",(uint) MsgBox.Pulsanti.PULSANTE_SI_NO);
}
}
}
prova con
MsgBox.Show("Ciao", "test",(uint) MsgBox.Pulsanti.PULSANTE_SI_NO);
magari cambiando il tipo di pulsante.
Fammi sapere
prova anche in questo modo purtroppo non ricordo bene il processo preciso che feci
MsgBox.Show("Ciao", "test",(uint) MsgBox.Pulsanti.PULSANTE_SI_NO | (uint) PDialog.CHIUSURA_OFF );