Bay Six Software Forum Index Bay Six Software
Beyond the Basics
 
 FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Demos - Absolutely positioned Confirm and Notice boxes
 
Absolutely positioned Confirm and Notice boxes
Arrow Download
Code:
Call NoticeAt 0, 0, "Hello from the top-left corner!"
Call ConfirmAt 0, 0, "Do you like it up here?", a$
Print a$
End

Sub ConfirmAt X, Y, Msg$, ByRef Ans$
    Call PrepDialogAt X, Y
    Confirm Msg$; Ans$
End Sub

Sub NoticeAt X, Y, Msg$
    Call PrepDialogAt X, Y
    Notice Msg$
End Sub

Sub PrepDialogAt X, Y
    Callback lpfnHook, DialogAtHook( Long, ULong, ULong ), Long

    CallDLL #kernel32, "GetModuleHandleA", _
        _NULL As Long, _
        hInst As ULong

    CallDLL #kernel32, "GetCurrentThreadId", _
        ThreadId As ULong

    CallDLL #user32, "SetWindowsHookExA", _
        _WH_CBT As ULong, _
        lpfnHook As ULong, _
        hInst As ULong, _
        ThreadId As ULong, _
        hHook As ULong

    HookData(0) = hHook
    HookData(1) = X
    HookData(2) = Y
End Sub

Function DialogAtHook( lMsg, wParam, lParam )
    If _HCBT_ACTIVATE = lMsg Then
        hHook = HookData(0)
        x = HookData(1)
        y = HookData(2)

        flags = _SWP_NOZORDER+_SWP_NOSIZE+_SWP_NOACTIVATE

        CallDLL #user32, "SetWindowPos", _
           wParam As ULong, _
           _NULL As ULong, _
           x As Long, _
           y As Long, _
           0 As Long, _
           0 As Long, _
           flags As ULong, _
           r As Long

        CallDLL #user32, "UnhookWindowsHookEx", _
           hHook As ULong, _
           r As Long
    End If
End Function

Powered by phpBB © 2001, 2005 phpBB Group