Jump to content

Help please


Recommended Posts

I posted the similar question in other section and i apologize with admin, my be this is the right section.

The question is:

In refer at code that i founded in other section that i report following:

$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 <GUIConstants.au3>
#include "Misc.au3"


$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("{INSERT}", "SnapShot"); Press 'Insert' to make a SnapShot !


While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
   ;DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_CALLBACK_FRAME, "int", 0, "int", 0)
        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($avi)
        DllClose($user)
        Exit
    EndIf
    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) 
EndFunc

I believe to find a function named SnapShot(), that grab the image from webcam. Well, if is true how can put into a clipboard?

I tryed to ad this code ClipPut($snapfile) , but when i make ctrl+v in other application I obtain this text "C:\DATI MAX\MAX\Auto_IT\scrshot.bmp", instead of image.

I understand that the var $snapfile is the path at file and not the image, so wich is the var that Ihave to put in clipboard?

There is someone that can help me please?

thanks

MaxNMB

Link to comment
Share on other sites

Have a look under ClipBoard management in the helpfile. It will provide what you need :D

Great..thanks for help.

But i asked if someone can tell me wich is the variable where is put the "snapshot" in the script that i reported before. This for an eventual change code and add code that put the snapshot in clipboard before save on disk.

I readed th help file that you suggest me..but there is not help for transfer an IMAGE in the clipboard. All sample (and i tried and work fine) is with text and not with IMAGE. I tried thhis code:

_ClipBoard_Open(0)
_ClipBoard_SetData($snapfile,2); or how is writer in HELP _ClipBoard_SetData($snapfile,$CF_BITMAP)
_ClipBoard_Close()

I used also ClipPut() and _ClipPutFile()

but when I'll go to make a simple "paste" with CTRLv in other application the result is the text of path.

I used also ClipPut() and _ClipPutFile(), but with the same result.

As I said before i do not study the manual at all, I'm started right 2 day ago and i Find the AutoIT can resolve my problem for my application; I create a DB with FilemakerPro, and i need simple to get a Foto by webcam and put in a field. Is for my work and not a joke. Please, can someone help me?

Thanks

Max

Link to comment
Share on other sites

_ClipBoard_SetData

--------------------------------------------------------------------------------

Places data on the clipboard in a specified clipboard format

#Include <Clipboard.au3>

_ClipBoard_SetData($vData[, $iFormat = 1])

Parameters

$hMemory Handle to the data in the specified format. This parameter can be NULL, indicating that the

window provides data in the specified clipboard format upon request. If a window delays rendering, it must

process the $WM_RENDERFORMAT and $WM_RENDERALLFORMATS messages. If this function succeeds, the system owns

the object identified by the $hMemory parameter. The application may not write to or free the data once

ownership has been transferred to the system, but it can lock and read from the data until the _ClipBoard_Close

function is called. The memory must be unlocked before the clipboard is closed. If the $hMemory parameter

identifies a memory object, the object must have been allocated using the function with the $GMEM_MOVEABLE

flag.

$iFormat Specifies a clipboard format:

$CF_TEXT - Text format

$CF_BITMAP - Handle to a bitmap (HBITMAP)

$CF_METAFILEPICT - Handle to a metafile picture (METAFILEPICT)

$CF_SYLK - Microsoft Symbolic Link (SYLK) format

$CF_DIF - Software Arts' Data Interchange Format

$CF_TIFF - Tagged image file format

$CF_OEMTEXT - Text format containing characters in the OEM character set

$CF_DIB - BITMAPINFO structure followed by the bitmap bits

$CF_PALETTE - Handle to a color palette

$CF_PENDATA - Data for the pen extensions to Pen Computing

$CF_RIFF - Represents audio data in RIFF format

$CF_WAVE - Represents audio data in WAVE format

$CF_UNICODETEXT - Unicode text format

$CF_ENHMETAFILE - Handle to an enhanced metafile (HENHMETAFILE)

$CF_HDROP - Handle to type HDROP that identifies a list of files

$CF_LOCALE - Handle to the locale identifier associated with text in the clipboard

$CF_DIBV5 - BITMAPV5HEADER structure followed by bitmap color and the bitmap bits

$CF_OWNERDISPLAY - Owner display format

$CF_DSPTEXT - Text display format associated with a private format

$CF_DSPBITMAP - Bitmap display format associated with a private format

$CF_DSPMETAFILEPICT - Metafile picture display format associated with a private format

$CF_DSPENHMETAFILE - Enhanced metafile display format associated with a private format

Directly out of the help file...

" I haven't failed. I've just found 10,000 ways that won't work." Thomas Edison "You cannot help men permanently by doing for them what they could and should do for themselves." Abraham Lincoln

Link to comment
Share on other sites

Ok, thank i readed the manual!!

so the corect to put data in clipboard is

_ClipBoard_Open(0)
_ClipBoard_SetData($snapfile,$CF_BITMAP)
_ClipBoard_Close()

but...AGAIN...noone respond to my question:

WHERE is stored( mean which varible had used, in the script that i report in my first post, the snapshot of image from webcam?

thanks

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...