Auto-Closing Betting Assistant

Discuss anything related to using the program (eg. triggered betting tactics)

Moderator: 2020vision

Auto-Closing Betting Assistant

Postby Mitch » Mon Jun 26, 2006 11:19 pm

Hopefully this might help others in the same situation I found myself in.

I have Tiscali 'unlimited' broadband, so I thought I could use as much bandwidth as I wanted. All I was doing was using BA a lot. I recently got an e-mail from them saying I was in breach of their fair-use policy, and unless I cut down the usage during peak times they would make me share bandwidth with other 'heavy users'. A lot of the time I'm not home when I'm finished using BA for the day so I set about finding how to close it when I wasn't there.

AppActivate and Sendkeys worked to a degree but had a few problems, then I found out about a load more stuff about Excel that I hadn't seen before, namely the Windows API functions.

Anyway, the following code solved my problem. For those who know vba and want to use it, you copy the whole code into a module and call the Close_By_Caption function with the exact caption in the title bar of the window you want to close as the argument in speech marks. ie.

Code: Select all
Close_By_Caption "TitleBarCaptionHere"


If anyone who doesn't understand vba wants to use it, just post here with the details of your worksheet (just if it's formulae only or has vba in it) and how you want to use it and I'll sort something out for you.


Code: Select all
'API Find applcation by full caption
Private Declare Function FindWindow _
    Lib "user32" _
    Alias "FindWindowA" _
    ( _
    ByVal lpClassName As String, _
    ByVal lpWindowName As String _
    ) _
    As Long

'API Bring Window to foreground
Private Declare Function SetForegroundWindow _
    Lib "user32" _
    ( _
    ByVal hwnd As Long _
    ) _
    As Long
   
'API Send message to application
Private Declare Function PostMessage _
    Lib "user32" _
    Alias "PostMessageA" _
    ( _
    ByVal hwnd As Long, _
    ByVal wMsg As Long, _
    ByVal wParam As Long, _
    lParam As Any _
    ) _
    As Long

Const WM_CLOSE = &H10

Function Close_By_Caption(AppCaption As String)

    Dim hwnd As Long
   
    hwnd = FindWindow(vbNullString, AppCaption)
   
    If hwnd Then
        SetForegroundWindow hwnd            'Bring to Front
        PostMessage hwnd, WM_CLOSE, 0&, 0&  'Close the app nicely
    End If
   
End Function
User avatar
Mitch
 
Posts: 365
Joined: Sat Nov 19, 2005 12:28 am
Location: Leicester

Return to Discussion

Who is online

Users browsing this forum: No registered users and 102 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.