
24/11/2005, 06:55
|
 | | | Fecha de Ingreso: marzo-2002 Ubicación: InterNET
Mensajes: 1.121
Antigüedad: 22 años, 11 meses Puntos: 7 | |
No me funcionó poniendo cero porque la función "SHFullScreen" recibe de parámetro un tipo de dato "System.IntPtr" y al parece el cero no es de ese tipo de datos.
Probé poniendo el código así y no me funcionó:
Código:
Call SHFullScreen(hwnd.Zero, SHFS_HIDETASKBAR)
Voy a pegar el código completo a ver si alguién le surge otra idea, creen un form que se llame frmMain y sustituyan todo el código por este:
Código:
Imports System.Net
Imports System.IO
Imports System
Imports System.Drawing
Imports System.Collections
Imports System.Windows.Forms
Imports System.Data
Imports System.Runtime.InteropServices
Public Class frmMain
Inherits System.Windows.Forms.Form
Private WithEvents btnDireccionesClientes As System.Windows.Forms.Button
Overloads Declare Function CreateProcess Lib "CoreDll.dll" (ByVal imageName As String, ByVal cmdLine As String, ByVal lpProcessAttributes As IntPtr, ByVal lpThreadAttributes As IntPtr, ByVal boolInheritHandles As Int32, ByVal dwCreationFlags As Int32, ByVal lpEnvironment As IntPtr, ByVal lpszCurrentDir As IntPtr, ByVal si As Byte(), ByVal pi As ProcessInfo) As Integer
Declare Function WaitForSingleObject Lib "CoreDll.dll" (ByVal Handle As IntPtr, ByVal Wait As Int32) As Int32
Declare Function GetLastError Lib "CoreDll.dll" () As Int32
Declare Function CloseHandle Lib "CoreDll.dll" (ByVal Handle As IntPtr) As Int32
Const SHFS_SHOWTASKBAR As Integer = &H1
Const SHFS_HIDETASKBAR As Integer = &H2
Const SHFS_SHOWSIPBUTTON As Integer = &H4
Const SHFS_HIDESIPBUTTON As Integer = &H8
Const SHFS_SHOWSTARTICON As Integer = &H10
Const SHFS_HIDESTARTICON As Integer = &H20
<DllImport("aygshell.dll")> _
Shared Function SHFullScreen(ByVal hwndRequester As IntPtr, _
ByVal dwState As Integer) As Integer
End Function
<DllImport("coredll.dll")> _
Public Shared Function GetCapture() As IntPtr
End Function
Public Class ProcessInfo
Public hProcess As IntPtr
Public hThread As IntPtr
Public ProcessId As Int32
Public ThreadId As Int32
End Class 'ProcessInfo
Public Overloads Shared Function CreateProcess(ByVal ExeName As String, ByVal CmdLine As String, ByVal pi As ProcessInfo) As Boolean
Dim INFINITE As Int32
INFINITE = &HFFFFFFFF
Dim WAIT_OBJECT_0 As Int32 = 0
Dim result As Int32
If pi Is Nothing Then
pi = New ProcessInfo
End If
Dim si(128) As Byte
result = CreateProcess(ExeName, CmdLine, IntPtr.Zero, IntPtr.Zero.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, si, pi)
If 0 = result Then
Return False
End If
'result = WaitForSingleObject(pi.hProcess, INFINITE)
CloseHandle(pi.hThread)
CloseHandle(pi.hProcess)
'If WAIT_OBJECT_0 <> result Then
' Return False
'End If
Return True
End Function
Public Sub New()
'
' Required for Windows Form Designer support
'
InitializeComponent()
Dim lbltxt As String = "Click the button and then stop the calculator on the Running Programs tab under Settings\System\Memory." + ControlChars.Lf
lbltxt = lbltxt + ControlChars.Lf + "Calculator must not be running at start of test."
'label1.Text = lbltxt
End Sub 'New
'
' TODO: Add any constructor code after InitializeComponent call
'
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
MyBase.Dispose(disposing)
End Sub 'Dispose
#Region "Windows Form Designer generated code"
'
' Required method for Designer support - do not modify
' the contents of this method with the code editor.
'
Friend WithEvents lvProgramas As System.Windows.Forms.ListView
Friend WithEvents txtPassword As System.Windows.Forms.TextBox
Friend WithEvents btnSalir As System.Windows.Forms.Button
Friend WithEvents btnIce As System.Windows.Forms.Button
Friend WithEvents lblPassword As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Private Sub InitializeComponent()
Me.btnDireccionesClientes = New System.Windows.Forms.Button
Me.txtPassword = New System.Windows.Forms.TextBox
Me.btnSalir = New System.Windows.Forms.Button
Me.btnIce = New System.Windows.Forms.Button
Me.lblPassword = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
'
'btnDireccionesClientes
'
Me.btnDireccionesClientes.Location = New System.Drawing.Point(8, 56)
Me.btnDireccionesClientes.Size = New System.Drawing.Size(124, 38)
Me.btnDireccionesClientes.Text = "Direcciones Clientes"
'
'txtPassword
'
Me.txtPassword.Location = New System.Drawing.Point(164, 174)
Me.txtPassword.Text = ""
'
'btnSalir
'
Me.btnSalir.Location = New System.Drawing.Point(164, 199)
Me.btnSalir.Size = New System.Drawing.Size(88, 30)
Me.btnSalir.Text = "&Salir"
'
'btnIce
'
Me.btnIce.Location = New System.Drawing.Point(8, 14)
Me.btnIce.Size = New System.Drawing.Size(124, 38)
Me.btnIce.Text = "ICE"
'
'lblPassword
'
Me.lblPassword.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold)
Me.lblPassword.Location = New System.Drawing.Point(86, 177)
Me.lblPassword.Size = New System.Drawing.Size(74, 16)
Me.lblPassword.Text = "Password"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(186, 18)
Me.Label1.Size = New System.Drawing.Size(132, 28)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
'
'frmMain
'
Me.ClientSize = New System.Drawing.Size(328, 390)
Me.ControlBox = False
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.lblPassword)
Me.Controls.Add(Me.btnIce)
Me.Controls.Add(Me.btnSalir)
Me.Controls.Add(Me.txtPassword)
Me.Controls.Add(Me.btnDireccionesClientes)
Me.Location = New System.Drawing.Point(0, 10)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
End Sub
#End Region
Shared Sub Main()
Application.Run(New frmMain)
End Sub
Private Sub btnDireccionesClientes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDireccionesClientes.Click
Dim progPath As String = "\Windows\Calc.exe"
'Dim progPath As String = "\Windows\Calc.exe"
'Dim progPath As String = "\Program Files\DireccionesClientes\DireccionesClientes.exe"
Dim pi As New ProcessInfo
If CreateProcess(progPath, "", pi) Then
' MessageBox.Show(String.Format("Success! Resuming calling application." + ControlChars.Lf + "PID = 0x{0:X8}" + ControlChars.Lf + "({0})", pi.ProcessId), "Done Waiting...")
'Else
' MessageBox.Show(String.Format("Failed!" + ControlChars.Lf + "System Error = 0x{0:X8}" + ControlChars.Lf + "({0})", GetLastError()), "Done waiting...")
End If
End Sub
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Label1.Text = Dns.GetHostByName(Dns.GetHostName).AddressList
'Capture = True
Dim hwnd As IntPtr = GetCapture()
'Capture = False
'Call SHFullScreen(hwnd, SHFS_HIDETASKBAR)
Call SHFullScreen(hwnd.Zero, SHFS_HIDETASKBAR)
'SHFS_HIDESTARTICON() hwnd
'--Abriendo y Cerrando un formulario para que se esconda la barra de inicio--
Dim f As frmClose
f = New frmClose
f.ShowDialog()
f = Nothing
'----------------------------------------------------------------------------
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSalir.Click
If txtPassword.Text = "47422" Then
Me.Close()
Else
MsgBox("Password Incorrecto")
End If
End Sub
End Class
__________________ .::RsOfT::.
--El que se aferra a lo conocido, nunca conocerá lo desconocido--
--Es intentando lo imposible como se realiza lo posible--
--Es de pésimo gusto contentarse con algo mediocre cuando lo excelente está a nuestro alcance-- |