Sign in to follow this  
Followers 0
James

UDF Help

3 posts in this topic

Hey,

I am converting my message beep function found in my signature, into a UDF.

Func MsgBeep($io_msg)
    Local Const $MB_SIMPLEBEEP = -1
    Local Const $MB_ICONASTERISK = 0x00000040
    Local Const $MB_ICONEXCLAMATION = 0x00000030
    Local Const $MB_ICONHAND = 0x00000010
    Local Const $MB_ICONQUESTION = 0x00000020
    Local Const $MB_OK = 0x00000000
    
    DllCall("user32.dll", "int", "MessageBeep", "int", $io_msg)
EndFuncoÝ÷ Ø­!©°jw^®)à-¢f¤z+l¢ØZ¶'åzÛ,k)²~éܶ*'ÇWjëh×6MsgBeep(1)

It would beep the first message sound. If the number was 2 it would beep message, $MB_ICONASTERISK etc.

-James

Share this post


Link to post
Share on other sites



I'm not sure if I understand your question, but couldn't you just do this:

Func MsgBeep($io_msg)
    Local Const $MB_SIMPLEBEEP = -1
    Local Const $MB_ICONASTERISK = 0x00000040
    Local Const $MB_ICONEXCLAMATION = 0x00000030
    Local Const $MB_ICONHAND = 0x00000010
    Local Const $MB_ICONQUESTION = 0x00000020
    Local Const $MB_OK = 0x00000000
    Dim $msg
    Switch $io_msg
        Case 1
            $msg = $MB_SIMPLEBEEP
        Case 2
            $msg = $MB_ICONASTERISK
        Case 3
            $msg = $MB_ICONEXCLAMATION
        Case 4
            $msg = $MB_ICONHAND
        Case 5
            $msg = $MB_ICONQUESTION
        Case 6
            $msg = $MB_OK
        Case Else
            $msg = $io_msg
    EndSwitch
    DllCall("user32.dll", "int", "MessageBeep", "int", $msg)
EndFunc


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites

Thanks Sandman, I did that about 10 mins after I posted. I also tried it like:

MsgBeep(1)

Func MsgBeep($io_msg)
    Local Const $MB_SIMPLEBEEP = -1
    Local Const $MB_ICONASTERISK = 0x00000040
    Local Const $MB_ICONEXCLAMATION = 0x00000030
    Local Const $MB_ICONHAND = 0x00000010
    Local Const $MB_ICONQUESTION = 0x00000020
    Local Const $MB_OK = 0x00000000
    
    If $io_msg = 1 Then
        $io = $MB_SIMPLEBEEP = -1
        DllCall("user32.dll", "int", "MessageBeep", "int", $io)
    ElseIf $io_msg = 2 Then
        $io = $MB_ICONASTERISK = 0x00000040
        DllCall("user32.dll", "int", "MessageBeep", "int", $io)
    ElseIf $io_msg = 3 Then
        $io = $MB_ICONEXCLAMATION = 0x00000030
        DllCall("user32.dll", "int", "MessageBeep", "int", $io)
    ElseIf $io_msg = 4 Then
        $io = $MB_ICONHAND = 0x00000010
        DllCall("user32.dll", "int", "MessageBeep", "int", $io)
    ElseIf $io_msg = 5 Then
        $io = $MB_ICONQUESTION = 0x00000020
        DllCall("user32.dll", "int", "MessageBeep", "int", $io)
    ElseIf $io_msg = 6 Then
        $io = $MB_OK = 0x00000000
        DllCall("user32.dll", "int", "MessageBeep", "int", $io)
    EndIf
EndFunc   ;==>MsgBeep

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0