Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Action()
- '// This code will launch said application in administrative mode, and depending
- '// on the user's UAC mode, may or may not show a UAC dialog
- Declare Function ShellExecuteA Lib "Shell32" (hwnd As Integer, lpOperation As CString, lpFile As CString, _
- lpParameters As CString, lpDirectory As CString, nShowCmd As Integer) As Integer
- Const SW_HIDE = 0
- Const SW_MAXIMIZE = 3
- Const SW_MINIMIZE = 6
- Const SW_RESTORE = 9
- Const SW_SHOW = 5
- Const SW_SHOWDEFAULT = 15
- Const SW_SHOWMAXIMIZED = 3
- Const SW_SHOWMINIMIZED = 2
- Const SW_SHOWMINNOACTIVE = 7
- Const SW_SHOWNA = 8
- Const SW_SHOWNOACTIVATE = 4
- Const SW_SHOWNORMAL = 1
- Call ShellExecuteA(Self.Handle, "runas", "C:\Windows\Notepad.exe", "C:\Windows\System32\drivers\etc\hosts", "", SW_SHOWNORMAL)
- End Sub
- Sub Open()
- '// This code will create a UAC icon on this PushButton
- Declare Function SendMessageA Lib "User32" (hWnd As Integer, Msg As Integer, wParam As Integer, lParam As Integer) As Integer
- Const BCM_SETSHIELD = &h0000160C
- Call SendMessageA(Me.Handle, BCM_SETSHIELD, 0, 1)
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement