Foros del Web » Programación para mayores de 30 ;) » .NET »

Ocultar la "Barra de Inicio" en una Pockect PC

Estas en el tema de Ocultar la "Barra de Inicio" en una Pockect PC en el foro de .NET en Foros del Web. Estoy desarrollando en Visual Basic.NET una aplicación de seguridad para pocket PC en donde mediante esta se podrán ejecutar las aplicaciones que yo desee sin ...
  #1 (permalink)  
Antiguo 23/11/2005, 13:07
Avatar de RsOfT  
Fecha de Ingreso: marzo-2002
Ubicación: InterNET
Mensajes: 1.121
Antigüedad: 22 años, 1 mes
Puntos: 7
Ocultar la "Barra de Inicio" en una Pockect PC

Estoy desarrollando en Visual Basic.NET una aplicación de seguridad para pocket PC en donde mediante esta se podrán ejecutar las aplicaciones que yo desee sin que el usuario pueda acceder a la Barra de Inicio del Windows, o sea, que no podrá ejecutar nada del sistema operativo.

Actualmente al ejecutar mi aplicación pude esconder la barra de inicio con un ejemplo que encontré en Internet el cual llama una función llamada “SHFullScreen(hwnd, SHFS_HIDETASKBAR)”.

El problema radica cuando, desde mi aplicación, llamo otra aplicación. En el momento en que se ejecuta la otra aplicación de un tercero, ejemplo la calculadora de windows, se muestra la barra de inicio.

Supongo que si obtengo el hwnd de la calculadora de windows podría mandarlo en la función y esconder la barra de inicio al ejecutarla, pero no se como obtener el hwnd de una aplicación de un tercero.

Alguien tiene alguna idea de que podría hacer para que, sin importar la aplicación que llame, no me muestre la barra de inicio del windows de la pocket PC?
__________________
.::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--
  #2 (permalink)  
Antiguo 24/11/2005, 03:05
Avatar de Jose_minglein2  
Fecha de Ingreso: noviembre-2004
Mensajes: 2.344
Antigüedad: 19 años, 5 meses
Puntos: 8
Pues no tengo ni idea de como va esa función, pero te comento una cosa que tuve que hacer yo que quizá te sirva. Yo tenía que controlar el ratón en cualquier parte del sistema operativo aunque fuese fuera de mi app. Para ello tenía que utilizar las APIS de windows (que parece que estás usando tú) y en uno de sus parámetros tenía que pasarle en vez del ID de mi app 0 que indica el raiz de los procesos (System creo), quizá tu tengas que hacer lo mismo. (Aunque es solo una suposición).

Suerte.
  #3 (permalink)  
Antiguo 24/11/2005, 06:55
Avatar de RsOfT  
Fecha de Ingreso: marzo-2002
Ubicación: InterNET
Mensajes: 1.121
Antigüedad: 22 años, 1 mes
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--
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:45.