Nomad Posted May 23, 2006 Author Posted May 23, 2006 This is a visual basic script I found, but I'm not familiar with visual basic programming. I'm looking into the functionality of this script. From what I gathered, it might be similar to what I'm looking for, but the site was in a different language and I'm not exactly sure if I completely comprehended what was interpreted. If someone who knows VB would care to comment on the functionality of this script, it would be helpful, thanks.' this SOURCE comes from http://www.activevb.de' and can be used freely. For possible damage' is not responsible.' arounderrors or questions to clarify, you use please our forum.' otherwise much fun and success with this SOURCE!' at the beginning of project file Project1.vbp ------------' the component ' Microsoft Windows Common control 5,0 (SP2) ' (comctl32.ocx) ' is needed.' beginning form "Form1" alias Form1.frm --------' control member: Switching surface "Command1"' control member: Inscription field "Label5"' author: Kopczynski' E-Mail: D.Copy@gmx.deoption Explicitprivate Sub Form_Load() call SetHotKey(Me.hWnd, &H1 + &H2, &H77)end to Subprivate Sub Form_Unload(Cancel As Integer) call RemoveHotKeyend to Subprivate Sub Command1_Click() App.TaskVisible = False Me.Hideend to Sub' end form "Form1" alias Form1.frm ---------' beginning module "Module1" alias Module1.bas --------option Explicitprivate one Declare Function RegisterHotKey Lib "user32" (ByVal _ hWnd As Long, ByVal ID As Long, ByVal fsModifiers As _ Long, ByVal vk As Long) As Long private Declare Function UnregisterHotKey Lib "user32" (ByVal _ hWnd As Long, ByVal ID As Long) As Longprivate Declare Function CallWindowProc Lib "user32" alias _ "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal _ hWnd As Long, ByVal Msg As Long, ByVal wParam As _ Long, ByVal lParam As Long) As Long private Declare Function SetWindowLong Lib "user32" alias _ "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex _ As Long, ByVal dwNewLong As Long) As Longprivate Declare Function global DELETE atom Lib "kernel32" _ (ByVal nAtom As Integer) As Integer private Declare Function global ADD atom Lib "kernel32" alias _ "GlobalAddAtomA" (ByVal lpString As stringer) As IntegerConst GWL_WNDPROC As Long = (-4&)Const WM_HOTKEY As Long = &H312&Public Enum ModKeys MOD_ALT = &H1 MOD_CONTROL = &H2 MOD_SHIFT = &H4 MOD_WIN = &H8end to Enumprivate OldProc As Long, hOwner As Longprivate one iAtom As IntegerPublic Sub SetHotKey(hWnd As Long, ModKey As ModKeys, _ vKey As Long) hOwner = hWnd iAtom = GlobalAddAtom("MyHotKey") call RegisterHotKey(hOwner, iAtom, ModKey, vKey) OldProc = SetWindowLong(hOwner, GWL_WNDPROC, _ AddressOf WndProc) end SubPublic Sub RemoveHotKey() If more hOwner = 0 Then exit Sub call UnregisterHotKey(hOwner, iAtom) call SetWindowLong(hOwner, GWL_WNDPROC, OldProc) call GlobalDeleteAtom(iAtom)end to SubPublic Function WndProc(ByVal hWnd As Long, _ ByVal wMsg As Long, ByVal wParam As Long, _ ByVal lParam As Long) As Long If wMsg = WM_HOTKEY and wParam = iAtom Then Form1.Show Else WndProc = CallWindowProc(OldProc, hWnd, wMsg, wParam, lParam) end to Ifend to Function' end module "Module1" alias Module1.bas ---------' end of project file Project1.vbp -------------
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now