Jump to content

SYRAU3

Active Members
  • Posts

    97
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

SYRAU3's Achievements

Wayfarer

Wayfarer (2/7)

0

Reputation

  1. can you please give me a help Mr.UEZ ? I updated the code but i really don't know how to replace the $hHBITMAP = _ScreenCapture_Capture("",0,0,200,200) with my $snapfile, i tried _GDIPlus_BitmapCreateFromFile but it didn't work, any help please? Broadcaster: #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: SYRAU3 #ce ---------------------------------------------------------------------------- #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Memory.au3> $WM_CAP_START = 0x400 $WM_CAP_UNICODE_START = $WM_CAP_START + 100 $WM_CAP_PAL_SAVEA = $WM_CAP_START + 81 $WM_CAP_PAL_SAVEW = $WM_CAP_UNICODE_START + 81 $WM_CAP_UNICODE_END = $WM_CAP_PAL_SAVEW $WM_CAP_ABORT = $WM_CAP_START + 69 $WM_CAP_DLG_VIDEOCOMPRESSION = $WM_CAP_START + 46 $WM_CAP_DLG_VIDEODISPLAY = $WM_CAP_START + 43 $WM_CAP_DLG_VIDEOFORMAT = $WM_CAP_START + 41 $WM_CAP_DLG_VIDEOSOURCE = $WM_CAP_START + 42 $WM_CAP_DRIVER_CONNECT = $WM_CAP_START + 10 $WM_CAP_DRIVER_DISCONNECT = $WM_CAP_START + 11 $WM_CAP_DRIVER_GET_CAPS = $WM_CAP_START + 14 $WM_CAP_DRIVER_GET_NAMEA = $WM_CAP_START + 12 $WM_CAP_DRIVER_GET_NAMEW = $WM_CAP_UNICODE_START + 12 $WM_CAP_DRIVER_GET_VERSIONA = $WM_CAP_START + 13 $WM_CAP_DRIVER_GET_VERSIONW = $WM_CAP_UNICODE_START + 13 $WM_CAP_EDIT_COPY = $WM_CAP_START + 30 $WM_CAP_END = $WM_CAP_UNICODE_END $WM_CAP_FILE_ALLOCATE = $WM_CAP_START + 22 $WM_CAP_FILE_GET_CAPTURE_FILEA = $WM_CAP_START + 21 $WM_CAP_FILE_GET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 21 $WM_CAP_FILE_SAVEASA = $WM_CAP_START + 23 $WM_CAP_FILE_SAVEASW = $WM_CAP_UNICODE_START + 23 $WM_CAP_FILE_SAVEDIBA = $WM_CAP_START + 25 $WM_CAP_FILE_SAVEDIBW = $WM_CAP_UNICODE_START + 25 $WM_CAP_FILE_SET_CAPTURE_FILEA = $WM_CAP_START + 20 $WM_CAP_FILE_SET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 20 $WM_CAP_FILE_SET_INFOCHUNK = $WM_CAP_START + 24 $WM_CAP_GET_AUDIOFORMAT = $WM_CAP_START + 36 $WM_CAP_GET_CAPSTREAMPTR = $WM_CAP_START + 1 $WM_CAP_GET_MCI_DEVICEA = $WM_CAP_START + 67 $WM_CAP_GET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 67 $WM_CAP_GET_SEQUENCE_SETUP = $WM_CAP_START + 65 $WM_CAP_GET_STATUS = $WM_CAP_START + 54 $WM_CAP_GET_USER_DATA = $WM_CAP_START + 8 $WM_CAP_GET_VIDEOFORMAT = $WM_CAP_START + 44 $WM_CAP_GRAB_FRAME = $WM_CAP_START + 60 $WM_CAP_GRAB_FRAME_NOSTOP = $WM_CAP_START + 61 $WM_CAP_PAL_AUTOCREATE = $WM_CAP_START + 83 $WM_CAP_PAL_MANUALCREATE = $WM_CAP_START + 84 $WM_CAP_PAL_OPENA = $WM_CAP_START + 80 $WM_CAP_PAL_OPENW = $WM_CAP_UNICODE_START + 80 $WM_CAP_PAL_PASTE = $WM_CAP_START + 82 $WM_CAP_SEQUENCE = $WM_CAP_START + 62 $WM_CAP_SEQUENCE_NOFILE = $WM_CAP_START + 63 $WM_CAP_SET_AUDIOFORMAT = $WM_CAP_START + 35 $WM_CAP_SET_CALLBACK_CAPCONTROL = $WM_CAP_START + 85 $WM_CAP_SET_CALLBACK_ERRORA = $WM_CAP_START + 2 $WM_CAP_SET_CALLBACK_ERRORW = $WM_CAP_UNICODE_START + 2 $WM_CAP_SET_CALLBACK_FRAME = $WM_CAP_START + 5 $WM_CAP_SET_CALLBACK_STATUSA = $WM_CAP_START + 3 $WM_CAP_SET_CALLBACK_STATUSW = $WM_CAP_UNICODE_START + 3 $WM_CAP_SET_CALLBACK_VIDEOSTREAM = $WM_CAP_START + 6 $WM_CAP_SET_CALLBACK_WAVESTREAM = $WM_CAP_START + 7 $WM_CAP_SET_CALLBACK_YIELD = $WM_CAP_START + 4 $WM_CAP_SET_MCI_DEVICEA = $WM_CAP_START + 66 $WM_CAP_SET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 66 $WM_CAP_SET_OVERLAY = $WM_CAP_START + 51 $WM_CAP_SET_PREVIEW = $WM_CAP_START + 50 $WM_CAP_SET_PREVIEWRATE = $WM_CAP_START + 52 $WM_CAP_SET_SCALE = $WM_CAP_START + 53 $WM_CAP_SET_SCROLL = $WM_CAP_START + 55 $WM_CAP_SET_SEQUENCE_SETUP = $WM_CAP_START + 64 $WM_CAP_SET_USER_DATA = $WM_CAP_START + 9 $WM_CAP_SET_VIDEOFORMAT = $WM_CAP_START + 45 $WM_CAP_SINGLE_FRAME = $WM_CAP_START + 72 $WM_CAP_SINGLE_FRAME_CLOSE = $WM_CAP_START + 71 $WM_CAP_SINGLE_FRAME_OPEN = $WM_CAP_START + 70 $WM_CAP_STOP = $WM_CAP_START + 68 #include $avi = DllOpen("avicap32.dll") $user = DllOpen("user32.dll") $snapfile = @ScriptDir & "scrshot.bmp" $Main = GUICreate("Camera", 350, 270) $cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD, $WS_VISIBLE), "int", 15, "int", 15, "int", 320, "int", 240, "hwnd", $Main, "int", 1) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_SCALE, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_OVERLAY, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEW, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 0) GUISetState(@SW_SHOW) HotKeySet("{TAB}", "SnapShot") HotKeySet("{ALT}", "Refresh") OnAutoItExitRegister("ExitFunc") Local $szIPADDRESS = @IPAddress1 Local $nPORT = 6965 TCPStartup() $ConnectedSocket = -1 $ConnectedSocket = TCPConnect($szIPADDRESS, $nPORT) _GDIPlus_Startup() While 1 SnapShot() $hHBITMAP = $snapfile $bImage = HBITMAP2BinaryString($hHBITMAP) ConsoleWrite(TCPSend($ConnectedSocket, Binary($bImage)) & @LF) _WinAPI_DeleteObject($hHBITMAP) Sleep(10) If GUIGetMsg() = -3 Then ExitFunc() WEnd Func SnapShot() DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_GRAB_FRAME_NOSTOP, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_FILE_SAVEDIBA, "int", 0, "str", $snapfile) EndFunc ;==>SnapShot Func HBITMAP2BinaryString($HBITMAP) ;function by Andreik Local $BITMAP = _GDIPlus_BitmapCreateFromHBITMAP($HBITMAP) Local $JPG_ENCODER = _GDIPlus_EncodersGetCLSID("jpg") Local $TAG_ENCODER = _WinAPI_GUIDFromString($JPG_ENCODER) Local $PTR_ENCODER = DllStructGetPtr($TAG_ENCODER) Local $STREAM = DllCall("ole32.dll", "uint", "CreateStreamOnHGlobal", "ptr", 0, "bool", 1, "ptr*", 0) DllCall($ghGDIPDll, "uint", "GdipSaveImageToStream", "ptr", $BITMAP, "ptr", $STREAM[3], "ptr", $PTR_ENCODER, "ptr", 0) _GDIPlus_BitmapDispose($BITMAP) Local $MEMORY = DllCall("ole32.dll", "uint", "GetHGlobalFromStream", "ptr", $STREAM[3], "ptr*", 0) Local $MEM_SIZE = _MemGlobalSize($MEMORY[2]) Local $MEM_PTR = _MemGlobalLock($MEMORY[2]) Local $DATA_STRUCT = DllStructCreate("byte[" & $MEM_SIZE & "]", $MEM_PTR) Local $DATA = DllStructGetData($DATA_STRUCT, 1) Local $tVARIANT = DllStructCreate("word vt;word r1;word r2;word r3;ptr data;ptr") Local $aCall = DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $STREAM[3], "dword", 8 + 8 * @AutoItX64, "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tVARIANT)) _MemGlobalFree($MEMORY[2]) Return $DATA EndFunc ;==>HBITMAP2BinaryString Func Refresh() DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 0) EndFunc ;==>Refresh Func ExitFunc() Local $hHBITMAP _GDIPlus_ImageDispose($hHBITMAP) _WinAPI_DeleteObject($hHBITMAP) _GDIPlus_Shutdown() DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_END, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_DISCONNECT, "int", 0, "int", 0) DllClose($user) FileDelete($snapfile) Exit EndFunc ;==>ExitFunc Receiver: #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: SYRAU3 #ce ---------------------------------------------------------------------------- #include <GDIPlus.au3> #include <Memory.au3> Local $szIPADDRESS = @IPAddress1 Local $nPORT = 6965 Global Const $IMAGE_BITMAP = 0 Global Const $STM_SETIMAGE = 0x0172 TraySetIcon("Shell32.dll", 246) TCPStartup() $MainSocket = TCPListen($szIPADDRESS, $nPORT) If $MainSocket = -1 Then Exit $ConnectedSocket = -1 OnAutoItExitRegister("ExitFunc") _GDIPlus_Startup() Local $hWnd = GUICreate("IN MEMORY OF MY LOVE B.S - tinyHacker :)", 400, 300) $idPic = GUICtrlCreatePic("", 0, 0, 400, 300) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd) ;~ GUICtrlCreateLabel("NO SIGNAL", 15, 16, 371, 81) ;~ GUICtrlSetFont(-1, 48, 800, 0, "Tahoma") ;~ GUICtrlSetColor(-1, 0xFF0000) ;~ GUICtrlCreateLabel("Created by: tinyHacker :)", 66, 128, 269, 29) ;~ GUICtrlSetFont(-1, 16, 800, 0, "Tahoma") ;~ GUICtrlCreateLabel("~ In Memory Of MyLove B.S ~ ", 86, 184, 228, 23) ;~ GUICtrlSetFont(-1, 12, 400, 2, "Tahoma") ;~ GUICtrlCreateLabel("Waiting for a signal..", 98, 264, 205, 27) ;~ GUICtrlSetFont(-1, 14, 800, 0, "Tahoma") ;~ GUICtrlSetColor(-1, 0x0000FF) ;~ GUICtrlCreateLabel("* * *", 168, 224, 64, 23) ;~ GUICtrlSetFont(-1, 12, 800, 0, "Tahoma") GUISetState() Do $ConnectedSocket = TCPAccept($MainSocket) Until $ConnectedSocket <> -1 _GDIPlus_Startup() While 1 If GUIGetMsg() = -3 Then Exit $recv = TCPRecv($ConnectedSocket, 8192, 1) If @error Then ExitLoop If $recv <> "" Then $hBitmap = Load_BMP_From_Mem(Binary($recv), True) _WinAPI_DeleteObject(GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)) EndIf WEnd Func Load_BMP_From_Mem($bImage, $hHBITMAP = False) If Not IsBinary($bImage) Then Return SetError(1, 0, 0) Local $aResult Local Const $memBitmap = Binary($bImage) ;load image saved in variable (memory) and convert it to binary Local Const $len = BinaryLen($memBitmap) ;get length of image Local Const $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory ($GMEM_MOVEABLE = 0x0002) Local Const $pData = _MemGlobalLock($hData) ;translate the handle into a pointer Local $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data _MemGlobalUnlock($hData) ;decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "handle", $pData, "int", True, "ptr*", 0) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents If @error Then Return SetError(2, 0, 0) Local Const $hStream = $aResult[3] $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "int*", 0) ;Creates a Bitmap object based on an IStream COM interface If @error Then Return SetError(3, 0, 0) Local Const $hBitmap = $aResult[2] Local $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)) ;release memory from $hStream to avoid memory leak $tMem = 0 $tVARIANT = 0 If $hHBITMAP Then Local Const $hHBmp = _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndIf Return $hBitmap EndFunc ;==>Load_BMP_From_Mem Func _GDIPlus_BitmapCreateDIBFromBitmap($hBitmap) Local $tBIHDR, $Ret, $tData, $pBits, $hResult = 0 $Ret = DllCall($ghGDIPDll, 'uint', 'GdipGetImageDimension', 'ptr', $hBitmap, 'float*', 0, 'float*', 0) If (@error) Or ($Ret[0]) Then Return 0 $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $Ret[2], $Ret[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB) $pBits = DllStructGetData($tData, 'Scan0') If Not $pBits Then Return 0 $tBIHDR = DllStructCreate('dword;long;long;ushort;ushort;dword;dword;long;long;dword;dword') DllStructSetData($tBIHDR, 1, DllStructGetSize($tBIHDR)) DllStructSetData($tBIHDR, 2, $Ret[2]) DllStructSetData($tBIHDR, 3, $Ret[3]) DllStructSetData($tBIHDR, 4, 1) DllStructSetData($tBIHDR, 5, 32) DllStructSetData($tBIHDR, 6, 0) $hResult = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBIHDR), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'dword', 0) If (Not @error) And ($hResult[0]) Then DllCall('gdi32.dll', 'dword', 'SetBitmapBits', 'ptr', $hResult[0], 'dword', $Ret[2] * $Ret[3] * 4, 'ptr', DllStructGetData($tData, 'Scan0')) $hResult = $hResult[0] Else $hResult = 0 EndIf _GDIPlus_BitmapUnlockBits($hBitmap, $tData) Return $hResult EndFunc ;==>_GDIPlus_BitmapCreateDIBFromBitmap Func ExitFunc() _GDIPlus_Shutdown() GUIDelete($hWnd) If $ConnectedSocket <> -1 Then TCPCloseSocket($ConnectedSocket) TCPShutdown() Exit EndFunc ;==>ExitFunc
  2. Well thank you!! so edit your reply and remove it please!
  3. Hello big-minds Well, this is my first thread outside the tiny-minds' forums, out side General Help And Support forum I tried so many times to make a video streamer capturing from the webcam, this thread was the only example i found here. so i tried to update it to become much faster: 1- No BMP files used. (JPG with a very small size) 2- No need to save the image file on your PC. (Viewing the file immediately converting from binary data received from TCP). Well, i think it's so much faster and looks like video streaming, but it also can be updated with you big ideas you big-minds! It's just a simple tool to contact with my fiancee Please update as much as you see is better. Thanx to UEZ by the way for Load_BMP_From_Mem script. Brodcaster: #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: SYRAU3 #ce ---------------------------------------------------------------------------- #include <WindowsConstants.au3> #include <GDIPlus.au3> $WM_CAP_START = 0x400 $WM_CAP_UNICODE_START = $WM_CAP_START + 100 $WM_CAP_PAL_SAVEA = $WM_CAP_START + 81 $WM_CAP_PAL_SAVEW = $WM_CAP_UNICODE_START + 81 $WM_CAP_UNICODE_END = $WM_CAP_PAL_SAVEW $WM_CAP_ABORT = $WM_CAP_START + 69 $WM_CAP_DLG_VIDEOCOMPRESSION = $WM_CAP_START + 46 $WM_CAP_DLG_VIDEODISPLAY = $WM_CAP_START + 43 $WM_CAP_DLG_VIDEOFORMAT = $WM_CAP_START + 41 $WM_CAP_DLG_VIDEOSOURCE = $WM_CAP_START + 42 $WM_CAP_DRIVER_CONNECT = $WM_CAP_START + 10 $WM_CAP_DRIVER_DISCONNECT = $WM_CAP_START + 11 $WM_CAP_DRIVER_GET_CAPS = $WM_CAP_START + 14 $WM_CAP_DRIVER_GET_NAMEA = $WM_CAP_START + 12 $WM_CAP_DRIVER_GET_NAMEW = $WM_CAP_UNICODE_START + 12 $WM_CAP_DRIVER_GET_VERSIONA = $WM_CAP_START + 13 $WM_CAP_DRIVER_GET_VERSIONW = $WM_CAP_UNICODE_START + 13 $WM_CAP_EDIT_COPY = $WM_CAP_START + 30 $WM_CAP_END = $WM_CAP_UNICODE_END $WM_CAP_FILE_ALLOCATE = $WM_CAP_START + 22 $WM_CAP_FILE_GET_CAPTURE_FILEA = $WM_CAP_START + 21 $WM_CAP_FILE_GET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 21 $WM_CAP_FILE_SAVEASA = $WM_CAP_START + 23 $WM_CAP_FILE_SAVEASW = $WM_CAP_UNICODE_START + 23 $WM_CAP_FILE_SAVEDIBA = $WM_CAP_START + 25 $WM_CAP_FILE_SAVEDIBW = $WM_CAP_UNICODE_START + 25 $WM_CAP_FILE_SET_CAPTURE_FILEA = $WM_CAP_START + 20 $WM_CAP_FILE_SET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 20 $WM_CAP_FILE_SET_INFOCHUNK = $WM_CAP_START + 24 $WM_CAP_GET_AUDIOFORMAT = $WM_CAP_START + 36 $WM_CAP_GET_CAPSTREAMPTR = $WM_CAP_START + 1 $WM_CAP_GET_MCI_DEVICEA = $WM_CAP_START + 67 $WM_CAP_GET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 67 $WM_CAP_GET_SEQUENCE_SETUP = $WM_CAP_START + 65 $WM_CAP_GET_STATUS = $WM_CAP_START + 54 $WM_CAP_GET_USER_DATA = $WM_CAP_START + 8 $WM_CAP_GET_VIDEOFORMAT = $WM_CAP_START + 44 $WM_CAP_GRAB_FRAME = $WM_CAP_START + 60 $WM_CAP_GRAB_FRAME_NOSTOP = $WM_CAP_START + 61 $WM_CAP_PAL_AUTOCREATE = $WM_CAP_START + 83 $WM_CAP_PAL_MANUALCREATE = $WM_CAP_START + 84 $WM_CAP_PAL_OPENA = $WM_CAP_START + 80 $WM_CAP_PAL_OPENW = $WM_CAP_UNICODE_START + 80 $WM_CAP_PAL_PASTE = $WM_CAP_START + 82 $WM_CAP_SEQUENCE = $WM_CAP_START + 62 $WM_CAP_SEQUENCE_NOFILE = $WM_CAP_START + 63 $WM_CAP_SET_AUDIOFORMAT = $WM_CAP_START + 35 $WM_CAP_SET_CALLBACK_CAPCONTROL = $WM_CAP_START + 85 $WM_CAP_SET_CALLBACK_ERRORA = $WM_CAP_START + 2 $WM_CAP_SET_CALLBACK_ERRORW = $WM_CAP_UNICODE_START + 2 $WM_CAP_SET_CALLBACK_FRAME = $WM_CAP_START + 5 $WM_CAP_SET_CALLBACK_STATUSA = $WM_CAP_START + 3 $WM_CAP_SET_CALLBACK_STATUSW = $WM_CAP_UNICODE_START + 3 $WM_CAP_SET_CALLBACK_VIDEOSTREAM = $WM_CAP_START + 6 $WM_CAP_SET_CALLBACK_WAVESTREAM = $WM_CAP_START + 7 $WM_CAP_SET_CALLBACK_YIELD = $WM_CAP_START + 4 $WM_CAP_SET_MCI_DEVICEA = $WM_CAP_START + 66 $WM_CAP_SET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 66 $WM_CAP_SET_OVERLAY = $WM_CAP_START + 51 $WM_CAP_SET_PREVIEW = $WM_CAP_START + 50 $WM_CAP_SET_PREVIEWRATE = $WM_CAP_START + 52 $WM_CAP_SET_SCALE = $WM_CAP_START + 53 $WM_CAP_SET_SCROLL = $WM_CAP_START + 55 $WM_CAP_SET_SEQUENCE_SETUP = $WM_CAP_START + 64 $WM_CAP_SET_USER_DATA = $WM_CAP_START + 9 $WM_CAP_SET_VIDEOFORMAT = $WM_CAP_START + 45 $WM_CAP_SINGLE_FRAME = $WM_CAP_START + 72 $WM_CAP_SINGLE_FRAME_CLOSE = $WM_CAP_START + 71 $WM_CAP_SINGLE_FRAME_OPEN = $WM_CAP_START + 70 $WM_CAP_STOP = $WM_CAP_START + 68 $avi = DllOpen("avicap32.dll") $user = DllOpen("user32.dll") $snapfile = @ScriptDir & "\scrshot.bmp" $Main = GUICreate("Camera", 350, 270) $cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD, $WS_VISIBLE), "int", 15, "int", 15, "int", 320, "int", 240, "hwnd", $Main, "int", 1) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_SCALE, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_OVERLAY, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEW, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 0) GUISetState(@SW_SHOW) HotKeySet("{TAB}", "SnapShot") HotKeySet("{ALT}", "Refresh") OnAutoItExitRegister("ExitFunc") Local $szIPADDRESS = @IPAddress1 Local $nPORT = 6965 TCPStartup() $ConnectedSocket = -1 $ConnectedSocket = TCPConnect($szIPADDRESS, $nPORT) While 1 _FileSend(@ScriptDir & "\Image.jpg", $ConnectedSocket) SnapShot() Sleep(500) If GUIGetMsg() = -3 Then ExitFunc() Sleep(1) WEnd Func SnapShot() DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_GRAB_FRAME_NOSTOP, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_FILE_SAVEDIBA, "int", 0, "str", $snapfile) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($snapfile) $sCLSID = _GDIPlus_EncodersGetCLSID("JPG") _GDIPlus_ImageSaveToFileEx($hImage, @ScriptDir & "\Image.jpg", $sCLSID) _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hImage) _GDIPlus_Shutdown() EndFunc ;==>SnapShot Func Refresh() DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 0) EndFunc ;==>Refresh Func _FileSend($sFile, $iMainSocket) Local $sBuff, $iFileOp, $sRecv $iFileOp = FileOpen($sFile, 16) If @error Then Return 0 $sBuff = Binary(StringTrimLeft($sFile, StringInStr($sFile, "\", -1, -1)) & ",") & FileRead($iFileOp) FileClose($iFileOp) While BinaryLen($sBuff) $iSendReturn = TCPSend($iMainSocket, $sBuff) If @error Then Return 0 $sBuff = BinaryMid($sBuff, $iSendReturn + 1, BinaryLen($sBuff) - $iSendReturn) WEnd Return 1 EndFunc ;==>_FileSend Func ExitFunc() Local $hImage _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hImage) _GDIPlus_Shutdown() DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_END, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_DISCONNECT, "int", 0, "int", 0) DllClose($user) FileDelete($snapfile) FileDelete(@ScriptDir & "\Image.jpg") Exit EndFunc ;==>ExitFunc Receiver: #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: SYRAU3 #ce ---------------------------------------------------------------------------- #include <GDIPlus.au3> #include <Memory.au3> Local $szIPADDRESS = @IPAddress1 Local $nPORT = 6965 TraySetIcon("Shell32.dll", 246) TCPStartup() $MainSocket = TCPListen($szIPADDRESS, $nPORT) If $MainSocket = -1 Then Exit $ConnectedSocket = -1 OnAutoItExitRegister("ExitFunc") _GDIPlus_Startup() Local $hImage = Load_BMP_From_Mem(1) Local $hWnd = GUICreate("IN MEMORY OF MY LOVE B.S - tinyHacker :)", 400, 300) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd) GUICtrlCreateLabel("NO SIGNAL", 15, 16, 371, 81) GUICtrlSetFont(-1, 48, 800, 0, "Tahoma") GUICtrlSetColor(-1, 0xFF0000) GUICtrlCreateLabel("Created by: tinyHacker :)", 66, 128, 269, 29) GUICtrlSetFont(-1, 16, 800, 0, "Tahoma") GUICtrlCreateLabel("~ In Memory Of MyLove B.S ~ ", 86, 184, 228, 23) GUICtrlSetFont(-1, 12, 400, 2, "Tahoma") GUICtrlCreateLabel("Waiting for a signal..", 98, 264, 205, 27) GUICtrlSetFont(-1, 14, 800, 0, "Tahoma") GUICtrlSetColor(-1, 0x0000FF) GUICtrlCreateLabel("* * *", 168, 224, 64, 23) GUICtrlSetFont(-1, 12, 800, 0, "Tahoma") GUISetState() GUIRegisterMsg(0x0014, "WM_ERASEBKGND") Do $ConnectedSocket = TCPAccept($MainSocket) Until $ConnectedSocket <> -1 While 1 _FileRecieve($ConnectedSocket) WEnd Func _FileRecieve($iAccSocket) Local $sBuff, $sRecv = "", $i = 0, $iFirstWhile = True If @error Then Return 0 $sBuff = Binary($sBuff) While $sRecv = "" $sRecv = TCPRecv($iAccSocket, 4324, 1) $sRecv = BinaryToString($sRecv) WEnd While $sRecv <> "" If StringInStr($sRecv, ',') And $iFirstWhile Then $sTmp = StringLeft($sRecv, StringInStr($sRecv, ",") - 1) $sRecv = StringTrimLeft($sRecv, StringLen($sTmp) + 1) $iFirstWhile = False EndIf $sBuff &= $sRecv $sRecv = BinaryToString(TCPRecv($iAccSocket, 4324, 1)) If @error Then ExitLoop WEnd $hImage = Load_BMP_From_Mem($sBuff) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, 400, 300) Return 1 EndFunc ;==>_FileRecieve Func WM_ERASEBKGND($hWnd, $uMsgm, $wParam, $lParam) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, 400, 300) Return True EndFunc ;==>WM_ERASEBKGND Func Load_BMP_From_Mem($pic) ;coded by UEZ - thanks to progandy form the MemGlobalAlloc lines Local $memBitmap, $len, $tMem, $hImage $memBitmap = Binary($pic) ;load image saved in variable (memory) and convert it to binary $len = BinaryLen($memBitmap) ;get length of image $hData = _MemGlobalAlloc($len, $GMEM_MOVEABLE) ;allocates movable memory ($GMEM_MOVEABLE = 0x0002) $pData = _MemGlobalLock($hData) ;translate the handle into a pointer $tMem = DllStructCreate("byte[" & $len & "]", $pData) ;create struct DllStructSetData($tMem, 1, $memBitmap) ;fill struct with image data _MemGlobalUnlock($hData) ;decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE $hStream = _WinAPI_CreateStreamOnHGlobal($pData) ;Creates a stream object that uses an HGLOBAL memory handle to store the stream contents $hBitmapFromStream = _GDIPlus_BitmapCreateFromStream($hStream) ;Creates a Bitmap object based on an IStream COM interface $tMem = "" Return $hBitmapFromStream EndFunc ;==>Load_BMP_From_Mem Func _WinAPI_CreateStreamOnHGlobal($hGlobal = 0, $fDeleteOnRelease = True) Local $aResult = DllCall("ole32.dll", "int", "CreateStreamOnHGlobal", "hwnd", $hGlobal, "int", $fDeleteOnRelease, "ptr*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[3] EndFunc ;==>_WinAPI_CreateStreamOnHGlobal Func _GDIPlus_BitmapCreateFromStream($pStream) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromStream", "ptr", $pStream, "int*", 0) If @error Then Return SetError(@error, @extended, 0) $GDIP_STATUS = $aResult[0] Return $aResult[2] EndFunc ;==>_GDIPlus_BitmapCreateFromStream Func ExitFunc() _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() GUIDelete($hWnd) If $ConnectedSocket <> -1 Then TCPCloseSocket($ConnectedSocket) TCPShutdown() Exit EndFunc ;==>ExitFunc Enjoy
  4. i think this worked: $ProNumS = 0 For $u = 0 To Number(_GUICtrlListView_GetItemCount($ListProducts) - 1) $ProNumS = _GUICtrlListView_FindInText($ListProducts, GUICtrlRead($input_product_name_search), $ProNumS) MsgBox(0,"", $ProNumS) Next but still looping and searching again when the search finnish, maybe i have to stop the loop somewhere?
  5. here is my stupid code: Case $search_btn $ProNumS = _GUICtrlListView_FindInText($ListProducts, GUICtrlRead($input_product_name_search)) If Not $ProNumS = "-1" Then ; not working with me, even without qutes "" If $ProNumS <> $ProNumS_Old Then $ProNumS = _GUICtrlListView_FindInText($ListProducts, GUICtrlRead($input_product_name_search), $ProNumS_Old) _GUICtrlListView_EnsureVisible($ListProducts, $ProNumS) _GUICtrlListView_SetItemSelected($ListProducts, $ProNumS) _GUICtrlListView_SetItemFocused($ListProducts, $ProNumS) $ProNumS_Old = $ProNumS $scMsg = $GUI_EVENT_CLOSE _RibbonsBar_Tab_SetState($products_tab) GUICtrlSendMsg($TabBox, $TCM_SETCURFOCUS, 1, 0) Else Notify("no more items") EndIf Else Notify("no similar result") EndIf
  6. i tried that and still......... i'll try again thank you
  7. i know sir, but if i want to show it for 5 seconds and hide it i have to use Sleep(5000)... sleeeeeping makes my script stops
  8. hello big-minds i have a long list with many similar-text items, and i have a search code, but i didn't know how to view all the search results, or even better for my script.. how view the next result after the current? i know _GUICtrlListView_FindInText can do that with $fReverse somehow, but i don't know how.. any help \as usual\ please?
  9. hello big-minds sorry for the log title.. but it enplanes my problem
  10. i think there is always a way to dump the dongle info or make a virtual copy of it....... here, in the Arabian world i live in, the dongles are the last security tool to be used..
  11. is the hardare information returned by _WinAPI_UniqueHardwareID() never change even with using different operating systems?
×
×
  • Create New...