Jump to content
FireFox

IP Camera stream + record

Recommended Posts

FireFox

I recently bought an IP Camera to monitor my house. There is a web access to view the video stream but not to record it.

Here is the IP Camera in question, it should work with every other similar product.

So I made a simple example which does the job.

Here is the code :

#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <WinAPI.au3>
#include <GDIPlus.au3>
#include <Memory.au3>

#region Global Vars
Global Const $sProgramTitle = "IP Camera stream + record"

;EDIT THE FOLLOWING LINE ONLY:
Global Const $iIPAddress = "192.168.1.99", $iPort = 99, $shtauth = "yourauth=="

Global Const $STM_SETIMAGE = 0x0172

Global $blRecording = False, $blGUIMinimized = False
Global Const $sRecordDir = @ScriptDir & "\ip_camera_stream"

Global $bRecvtmp = Binary(""), $bStream = $bRecvtmp
Global $iImgLen = 0, $iStreamLen = 0, $iWritten = 0, $iEOH = 0, $iContLenPos = 0, $hImgFile = 0, $pBuffer = 0, $iImgCount = 0
Global Const $iContLengthLen = StringLen("Content-Length: ")
Global $sStream = "", $sTrim2ContLen = ""

Global $hBMP = 0, $hGraphics = 0, $hHBITMAP2 = 0, $hFamily = 0, $hFont = 0, $tLayout = "", $hFormat = 0, $hBrush = 0
#endregion Global Vars

TCPStartup()

Global $iSocket = TCPConnect($iIPAddress, $iPort)
If @error Then
    MsgBox(16, $sProgramTitle, "Could not connect !")
    Exit -1
EndIf

TCPSend($iSocket, _
        "GET /videostream.cgi HTTP/1.1" & @CRLF & _
        "Host: " & $iIPAddress & ":" & $iPort & @CRLF & _
        "Connection: keep-alive" & @CRLF & _
        "Authorization: Basic " & $shtauth & @CRLF & @CRLF)

#region GUI
Global $hGUI = 0, $pPic = 0, $hPic = 0, $btnRecord = 0

$hGUI = GUICreate($sProgramTitle, 640, 525)

$pPic = GUICtrlCreatePic("", 0, 0, 640, 480, $SS_BITMAP)
GUICtrlSetState($pPic, $GUI_DISABLE)
$hPic = GUICtrlGetHandle($pPic)

$btnRecord = GUICtrlCreateButton("Record", 10, 490, 80, 26)

GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND")

GUISetState(@SW_SHOW, $hGUI)
#endregion GUI

_GDIPlus_Startup()

$hFamily = _GDIPlus_FontFamilyCreate("Arial")
$hFont = _GDIPlus_FontCreate($hFamily, 17)
$tLayout = _GDIPlus_RectFCreate(10, 10, 100, 40)
$hFormat = _GDIPlus_StringFormatCreate()
$hBrush = _GDIPlus_BrushCreateSolid(0xAFFF0000)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $btnRecord
            If $blRecording Then
                GUICtrlSetData($btnRecord, "Record")
            Else
                If Not FileExists($sRecordDir) Then DirCreate($sRecordDir)

                GUICtrlSetData($btnRecord, "Stop recording")
            EndIf

            $blRecording = Not $blRecording
    EndSwitch

    $bRecvtmp = TCPRecv($iSocket, 4096, 1) ;4kb
    If @error Then ExitLoop

    If Not BinaryLen($bRecvtmp) Then ContinueLoop
    $bStream &= $bRecvtmp

    If $iImgLen = 0 Then
        $sStream = BinaryToString($bStream)

        $iContLenPos = StringInStr($sStream, "Content-Length: ", 2)
        $iEOH = StringInStr($sStream, @CRLF & @CRLF, 2, 1, $iContLenPos)

        If $iEOH = 0 Or $iContLenPos = 0 Then ContinueLoop

        $sTrim2ContLen = StringTrimLeft($sStream, $iContLenPos + $iContLengthLen - 1)

        $iImgLen = Number(StringLeft($sTrim2ContLen, StringInStr($sTrim2ContLen, @CR, 2) - 1))

        $bStream = BinaryMid($bStream, $iEOH + 4)
    EndIf

    If $iImgLen = 0 Then ContinueLoop

    $iStreamLen = BinaryLen($bStream)
    If $iStreamLen < $iImgLen Then ContinueLoop

    If Not $blGUIMinimized Then
        $hBMP = Load_BMP_From_Mem($bStream)

        If $blRecording Then
            $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBMP)
            _GDIPlus_GraphicsDrawStringEx($hGraphics, "[•REC]", $hFont, $tLayout, $hFormat, $hBrush)
        EndIf

        $hHBITMAP2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBMP)

        _WinAPI_DeleteObject(_SendMessage($hPic, $STM_SETIMAGE, 0, $hHBITMAP2))

        _GDIPlus_ImageDispose($hBMP)
        If $blRecording Then _GDIPlus_GraphicsDispose($hGraphics)
        _WinAPI_DeleteObject($hHBITMAP2)
    EndIf

    If $blRecording Then
        $pBuffer = DllStructCreate("byte[" & $iImgLen & "]")

        If $iStreamLen > $iImgLen Then
            DllStructSetData($pBuffer, 1, BinaryMid($bStream, 1, $iImgLen))

            $bStream = BinaryMid($bStream, $iImgLen)
        Else
            DllStructSetData($pBuffer, 1, $bStream)

            $bStream = Binary("")
        EndIf

        $hImgFile = _WinAPI_CreateFile($sRecordDir & "\snap_" & StringFormat("%.4d", $iImgCount) & ".jpg", 3, 4, 4)
        _WinAPI_WriteFile($hImgFile, DllStructGetPtr($pBuffer), $iImgLen, $iWritten)
        _WinAPI_CloseHandle($hImgFile)

        $iImgCount += 1
    EndIf

    $iImgLen = 0
WEnd

_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hBrush)

_GDIPlus_Shutdown()

TCPCloseSocket($iSocket)
TCPShutdown()

Func WM_SYSCOMMAND($hWnd, $iMsg, $wParam, $lParam)
    Local Const $SC_MINIMIZE = 0xF020, $SC_RESTORE = 0xF120

    Switch BitAND($wParam, 0xFFF0)
        Case $SC_MINIMIZE, $SC_RESTORE
            $blGUIMinimized = Not $blGUIMinimized
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SYSCOMMAND

Func Load_BMP_From_Mem($bImage) ;_GDIPlus_BitmapCreateFromMemory2
    ;Author: UEZ
    ;Modified: ProgAndy, Yashied, FireFox
    If Not IsBinary($bImage) Then Return 0
    Local $memBitmap = Binary($bImage)
    Local $iLen = BinaryLen($memBitmap)
    Local $GMEM_MOVEABLE = 0x0002
    Local $aResult = DllCall("kernel32.dll", "handle", "GlobalAlloc", "uint", $GMEM_MOVEABLE, "ulong_ptr", $iLen)
    Local $hData = $aResult[0]
    $aResult = DllCall("kernel32.dll", "ptr", "GlobalLock", "handle", $hData)
    If @error Then Return 0
    Local $tMem = DllStructCreate("byte[" & $iLen & "]", $aResult[0])
    DllStructSetData($tMem, 1, $memBitmap)
    DllCall("kernel32.dll", "bool", "GlobalUnlock", "handle", $hData)
    If @error Then Return 0
    $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $hData, "int", True, "ptr*", 0)
    $hStream = $aResult[3]
    If @error Then Return 0
    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0)
    If @error Then Return 0
    DllCall('oleaut32.dll', 'long', 'DispCallFunc', 'ptr', $hStream, 'ulong_ptr', 8 * (1 + @AutoItX64), 'uint', 4, 'ushort', 23, 'uint', 0, 'ptr', 0, 'ptr', 0, 'str', '')
    Return $aResult[2]
EndFunc   ;==>Load_BMP_From_Mem

_

Advanced example :
Preview :

Yay, it's me.


Xm5u5DQ.jpg


Attachment :

IP Camera.au3

IP Camera.au3 (Previous: 34 downloads)
 
Enjoy, I'm watching U !

Edited by FireFox
  • Like 3

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
future1995man

excellent work,,, but there are here many persons do not understand this technology

Share this post


Link to post
Share on other sites
FireFox

Thank you. I was implementing some improvements (add more than one camera & settings) but I'm busy with another program.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
gcue

Thanks for the awesome script! I have modified it to give the option to toggle between multiple cameras and also display 2 at once! works great - except the second camera has approximately 7 second delay. Any ideas how I can fix that?

Thanks again for the great script!

 

#RequireAdmin
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ComboConstants.au3>
#include <Misc.au3>
#include <ButtonConstants.au3>
#include <Constants.au3>
#include <StaticConstants.au3>
#include <GDIPlus.au3>

Opt("GUIOnEventMode", 1)

Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1 + 2)
TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "_Exit")

TraySetToolTip(StringReplace(@ScriptName, ".exe", ""))

TraySetState(1)

Global $script_name = "Camera"
Global $script_version = $script_name & " v" & FileGetVersion(@ScriptName, "FileVersion")
Global $msg_normal = 262144, $msg_prompt = 262148, $msg_retry = 262150, $msg_error = 262160

Global $x_position, $y_position
Global $toggle_button, $always_on_top

Global Const $STM_SETIMAGE = 0x0172

Global $blGUIMinimized = False

Global $title_A, $camera_selection_A, $default_camera_A
Global $bRecvtmp_A = Binary(""), $bStream_A = $bRecvtmp_A
Global $iImgLen_A = 0, $iStreamLen_A = 0, $iWritten_A = 0, $iEOH_A = 0, $iContLenPos_A = 0, $pBuffer_A = 0
Global Const $iContLengthLen_A = StringLen("Content-Length: ")
Global $sStream_A = "", $sTrim2ContLen_A = ""
Global $hBMP_A = 0, $hHBITMAP2_A = 0, $GUI = 0, $pPic_A = 0, $hPic_A = 0
Global $iSocket_A, $iIPAddress_A, $iPort = 80

Global $title_B, $camera_combo_B, $set_default_button_B, $camera_selection_B, $default_camera_B
Global $bRecvtmp_B = Binary(""), $bStream_B = $bRecvtmp_B
Global $iImgLen_B = 0, $iStreamLen_B = 0, $iWritten_B = 0, $iEOH_B = 0, $iContLenPos_B = 0, $pBuffer_B = 0
Global Const $iContLengthLen_B = StringLen("Content-Length: ")
Global $sStream_B = "", $sTrim2ContLen_B = ""
Global $hBMP_B = 0, $hHBITMAP2_B = 0, $pPic_B = 0, $hPic_B = 0
Global $iSocket_B, $iIPAddress_B

$default_cameras = ReadSettings()

$array = StringSplit($default_cameras, "|")

$default_camera_A = $array[1]
$default_camera_B = $array[2]

If $always_on_top = "True" Then
$GUI = GUICreate($script_version, 320, 310, $x_position, $y_position, $GUI_SS_DEFAULT_GUI, $WS_EX_TOPMOST)
Else
$GUI = GUICreate($script_version, 320, 310, $x_position, $y_position, $GUI_SS_DEFAULT_GUI)
EndIf

$combo_selections = "Room 1|Room 2|Room 3|Room 4"

$camera_combo_A = GUICtrlCreateCombo("", 3, 3, 95, 15, $CBS_DROPDOWNLIST)
GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKSIZE))
GUICtrlSetData(-1, $combo_selections, $default_camera_A)
GUICtrlSetOnEvent(-1, "SetCamera_A")

$set_default_button_A = GUICtrlCreateButton("Set As Default", 3, 25, 95, 15)
GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKSIZE))
GUICtrlSetOnEvent(-1, "SetDefault_A")
GUICtrlSetFont(-1, 7)
GUICtrlSetTip(-1, "Set current camera as default")

$always_on_top_checkbox = GUICtrlCreateCheckbox("Always on Top", 242, 5, 77, 12)
GUICtrlSetResizing(-1, BitOR($GUI_DOCKRIGHT, $GUI_DOCKTOP, $GUI_DOCKSIZE))
GUICtrlSetOnEvent(-1, "SetTopMost")
GUICtrlSetFont(-1, 7)
GUICtrlSetTip(-1, "Set this window to be on top of all other windows")

If $always_on_top = "True" Then
GUICtrlSetState(-1, $GUI_CHECKED)
EndIf

$title_A = GUICtrlCreateLabel("", 0, 50, 320, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKSIZE))
GUICtrlSetBkColor(-1, 0x004E98)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 9, 600)

TCPStartup()

SetCamera_A()

$toggle_button = GUICtrlCreateButton(">>", 297, 30, 20, 15)
GUICtrlSetResizing(-1, BitOR($GUI_DOCKRIGHT, $GUI_DOCKTOP, $GUI_DOCKSIZE))
GUICtrlSetOnEvent(-1, "Toggle_GUI")
GUICtrlSetTip(-1, "Add an additional camera")

$pPic_A = GUICtrlCreatePic("", 0, 70, 320, 240, $SS_BITMAP)
GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKSIZE))
GUICtrlSetState($pPic_A, $GUI_DISABLE)
$hPic_A = GUICtrlGetHandle($pPic_A)

If $default_camera_B <> "NONE" Then
Toggle_GUI()
EndIf

GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND")

GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)

GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

GUISetState()

_GDIPlus_Startup()

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch

;1st camera
$bRecvtmp_A = TCPRecv($iSocket_A, 4096, 1) ;4kb
If @error Then ContinueLoop

If Not BinaryLen($bRecvtmp_A) Then ContinueLoop
$bStream_A &= $bRecvtmp_A

If $iImgLen_A = 0 Then
$sStream_A = BinaryToString($bStream_A)

$iContLenPos_A = StringInStr($sStream_A, "Content-Length: ", 2)
$iEOH_A = StringInStr($sStream_A, @CRLF & @CRLF, 2, 1, $iContLenPos_A)

If $iEOH_A = 0 Or $iContLenPos_A = 0 Then ContinueLoop

$sTrim2ContLen_A = StringTrimLeft($sStream_A, $iContLenPos_A + $iContLengthLen_A - 1)

$iImgLen_A = Number(StringLeft($sTrim2ContLen_A, StringInStr($sTrim2ContLen_A, @CR, 2) - 1))

$bStream_A = BinaryMid($bStream_A, $iEOH_A + 4)
EndIf

If $iImgLen_A = 0 Then ContinueLoop

$iStreamLen_A = BinaryLen($bStream_A)
If $iStreamLen_A < $iImgLen_A Then ContinueLoop

If Not $blGUIMinimized Then
$hBMP_A = Load_BMP_From_Mem($bStream_A)

$hHBITMAP2_A = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBMP_A)

_WinAPI_DeleteObject(_SendMessage($hPic_A, $STM_SETIMAGE, 0, $hHBITMAP2_A))

_GDIPlus_ImageDispose($hBMP_A)
_WinAPI_DeleteObject($hHBITMAP2_A)
EndIf

$iImgLen_A = 0

;2nd camera
$bRecvtmp_B = TCPRecv($iSocket_B, 4096, 1) ;4kb
If @error Then ContinueLoop

If Not BinaryLen($bRecvtmp_ B) Then ContinueLoop
$bStream_B &= $bRecvtmp_B

If $iImgLen_B = 0 Then
$sStream_B = BinaryToString($bStream_ B)

$iContLenPos_B = StringInStr($sStream_B, "Content-Length: ", 2)
$iEOH_B = StringInStr($sStream_B, @CRLF & @CRLF, 2, 1, $iContLenPos_ B)

If $iEOH_B = 0 Or $iContLenPos_B = 0 Then ContinueLoop

$sTrim2ContLen_B = StringTrimLeft($sStream_B, $iContLenPos_B + $iContLengthLen_B - 1)

$iImgLen_B = Number(StringLeft($sTrim2ContLen_B, StringInStr($sTrim2ContLen_B, @CR, 2) - 1))

$bStream_B = BinaryMid($bStream_B, $iEOH_B + 4)
EndIf

If $iImgLen_B = 0 Then ContinueLoop

$iStreamLen_B = BinaryLen($bStream_ B)
If $iStreamLen_B < $iImgLen_B Then ContinueLoop

If Not $blGUIMinimized Then
$hBMP_B = Load_BMP_From_Mem($bStream_ B)

$hHBITMAP2_B = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBMP_ B)

_WinAPI_DeleteObject(_SendMessage($hPic_B, $STM_SETIMAGE, 0, $hHBITMAP2_ B))

_GDIPlus_ImageDispose($hBMP_ B)
_WinAPI_DeleteObject($hHBITMAP2_ B)
EndIf

$iImgLen_B = 0
WEnd

Func Toggle_GUI()

$window_position = WinGetPos($GUI)

$window_x_position = $window_position[0]
$window_y_position = $window_position[1]
$window_width = $window_position[2]
$window_height = $window_position[3]

If $window_width = 326 Then
$camera_selection_A = GUICtrlRead($camera_combo_A)

If $camera_selection_A = "" Then
MsgBox($msg_error, $script_name, "Please select a primary view camera first.")
Return
EndIf

GUICtrlSetData($toggle_button, "<<")

WinMove($GUI, "", $window_x_position, $window_y_position, 646, $window_height)

$camera_combo_B = GUICtrlCreateCombo("", 320, 3, 95, 15, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, $combo_selections, $default_camera_ B)
GUICtrlSetOnEvent(-1, "SetCamera_B")

$set_default_button_B = GUICtrlCreateButton("Set As Default", 320, 25, 95, 15)
GUICtrlSetOnEvent(-1, "SetDefault_B")
GUICtrlSetFont(-1, 7)
GUICtrlSetTip(-1, "Set current camera as default")

$title_B = GUICtrlCreateLabel("", 320, 50, 320, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetBkColor(-1, 0x004E98)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 9, 600)

$pPic_B = GUICtrlCreatePic("", 320, 70, 320, 240, $SS_BITMAP)
GUICtrlSetResizing(-1, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKSIZE))
GUICtrlSetState($pPic_B, $GUI_DISABLE)
$hPic_B = GUICtrlGetHandle($pPic_ B)

SetCamera_B()
EndIf

If $window_width = 646 Then
GUICtrlSetData($toggle_button, ">>")

WinMove($GUI, "", $window_x_position, $window_y_position, 326, $window_height)

GUICtrlDelete($camera_combo_ B)
GUICtrlDelete($set_default_button_ B)
GUICtrlDelete($title_ B)
GUICtrlDelete($pPic_ B)

RegRead("HKLM\Software\Camera", "Default_B")

If Not @error Then
$prompt = MsgBox($msg_prompt, $script_name, "Remove 2nd camera default?")

If $prompt = 6 Then
RegDelete("HKLM\Software\Camera", "Default_B")

$default_camera_B = ""
EndIf
EndIf
EndIf

EndFunc ;==>Toggle_GUI

Func ReadSettings()

$ExtendedWidth = _WinAPI_GetSystemMetrics(78)
$ExtendedHeight = _WinAPI_GetSystemMetrics(79)

$always_on_top = RegRead("HKLM\Software\Camera", "TopMost")
$default_camera_A = RegRead("HKLM\Software\Camera", "Default_A")

If @error Then
$default_camera_A = RegRead("HKLM\Software\Camera", "Default")
If @error Then
$default_camera_A = "NONE"
Else
RegDelete("HKLM\Software\Camera", "Default")
RegWrite("HKLM\Software\Camera", "Default_A", "REG_SZ", $default_camera_A)
EndIf
EndIf

$default_camera_B = RegRead("HKLM\Software\Camera", "Default_B")

If @error Then
$default_camera_B = "NONE"
EndIf

$x_position = RegRead("HKLM\Software\Camera", "X_Position")

If $x_position = "" Then
$x_position = "0"
EndIf

If $x_position < 0 Then
$x_position = "0"
EndIf

If $x_position > $ExtendedWidth - 150 Then
$x_position = "0"
EndIf

$y_position = RegRead("HKLM\Software\Camera", "Y_Position")

If $y_position = "" Then
$y_position = "0"
EndIf

If $y_position > 800 Then
$y_position = "0"
EndIf

If @DesktopHeight = $ExtendedHeight Then
If $y_position < 0 Then
$y_position = "0"
EndIf
EndIf

If @DesktopHeight <> $ExtendedHeight Then
$y_topmost_coordinate = @DesktopHeight - $ExtendedHeight
If $y_position < $y_topmost_coordinate Then
$y_position = $y_topmost_coordinate
EndIf
EndIf

Return $default_camera_A & "|" & $default_camera_B

EndFunc ;==>ReadSettings

Func SetTopMost()

If BitAND(GUICtrlRead($always_on_top_checkbox), $GUI_CHECKED) Then
$topmost = True
WinSetOnTop($script_version, "", 1)
EndIf

If BitAND(GUICtrlRead($always_on_top_checkbox), $GUI_UNCHECKED) Then
$topmost = False
WinSetOnTop($script_version, "", 0)
EndIf

RegWrite("HKLM\Software\Camera", "TopMost", "REG_SZ", $topmost)

EndFunc ;==>SetTopMost

Func SetDefault_A()

$default_camera_A = GUICtrlRead($camera_combo_A)

If $default_camera_A = "" Then
MsgBox($msg_error, $script_name, "Please make a selection first.")
Return
EndIf

RegWrite("HKLM\Software\Camera", "Default_A", "REG_SZ", $default_camera_A)

MsgBox(262144, $script_version, $default_camera_A & " has been set as default.")

EndFunc ;==>SetDefault_A

Func SetDefault_B()

$default_camera_B = GUICtrlRead($camera_combo_ B)

If $default_camera_B = "" Then
MsgBox($msg_error, $script_name, "Please make a selection first.")
Return
EndIf

RegWrite("HKLM\Software\Camera", "Default_B", "REG_SZ", $default_camera_ B)

MsgBox(262144, $script_version, $default_camera_B & " has been set as default.")

EndFunc ;==>SetDefault_B

Func SetPosition()

$position_array = WinGetPos($script_version, "")

$x_position = $position_array[0]
$y_position = $position_array[1]

RegWrite("HKLM\Software\Camera", "X_Position", "REG_SZ", $x_position)
RegWrite("HKLM\Software\Camera", "Y_Position", "REG_SZ", $y_position)

EndFunc ;==>SetPosition

Func SetCamera_A()

$camera_selection_A = GUICtrlRead($camera_combo_A)

If $camera_selection_A = "" Then
MsgBox($msg_normal, $script_name, "Please select a camera from the dropdown and Set As Default.")
Return
EndIf

Select
Case $camera_selection_A = "Room 1"
$iIPAddress_A = "192.168.1.20"
Case $camera_selection_A = "Room 2"
$iIPAddress_A = "192.168.1.30"
Case $camera_selection_A = "Room 3"
$iIPAddress_A = "192.168.1.40"
Case $camera_selection_A = "Room 4"
$iIPAddress_A = "192.168.1.50"
EndSelect

$iSocket_A = TCPConnect($iIPAddress_A, $iPort)
If @error Then
MsgBox($msg_error, $script_name, "Could not connect to " & $camera_selection_A)
Return
EndIf

$shtauth = "cm9vdDpjYXBpdGFs" ;base64 - root:capital

TCPSend($iSocket_A, _
"GET /-wvhttp-01-/GetOneShot?image_size=320x240&frame_count=0 HTTP/1.1" & @CRLF & _
"Host: " & $iIPAddress_A & ":" & $iPort & @CRLF & _
"Connection: keep-alive" & @CRLF & _
"Authorization: Basic " & $shtauth & @CRLF & @CRLF)

GUICtrlSetData($title_A, $camera_selection_A)

EndFunc ;==>SetCamera_A

Func SetCamera_B()

$camera_selection_B = GUICtrlRead($camera_combo_ B)

If $camera_selection_B = "" Then
Return
EndIf

Select
Case $camera_selection_B = "Room 1"
$iIPAddress_B = "192.168.1.20"
Case $camera_selection_B = "Room 2"
$iIPAddress_B = "192.168.1.30"
Case $camera_selection_B = "Room 3"
$iIPAddress_B = "192.168.1.40"
Case $camera_selection_B = "Room 4"
$iIPAddress_B = "192.168.1.50"
EndSelect

$iSocket_B = TCPConnect($iIPAddress_B, $iPort)
If @error Then
MsgBox($msg_error, $script_name, "Could not connect to " & $camera_selection_ B)
Return
EndIf

$shtauth = "cm9vdDpjYXBpdGFs" ;base64 - root:capital

TCPSend($iSocket_B, _
"GET /-wvhttp-01-/GetOneShot?image_size=320x240&frame_count=0 HTTP/1.1" & @CRLF & _
"Host: " & $iIPAddress_B & ":" & $iPort & @CRLF & _
"Connection: keep-alive" & @CRLF & _
"Authorization: Basic " & $shtauth & @CRLF & @CRLF)

GUICtrlSetData($title_B, $camera_selection_ B)

EndFunc ;==>SetCamera_B

Func Debug($variable1 = "", $variable2 = "", $variable3 = "")

If IsArray($variable1) Then
_ArrayDisplay($variable1)
Else
If $variable2 <> "" Then
$variable1 &= @CRLF & $variable2
EndIf

If $variable3 <> "" Then
$variable1 &= @CRLF & $variable3
EndIf

ClipPut($variable1)
MsgBox($msg_normal, "Debug", $variable1)
EndIf

EndFunc ;==>Debug

Func WM_SYSCOMMAND($hWnd, $iMsg, $wParam, $lParam)
Local Const $SC_MINIMIZE = 0xF020, $SC_RESTORE = 0xF120

Switch BitAND($wParam, 0xFFF0)
Case $SC_MINIMIZE, $SC_RESTORE
$blGUIMinimized = Not $blGUIMinimized
EndSwitch

Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SYSCOMMAND

Func Load_BMP_From_Mem($mem_image)
;author: UEZ
;Additional Code: thanks to progandy for the MemGlobalAlloc and tVARIANT lines
If Not IsBinary($mem_image) Then Return SetError(1, 0, 0)

Local Const $memBitmap = Binary($mem_image)
Local Const $len = BinaryLen($memBitmap)
Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE)
Local Const $pData = _MemGlobalLock($hData)
Local $tMem = DllStructCreate("byte[" & $len & "]", $pData)

DllStructSetData($tMem, 1, $memBitmap)
_MemGlobalUnlock($hData)

Local $hStream = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0)
$hStream = $hStream[3]

Local $hBitmap = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0)
$hBitmap = $hBitmap[2]
Local Const $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data; ptr")
DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hStream, "dword", 8 + 8 * @AutoItX64, _
"dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT))
$tMem = 0
Return $hBitmap
EndFunc ;==>Load_BMP_From_Mem

Func _Exit()
TCPCloseSocket($iSocket_A)
TCPCloseSocket($iSocket_ B)
TCPShutdown()
SetPosition()
Exit
EndFunc ;==>_Exit
Edited by gcue

Share this post


Link to post
Share on other sites
FireFox

I will take a look at it when I will have the time to test it in real conditions.

I might have told you (this means maybe nothing in english...) I created a script to display up to 4 cameras, however I was too lazy to finish it BUT I have to, so someday I will post it.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
gcue

nice! and no delay between any of them?

id appreciate any help =)

thanks again for the cool script 8)

Share this post


Link to post
Share on other sites
FireFox

nice! and no delay between any of them?

I don't know. But I'm sure there won't be any delay :P

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
gcue

hmm seems also my script is crashing a bunch intermittently - while idle! - o nooo

Share this post


Link to post
Share on other sites
gcue

i think it might have to do with these lines in the while loop....

$bRecvtmp_A = TCPRecv($iSocket_A, 4096, 1) ;4kb
If @error Then ContinueLoop

$bRecvtmp_B = TCPRecv($iSocket_B, 4096, 1) ;4kb
If @error Then ContinueLoop

The original code does an exitloop instead of continueloop but exitloop exits the script gracefully. continueloop crashes it.

This seems to be the issue not sure yet tho

Share this post


Link to post
Share on other sites
FireFox

It's wrong indeed.

 

If nothing is received on the socket A, all the script of for the camera B will be paused.

;Instead of
...
If Not BinaryLen($bRecvtmp_A) Then ContinueLoop
$bStream_A &= $bRecvtmp_A
...
 
;do
...
If BinaryLen($bRecvtmp_A) > 0 Then
    $bStream_A &= $bRecvtmp_A
    ;process camera A
    ...
EndIf
 
;socket B + process camera B
Br, FireFox. Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
gcue

cool - i wrapped the IF statement around the entire processing of camera_A (in the while loop)

does this look like it will fix the crashes?

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch

;1st camera
$bRecvtmp_A = TCPRecv($iSocket_A, 4096, 1) ;4kb
If @error Then ContinueLoop

If BinaryLen($bRecvtmp_A) > 0 Then
$bStream_A &= $bRecvtmp_A

If $iImgLen_A = 0 Then
$sStream_A = BinaryToString($bStream_A)

$iContLenPos_A = StringInStr($sStream_A, "Content-Length: ", 2)
$iEOH_A = StringInStr($sStream_A, @CRLF & @CRLF, 2, 1, $iContLenPos_A)

If $iEOH_A = 0 Or $iContLenPos_A = 0 Then ContinueLoop

$sTrim2ContLen_A = StringTrimLeft($sStream_A, $iContLenPos_A + $iContLengthLen_A - 1)

$iImgLen_A = Number(StringLeft($sTrim2ContLen_A, StringInStr($sTrim2ContLen_A, @CR, 2) - 1))

$bStream_A = BinaryMid($bStream_A, $iEOH_A + 4)
EndIf

If $iImgLen_A = 0 Then ContinueLoop

$iStreamLen_A = BinaryLen($bStream_A)
If $iStreamLen_A < $iImgLen_A Then ContinueLoop

If Not $blGUIMinimized Then
$hBMP_A = Load_BMP_From_Mem($bStream_A)

$hHBITMAP2_A = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBMP_A)

_WinAPI_DeleteObject(_SendMessage($hPic_A, $STM_SETIMAGE, 0, $hHBITMAP2_A))

_GDIPlus_ImageDispose($hBMP_A)
_WinAPI_DeleteObject($hHBITMAP2_A)
EndIf

$iImgLen_A = 0
EndIf

;2nd camera
$bRecvtmp_B = TCPRecv($iSocket_B, 4096, 1) ;4kb
If @error Then ContinueLoop

If Not BinaryLen($bRecvtmp_ B) Then ContinueLoop
$bStream_B &= $bRecvtmp_B

If $iImgLen_B = 0 Then
$sStream_B = BinaryToString($bStream_ B)

$iContLenPos_B = StringInStr($sStream_B, "Content-Length: ", 2)
$iEOH_B = StringInStr($sStream_B, @CRLF & @CRLF, 2, 1, $iContLenPos_ B)

If $iEOH_B = 0 Or $iContLenPos_B = 0 Then ContinueLoop

$sTrim2ContLen_B = StringTrimLeft($sStream_B, $iContLenPos_B + $iContLengthLen_B - 1)

$iImgLen_B = Number(StringLeft($sTrim2ContLen_B, StringInStr($sTrim2ContLen_B, @CR, 2) - 1))

$bStream_B = BinaryMid($bStream_B, $iEOH_B + 4)
EndIf

If $iImgLen_B = 0 Then ContinueLoop

$iStreamLen_B = BinaryLen($bStream_ B)
If $iStreamLen_B < $iImgLen_B Then ContinueLoop

If Not $blGUIMinimized Then
$hBMP_B = Load_BMP_From_Mem($bStream_ B)

$hHBITMAP2_B = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBMP_ B)

_WinAPI_DeleteObject(_SendMessage($hPic_B, $STM_SETIMAGE, 0, $hHBITMAP2_ B))

_GDIPlus_ImageDispose($hBMP_ B)
_WinAPI_DeleteObject($hHBITMAP2_ B)
EndIf

$iImgLen_B = 0
WEnd

Share this post


Link to post
Share on other sites
gcue

looks like it got rid of the delay i mentioned earlier!

=)

Edited by gcue
  • Like 1

Share this post


Link to post
Share on other sites
gcue

did i wrap the if statement correctly?

does it seem like it will fix the crashes?

thanks again for your help firefox!

Share this post


Link to post
Share on other sites
gcue

hmm still crashed after an hour or so =/

Share this post


Link to post
Share on other sites
FireFox

did i wrap the if statement correctly?

does it seem like it will fix the crashes?

I will take a look at it later.

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
gcue

wasnt sure if you meant i should also make the same change to camera_B

testing it now to see if it crashes...

sorry to be a bother with this - i have a bunch of users using this and its crashing for all of them - *sigh*

thanks soooo much for your help!!!

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch

;1st camera
$bRecvtmp_A = TCPRecv($iSocket_A, 4096, 1) ;4kb
If @error Then ContinueLoop

If BinaryLen($bRecvtmp_A) > 0 Then
$bStream_A &= $bRecvtmp_A

If $iImgLen_A = 0 Then
$sStream_A = BinaryToString($bStream_A)

$iContLenPos_A = StringInStr($sStream_A, "Content-Length: ", 2)
$iEOH_A = StringInStr($sStream_A, @CRLF & @CRLF, 2, 1, $iContLenPos_A)

If $iEOH_A = 0 Or $iContLenPos_A = 0 Then ContinueLoop

$sTrim2ContLen_A = StringTrimLeft($sStream_A, $iContLenPos_A + $iContLengthLen_A - 1)

$iImgLen_A = Number(StringLeft($sTrim2ContLen_A, StringInStr($sTrim2ContLen_A, @CR, 2) - 1))

$bStream_A = BinaryMid($bStream_A, $iEOH_A + 4)
EndIf

If $iImgLen_A = 0 Then ContinueLoop

$iStreamLen_A = BinaryLen($bStream_A)
If $iStreamLen_A < $iImgLen_A Then ContinueLoop

If Not $blGUIMinimized Then
$hBMP_A = Load_BMP_From_Mem($bStream_A)

$hHBITMAP2_A = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBMP_A)

_WinAPI_DeleteObject(_SendMessage($hPic_A, $STM_SETIMAGE, 0, $hHBITMAP2_A))

_GDIPlus_ImageDispose($hBMP_A)
_WinAPI_DeleteObject($hHBITMAP2_A)
EndIf

$iImgLen_A = 0
EndIf

;2nd camera
$bRecvtmp_B = TCPRecv($iSocket_B, 4096, 1) ;4kb
If @error Then ContinueLoop

If BinaryLen($bRecvtmp_ B) > 0 Then
$bStream_B &= $bRecvtmp_B

If $iImgLen_B = 0 Then
$sStream_B = BinaryToString($bStream_ B)

$iContLenPos_B = StringInStr($sStream_B, "Content-Length: ", 2)
$iEOH_B = StringInStr($sStream_B, @CRLF & @CRLF, 2, 1, $iContLenPos_ B)

If $iEOH_B = 0 Or $iContLenPos_B = 0 Then ContinueLoop

$sTrim2ContLen_B = StringTrimLeft($sStream_B, $iContLenPos_B + $iContLengthLen_B - 1)

$iImgLen_B = Number(StringLeft($sTrim2ContLen_B, StringInStr($sTrim2ContLen_B, @CR, 2) - 1))

$bStream_B = BinaryMid($bStream_B, $iEOH_B + 4)
EndIf

If $iImgLen_B = 0 Then ContinueLoop

$iStreamLen_B = BinaryLen($bStream_ B)
If $iStreamLen_B < $iImgLen_B Then ContinueLoop

If Not $blGUIMinimized Then
$hBMP_B = Load_BMP_From_Mem($bStream_ B)

$hHBITMAP2_B = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBMP_ B)

_WinAPI_DeleteObject(_SendMessage($hPic_B, $STM_SETIMAGE, 0, $hHBITMAP2_ B))

_GDIPlus_ImageDispose($hBMP_ B)
_WinAPI_DeleteObject($hHBITMAP2_ B)
EndIf

$iImgLen_B = 0
EndIf
WEnd

Share this post


Link to post
Share on other sites
FireFox

Bumping the thread won't make me look at the problem earlier that I can.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
gcue

actually i didnt mean to bump it just letting you know what im trying and what worked/didnt work

sorry if you thought the latter.

:-/

Share this post


Link to post
Share on other sites
FireFox

I haven't tested it, but try this loop:

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
 
    ;1st camera
    $bRecvtmp_A = TCPRecv($iSocket_A, 4096, 1) ;4kb
 
    If @error = 0 And BinaryLen($bRecvtmp_A) > 0 Then
        $bStream_A &= $bRecvtmp_A
 
        If $iImgLen_A = 0 Then
            $sStream_A = BinaryToString($bStream_A)
 
            $iContLenPos_A = StringInStr($sStream_A, "Content-Length: ", 2)
            $iEOH_A = StringInStr($sStream_A, @CRLF & @CRLF, 2, 1, $iContLenPos_A)
 
            If $iEOH_A > 0 And $iContLenPos_A > 0 Then
                $sTrim2ContLen_A = StringTrimLeft($sStream_A, $iContLenPos_A + $iContLengthLen_A - 1)
 
                $iImgLen_A = Number(StringLeft($sTrim2ContLen_A, StringInStr($sTrim2ContLen_A, @CR, 2) - 1))
 
                $bStream_A = BinaryMid($bStream_A, $iEOH_A + 4)
            EndIf
        EndIf
 
        If $iImgLen_A > 0 Then
            $iStreamLen_A = BinaryLen($bStream_A)
            If $iStreamLen_A >= $iImgLen_A Then
                If Not $blGUIMinimized Then
                    $hBMP_A = Load_BMP_From_Mem($bStream_A)
 
                    $hHBITMAP2_A = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBMP_A)
 
                    _WinAPI_DeleteObject(_SendMessage($hPic_A, $STM_SETIMAGE, 0, $hHBITMAP2_A))
 
                    _GDIPlus_ImageDispose($hBMP_A)
                    _WinAPI_DeleteObject($hHBITMAP2_A)
                EndIf
 
                $iImgLen_A = 0
            EndIf
        EndIf
    EndIf
 
    ;2nd camera
    $bRecvtmp_B = TCPRecv($iSocket_B, 4096, 1) ;4kb
 
    If @error = 0 And BinaryLen($bRecvtmp_B) > 0 Then
        $bStream_B &= $bRecvtmp_B
 
        If $iImgLen_B = 0 Then
            $sStream_B = BinaryToString($bStream_B)
 
            $iContLenPos_B = StringInStr($sStream_B, "Content-Length: ", 2)
            $iEOH_B = StringInStr($sStream_B, @CRLF & @CRLF, 2, 1, $iContLenPos_B)
 
            If $iEOH_B > 0 And $iContLenPos_B > 0 Then
                $sTrim2ContLen_B = StringTrimLeft($sStream_B, $iContLenPos_B + $iContLengthLen_B - 1)
 
                $iImgLen_B = Number(StringLeft($sTrim2ContLen_B, StringInStr($sTrim2ContLen_B, @CR, 2) - 1))
 
                $bStream_B = BinaryMid($bStream_B, $iEOH_B + 4)
            EndIf
        EndIf
 
        If $iImgLen_B > 0 Then
            $iStreamLen_B = BinaryLen($bStream_B)
            If $iStreamLen_B >= $iImgLen_B Then
                If Not $blGUIMinimized Then
                    $hBMP_B = Load_BMP_From_Mem($bStream_B)
 
                    $hHBITMAP2_B = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBMP_B)
 
                    _WinAPI_DeleteObject(_SendMessage($hPic_B, $STM_SETIMAGE, 0, $hHBITMAP2_B))
 
                    _GDIPlus_ImageDispose($hBMP_B)
                    _WinAPI_DeleteObject($hHBITMAP2_B)
                EndIf
 
                $iImgLen_B = 0
            EndIf
        EndIf
    EndIf
WEnd
Br, FireFox.

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

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

  • Similar Content

    • ur
      By ur
      I have an aws cloud machine where I kept all the build process to create some set of zip files and uploading them to OneDrive.
      Once it is completed, I have another local machine in our environment which is a acting as a local share server also.
      Is there anyway to notify this machine(without public IP) to start downloading these files.
      I have written an AutoIT exe to download these files and copy them to respective locations.But don't know how to notify this from the remote machine.
       
      Any suggestion??
       
    • Piotr_Hodl
      By Piotr_Hodl
      Hi guys,
       
      My post is more architecture related than the actual autoit script.
      Currently I have a java tool that makes a connection to a azure Windows VM using WINRM.
      Then I "grep" the session ID of RDP and using psexec I execute my autoit script on the session ID of the RDP (This assumes that I need to have already a RDP connection established).
      The script runs perfectly when I have a RDP session maximized/opened. If I minimize the RDP window some commands do not work, as for example the Send command.
      I do understand that it has to do with the window not being active, even though the script is executed remotely.
      https://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F
       
      My goal is to be able to run the autoit scripts with no limitations, like I was running in my local machine.
       
      One important thing, all the flow is being triggered from a linux machine with no GUI. So that is why, I am using a jar file to start the winrm connection.
       
      So to sum up:
      starting server: centos with no GUI
      remote server: azure win 10
      goal: from starting server, launch autoit script that is on remote server
       
      Thanks
      Piotr
       
       
       
    • ur
      By ur
      With  ProcessList ( ["name"] )  we are able to get the running process list from the local machine.
       
      Is there anyway to get the list from Remote machine, more precisely to get to know the status whether a particular application is running or not on remote machine using AutoIT?
       
      We can implement through PSList.exe, but again we need to parse the text of it to read the output.
      Is there any direct UDF in AutoIT?
    • hugomito
      By hugomito
      Hi all,
      I hope you can help me with this need. In the company I work for, every time we need to deploy a change into a Production environment, we need to add a SharePoint entry in a Calendar area. This is in order to notify Operations team that a change will be introduced on a specific date.
      The fields we need to fill out are:
      ows_Project ows_ChangeReq ows_Description ows_StartDate ows_EndDate The thing is that, I have all these values available in an AutoIT application I built called EAI Tool so, what I need is: Whenever a user click a button, a SharePoint record should be created populating SharePoint fields with the values from EAI Tool applicacion.
      If you need additional information, let me know.
      Regards,
    • kingjacob90
      By kingjacob90
      Hi
      I am trying to send a file over TCP from a TCP client to server. If I run the server and client on the same computer the file is send fine, but if the server is on one computer on the network and the client on another the file is sent in what looks like more than one packet. In other words the server receives 4 msg from the client.
      Why is this, how do I make it send in one go, or what is a way around it?
      Side Note: TCP server has a max of 999999999
×