Controlling message statuses

  • Thread starter Thread starter Metaconta
  • Start date Start date
M

Metaconta

Guest
Hello:

Finally based on code and eating from C #, I have managed to show the F # in visual mode, it is usually in console, but good.

1260773


I want to achieve once for all, that by pressing the open button, the moment you press it, it says the message "Opening ...".

When the reader's tray is fully opened, it says, "Open."

Achievement that opens and closes the tray but does not show the messages.

Any ideas?

I keep giving him cane, I got tired.


open System
open System.Text
open System.Windows.Forms // Add references.
open System.Drawing // Add references.
open System.Runtime.InteropServices

// Import external library or dll.
[<DllImport("winmm.dll")>]
extern int mciSendString(string lpstrCommand, StringBuilder lpstrReturnString,
int uReturnLength, IntPtr hwndCallback)

let rt = StringBuilder(127)

// Method necessary to support the Designer. The content of
// this method can not be modified with the code editor.
let form = new Form()
let label_Mensaje = new Label()
let groupBox_Bandeja = new GroupBox()
let button_Abrir = new Button();
let button_Cerrar = new Button();
groupBox_Bandeja.SuspendLayout()
form.SuspendLayout()

// groupBox_Bandeja
groupBox_Bandeja.Controls.Add(button_Abrir)
groupBox_Bandeja.Controls.Add(button_Cerrar)
groupBox_Bandeja.Location <- Point(22, 118)
groupBox_Bandeja.Name <- "groupBox_Bandeja"
groupBox_Bandeja.Size <- Size(227, 90)
groupBox_Bandeja.TabIndex <- 0
groupBox_Bandeja.TabStop <- false
groupBox_Bandeja.Text <- "Tray:"

// button_Abrir
button_Abrir.Location <- Point(26, 39)
button_Abrir.Name <- "button_Abrir"
button_Abrir.Size <- Size(75, 23)
button_Abrir.TabIndex <- 0
button_Abrir.Text <- "&Open"
button_Abrir.UseVisualStyleBackColor <- true

// button_Cerrar
button_Cerrar.Location <- Point(129, 39)
button_Cerrar.Name <- "button_Cerrar"
button_Cerrar.Size <- Size(75, 23)
button_Cerrar.TabIndex <- 1
button_Cerrar.Text <- "&Close"
button_Cerrar.UseVisualStyleBackColor <- true

// label_Mensaje
label_Mensaje.AutoSize <- true
//label_Mensaje.Font <- Font("Microsoft Sans Serif", 36, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)))
label_Mensaje.Location <- Point(12, 9)
label_Mensaje.Name <- "label_Mensaje"
label_Mensaje.Size <- Size(52, 55)
label_Mensaje.TabIndex <- 1
label_Mensaje.Text <- "?"
form.Controls.Add(label_Mensaje) // Add in the form.

// Create form.
let AutoScaleDimensions = new Size(6, 13)
form.AutoScaleMode <- AutoScaleMode.Font
form.BackColor <- Color.FromArgb(((int)(((byte)(114)))), ((int)(((byte)(54)))), ((int)(((byte)(161)))))
let ClientSize = new Size(284, 261)
form.Controls.Add(groupBox_Bandeja) // Add in the form.
form.Name <- "form"
form.StartPosition <- FormStartPosition.CenterScreen
form.Text <- "Visual F# 2017"
groupBox_Bandeja.ResumeLayout(false)
form.ResumeLayout(false)
form.PerformLayout()
//----------------------------------------------------------------------------------

// Open the tray.
let mensajeA _abr = label_Mensaje.Text <- "Opening ..."
let _abr = label_Mensaje.Click.Add(mensajeA)
Application.DoEvents()
let button_Abrir_Click _abrir = mciSendString("set CDAudio door open", rt, 127, IntPtr.Zero) |> ignore
let _abrir = button_Abrir.Click.Add(button_Abrir_Click)
let mensajeAbierto2 ao = label_Mensaje.Text <- "Open."
let ao = label_Mensaje.Click.Add(mensajeAbierto2)

// Close the tray.
let button_Cerrar_Click _cerrar = mciSendString("set CDAudio door closed", rt, 127, IntPtr.Zero) |> ignore
let _cerrar = button_Cerrar.Click.Add(button_Cerrar_Click)

[<STAThread>]
Application.Run(form)


Goodbye


http://electronica-pic.blogspot.com

Continue reading...
 
Back
Top