mar. 19 janvier 2016, 20h06
Guy BONEMME
atoutfox.public.association
Re: gestion d'un appareil photo
Adel a écrit :
> Comment faire pour :
> 1) avoir accès à un appareil photo en tant qu'un périphérique connecté au PC
> ? 2) copier une photo (.jpg)
>
> Merci d'avance
> Bonne et heureuse année 2016.
Bonjour Abdel
voici une routine que j'ai utilisé cour commander l'appareil
au départ de VFOX
Change les répertoire suivant to application.
* Ce code est à placer dans le bouton de commande dédicacé ;
* à la prise de vue.
* Emile Maitrejean BE-Fox et Mike Lewis
* Eztw32.dll chargée de internet
* placée soit en Windows\system soit dans le root de l'application
*
DECLARE INTEGER TWAIN_SelectImageSource IN Eztw32.DLL INTEGER HWND
DECLARE INTEGER TWAIN_GetSourceList IN Eztw32.DLL
DECLARE INTEGER TWAIN_GetNextSourceName IN Eztw32.DLL STRING
@cSourceName
TWAIN_SelectImageSource(0)
DECLARE INTEGER TWAIN_OpenSource IN Eztw32.DLL STRING cSourceName
DECLARE INTEGER TWAIN_AcquireNative IN Eztw32.DLL INTEGER nAppWind,
INTEGER nPixelTypes
DECLARE INTEGER TWAIN_WriteNativeToFilename IN Eztw32.DLL INTEGER nDIB,
STRING cFilename
DECLARE INTEGER TWAIN_FreeNative IN Eztw32.DLL INTEGER nDIB
DECLARE INTEGER TWAIN_SetMultiTransfer IN Eztw32.DLL INTEGER nFlag
LOCAL lcFile, lnImageHandle, lnReply
* Les photo sont stockées en répertoire \PersoW\BMP (fpath19) le nom :
[NOM Prénom.bmp]
* agent.NOM+" "+agent.prenom.BMP
* *
* Si problème lors de la prise de vue, on affiche une photo standard à
la place de la photo réelle.
*lcFile = CURDIR()+"photos\ph"+ALLTRIM(STR(vsig.ikficnu,8))+".bmp"
SELECT agent
lcFile = fpath19+RTRIM(agent.nom)+"
"+TRANSFORM(RTRIM(agent.pren)+".bmp")
lcFile2 = RTRIM(agent.nom)+" "+TRANSFORM(RTRIM(agent.pren)+".bmp")
* Get the image
lnImageHandle = TWAIN_AcquireNative(0,0)
* Write the image to a disk file
lnReply = TWAIN_WriteNativeToFilename(lnImageHandle,lcFile)
* Release the image handle
TWAIN_FreeNative(lnImageHandle)
* Check for errors
IF lnReply = 0
* MESSAGEBOX("OK")
* image successfully written to file
REPLACE agent.photo_file WITH lcFile2
ELSE
WCENTRE("Erreur d'acquisition image:"+STR(lnReply,4),"3","","")
* something went wrong
ENDIF
IF FILE(lcfile)
*lcFile = fpath19+agent.photo_file
Thisform.imgPhoto.Picture = lcFile
ELSE
lcFile = fpath19+"white.bmp"
ENDIF
*thisform.imgPhoto.Picture = lcFile
*thisForm.Refresh()
--
Guy BONEMME
Atoutfox
BEfox
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000017196