VB Code:
Option Explicit 'Always on top stuff Private Const HWND_TOPMOST = -1 Private Const SWP_NOSIZE = &H1 Private Const SWP_NOMOVE = &H2 Private Const SWP_NOACTIVATE = &H10 Private Const SWP_SHOWWINDOW = &H40 Private Declare Sub SetWindowPos Lib "user32" ( _ ByVal hwnd As Long, _ ByVal hWndInsertAfter As Long, _ ByVal x As Long, _ ByVal y As Long, _ ByVal cx As Long, _ ByVal cy As Long, _ ByVal wFlags As Long _ ) Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _ ByVal lpClassName As String, _ ByVal lpWindowName As String _ ) As Long 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 FindWindowEx Lib "user32" Alias "FindWindowExA" ( _ ByVal hWnd1 As Long, _ ByVal hWnd2 As Long, _ ByVal lpsz1 As String, _ ByVal lpsz2 As String _ ) As Long Dim hWndFrm As Long Dim hWndtxtBox As Long Dim strCaptionFrm As String Dim strClassNameTxtBox As String Dim strCaptionTxtBox As String Private Sub cmdStart_Click() 'make window always on top SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or _ SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE 'set the system-wide low level mouse hook Call SetMouseHook hWndFrm = FindWindow(vbNullString, strCaptionFrm) hWndtxtBox = FindWindowEx(hWndFrm, 0, strClassNameTxtBox, strCaptionTxtBox) End Sub Private Sub Form_Load() strCaptionFrm = "icopmsgAIM" strClassNameTxtBox = txtclassname.Text strCaptionTxtBox = txtcaption.Text End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Call RemoveMouseHook End Sub
still nothing.man this is way hard for such a simple thing.




Reply With Quote