vb closes? :o - This be resolved.... kinda -
in a module i have:
VB Code:
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public 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
Public Const GWL_WNDPROC = -4
Public Const WM_RBUTTONUP = &H205
Public lpPrevWndProc As Long
Function WindowProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, _
ByVal lParam As Long) As Long
Select Case uMsg
Case WM_RBUTTONUP
PopupMenu mnuSticky
Case Else
WindowProc = CallWindowProc(lpPrevWndProc, hwnd, _
uMsg, wParam, lParam)
End Select
End Function
Public Sub Hook(hwnd As Long)
lngHWnd = hwnd
lpPrevWndProc = SetWindowLong(lngHWnd, GWL_WNDPROC, AddressOf WindowProc)
End Sub
Public Sub UnHook()
Dim lngReturnValue As Long
lngReturnValue = SetWindowLong(lngHWnd, GWL_WNDPROC, lpPrevWndProc)
End Sub
and in the form i have:
VB Code:
Private Sub Form_Load()
Hook (txtSticky.hwnd)
End Sub
Private Sub Form_Unload(Cancel As Integer)
UnHook
End Sub
what its sposed to do is take the system right click menu, with copy and past etc, and replace it with my own
now, when i goto run this, as soon as i press the play button, VB exits
any idea on how to fix?