Ver Mensaje Individual
  #2 (permalink)  
Antiguo 04/06/2011, 13:47
truskyvb
 
Fecha de Ingreso: octubre-2008
Mensajes: 188
Antigüedad: 16 años, 1 mes
Puntos: 3
Respuesta: Ejecutable con privilegios elevados?

Nunca lo he utlizado, no se realmente lo que hace. Espero que te sirva.

En el Form MainForm:
Option Explicit

Private Const BCM_SETSHIELD As Long = &H160C&

Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" ( _
ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long

Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" ( _
ByVal hWnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

Private Sub Command1_Click()
ShellExecute hWnd, "runas", "ChildProcess.exe", "", CurDir$(), vbNormalFocus
End Sub

Private Sub Form_Load()
SendMessage Command1.hWnd, BCM_SETSHIELD, 0&, 1&
End Sub


Crear un Modulo llamado MainMod.bas

Option Explicit
Private Type tagInitCommonControlsEx
lngSize As Long
lngICC As Long
End Type

Private Const ICC_USEREX_CLASSES = &H200

Private Declare Function InitCommonControlsEx Lib "comctl32.dll" ( _
iccex As tagInitCommonControlsEx) As Boolean

Private Sub InitCommonControls()
Dim iccex As tagInitCommonControlsEx

With iccex
.lngSize = LenB(iccex)
.lngICC = ICC_USEREX_CLASSES
End With
On Error Resume Next
InitCommonControlsEx iccex
End Sub

Private Sub Main()
InitCommonControls
MainForm.Show
End Sub

Un saludo