topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday December 13, 2024, 3:16 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: FBSL - Net Send grabber + logger  (Read 6771 times)

Gerome

  • Charter Honorary Member
  • Joined in 2006
  • ***
  • Posts: 154
    • View Profile
    • Get my Freestyle Basic Script Language + compiler!
    • Donate to Member
FBSL - Net Send grabber + logger
« on: February 07, 2006, 04:55 PM »
Hello,

Sometimes, when you're at office without admin rights or poweruser rights, you are feeling kinda bitter...
And to send messages to your collegues, you have to use the NET SEND mycollegue TheMessage blahhh
to discuss a bit...
Yes, but exchnaging those kinda msg is heavy and not convivial, plus you can't grab the text that is just popped at screen...
I've found a solution !

I've developped a tiny GUI application that is in charge of scruting for incoming net sended messages, grabbing its very content, redirecting the message into a richedit control + logging the very content of the popped messages + closing the popped message !!!

Here's a screen shot of a just grabbed popped message :


Here's the main script that does the trick :
#Option Explicit
#DllDeclare User32( "EnumWindows", "GetWindowText", "GetWindowTextLength", _
                    "GetDlgItem", "SetFocus", "FindWindow", "FlashWindow" )

' // Replace with the correct translation here
Const service = "Service Affichage des messages "
Const sep     = "--------------------------------------------------------------------------------"
Const STYLE = WS_CHILD + WS_CLIPSIBLINGS + WS_VISIBLE + WS_HSCROLL + WS_VSCROLL + ES_MULTILINE + _
              ES_AUTOVSCROLL + ES_AUTOHSCROLL + WS_TABSTOP
LoadLibrary("Riched20.dll")
Dim %H = 420, %W = 220, $sGet, %fp
Resize( Me, 0, 0, H, W )
Dim hwndInput = FBSL_Control ( _
         "richedit20a", Me, "", 1000, 20, 20, H-40, W-40, STYLE, WS_EX_CLIENTEDGE )
Fbsl_settext( Me, "NET Send Capturer / logger" )
SetTimer(Me, 3615, 100)

fp = Fileopen( ".\Capturer.log", Append )

Center(Me): ResizeMe(): Show(Me)

Begin Events
    If cbmsg = wm_close Then
        Killtimer( Me, 3615 )
        Fileclose( fp )
        Exitprogram(0)
    End If
    If cbmsg = wm_timer Then
        MyGetNetSend()
    End If
    If cbmsg = wm_size Then
        ResizeMe()
    End If
End Events

Sub MyGetNetSend()
    Dim %hwnd = FindWindow(Null, service )
    Dim %Ret = GetWindowTextLength(hwnd)
    If Ret > 0 Then
        Dim $sSave, %hdlg
        sSave = Space(Ret)
        GetWindowText( hwnd, sSave, Ret + 1 )
        If Left(sSave, Len(service)) = service Then
            ' // Message Window
            hdlg = GetDlgItem( hwnd, 0xFFFF )
            Ret = GetWindowTextLength(hdlg)
            sSave = Space(Ret)
            GetWindowText( hdlg, sSave, Ret + 1 )
            Sendmessage( hwnd, WM_CLOSE, 0, 0 )
            Fbsl_Gettext( hwndInput, sGet )
            sGet = sGet & sSave & CrLf & sep & CrLf
            Fbsl_Settext( hwndInput, sGet )
            Fileprint( fp, sSave )
            FlashWindow( Me, True )
        End If
    End If
End Sub

Sub ResizeMe()
Dim %TopWin, %leftWin, %RightWin, %BottomWin
   GetClientRect(Me, TopWin, leftWin, RightWin, BottomWin )
   Resize( hwndInput, 20, 20, RightWin - 40, BottomWin - 60 )
End Sub

The only thing to adapt into that script will be this only line :
Const service = "Service Affichage des messages "

It was tested onto : NT4, Win2k and WinXP French versions with success :)
And what about you ? :)

Tell me please :)
Yours,
(¯`·._.·[Gerome GUILLEMIN]·._.·´¯)
http://www.fbsl.net [FBSL Author]
http://gedd123.free.fr/FBSLv3.zip [FBSL Help file]
(¯`·._.·[If you need help... just ask]·._.·´¯)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: FBSL - Net Send grabber + logger
« Reply #1 on: February 09, 2006, 02:13 PM »
cool!