[R] faire signer les personnes sur tablette
Règles du forum
- Merci de consulter la section "Règles du forum" et plus particulièrement "Règles et Mentions Légales du site autoitscript.fr" avant d'écrire un message.
[R] faire signer les personnes sur tablette
Bonjour,
J'ai un projet ou je doit fait signer des personnes sur des tablettes windows.
J'aimerai savoir si il est possible de faire signer ces personnes sur une interface autoit, et d'enregistrer cette signature dans un fichier images temporaire. Je sais que le peut contrôler le point, mais j'aimerai l'intégrer directement dans cette interface.
Si ce n'est pas possible, auriez vous des pistes pour contourner cette difficulté.
Je vous en remercie par avance.
Yasen
J'ai un projet ou je doit fait signer des personnes sur des tablettes windows.
J'aimerai savoir si il est possible de faire signer ces personnes sur une interface autoit, et d'enregistrer cette signature dans un fichier images temporaire. Je sais que le peut contrôler le point, mais j'aimerai l'intégrer directement dans cette interface.
Si ce n'est pas possible, auriez vous des pistes pour contourner cette difficulté.
Je vous en remercie par avance.
Yasen
Modifié en dernier par yasen le mar. 25 oct. 2016 17:08, modifié 5 fois.
- walkson
- Modérateur
- Messages : 1020
- Enregistré le : ven. 12 août 2011 19:49
- Localisation : Hurepoix
- Status : Hors ligne
Re: faire signer les personnes sur tablette
Quelque chose comme ça ?
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#Include <Misc.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
ToolTip(" Exit => Alt + x " ,50,100,"EXIT",1)
_GDIPlus_Startup()
$iWidth = @DesktopWidth
$iHeight = @DesktopHeight
$hGUI = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED)
GUISetBkColor(0xABCDEF)
_WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 0x60)
GUISetState()
Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight,$hGraphic)
$g_hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
;~ _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
;_GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)
Global $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000)
HotKeySet ( "!x" , "_Exit");alt x
OnAutoItExitRegister("_Exit")
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Draw", $hGUI)
Global $om = MouseGetCursor()
GUISetCursor(3, 1, $hGUI)
While Sleep(100000)
WEnd
Func Draw()
ToolTip("")
Local Const $w = 8, $h = 8
Local Const $w2 = $w / 2, $h2 = $h / 2
Local $aMC
Do
;GUISetCursor(5, 1, $hGUI)
$aMPos = MouseGetPos()
_GDIPlus_GraphicsFillRect($g_hGfxCtxt, $aMPos[0] - $w2, $aMPos[1] - $h2, $w, $h, $hBrush)
_GDIPlus_GraphicsDrawImage($hGraphic,$hBitmap,0,0)
$aMC = GUIGetCursorInfo($hGUI)
Until Not $aMC[2]
EndFunc
Func _Exit()
;_GDIPlus_GetBitmapFromGraphic($hGUI, $iWidth, $iHeight)
GUISetCursor($om, 1, $hGUI)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "")
_GDIPlus_ImageSaveToFile($hBitmap,@DesktopDir & '\ESSAI_1.png')
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($g_hGfxCtxt)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
Exit
EndFunc
Func _GDIPlus_GetBitmapFromGraphic($hWnd, $iWidth, $iHeight)
;récupère l'image mais sur fond opaque
Local Const $hDC = _WinAPI_GetDC($hWnd)
Local Const $memDC = _WinAPI_CreateCompatibleDC($hDC)
Local Const $memBmp = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight)
_WinAPI_SelectObject ($memDC, $memBmp)
_WinAPI_BitBlt($memDC, 0, 0, $iWidth, $iHeight, $hDC, 0, 0, 0x00CC0020) ; 0x00CC0020 = $SRCCOPY
Local Const $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP ($memBmp)
_WinAPI_ReleaseDC($hWnd, $hDC)
_WinAPI_DeleteDC($memDC)
_WinAPI_DeleteObject($memBmp)
_GDIPlus_ImageSaveToFile($hBitmap,@DesktopDir & '\ESSAI.png')
EndFunc
#include <GUIConstantsEx.au3>
#Include <Misc.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
ToolTip(" Exit => Alt + x " ,50,100,"EXIT",1)
_GDIPlus_Startup()
$iWidth = @DesktopWidth
$iHeight = @DesktopHeight
$hGUI = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED)
GUISetBkColor(0xABCDEF)
_WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 0x60)
GUISetState()
Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight,$hGraphic)
$g_hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
;~ _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
;_GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)
Global $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000)
HotKeySet ( "!x" , "_Exit");alt x
OnAutoItExitRegister("_Exit")
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Draw", $hGUI)
Global $om = MouseGetCursor()
GUISetCursor(3, 1, $hGUI)
While Sleep(100000)
WEnd
Func Draw()
ToolTip("")
Local Const $w = 8, $h = 8
Local Const $w2 = $w / 2, $h2 = $h / 2
Local $aMC
Do
;GUISetCursor(5, 1, $hGUI)
$aMPos = MouseGetPos()
_GDIPlus_GraphicsFillRect($g_hGfxCtxt, $aMPos[0] - $w2, $aMPos[1] - $h2, $w, $h, $hBrush)
_GDIPlus_GraphicsDrawImage($hGraphic,$hBitmap,0,0)
$aMC = GUIGetCursorInfo($hGUI)
Until Not $aMC[2]
EndFunc
Func _Exit()
;_GDIPlus_GetBitmapFromGraphic($hGUI, $iWidth, $iHeight)
GUISetCursor($om, 1, $hGUI)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "")
_GDIPlus_ImageSaveToFile($hBitmap,@DesktopDir & '\ESSAI_1.png')
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($g_hGfxCtxt)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
Exit
EndFunc
Func _GDIPlus_GetBitmapFromGraphic($hWnd, $iWidth, $iHeight)
;récupère l'image mais sur fond opaque
Local Const $hDC = _WinAPI_GetDC($hWnd)
Local Const $memDC = _WinAPI_CreateCompatibleDC($hDC)
Local Const $memBmp = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight)
_WinAPI_SelectObject ($memDC, $memBmp)
_WinAPI_BitBlt($memDC, 0, 0, $iWidth, $iHeight, $hDC, 0, 0, 0x00CC0020) ; 0x00CC0020 = $SRCCOPY
Local Const $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP ($memBmp)
_WinAPI_ReleaseDC($hWnd, $hDC)
_WinAPI_DeleteDC($memDC)
_WinAPI_DeleteObject($memBmp)
_GDIPlus_ImageSaveToFile($hBitmap,@DesktopDir & '\ESSAI.png')
EndFunc
Cordialement,
Walkson
"Horas non numero nisi serenas " Le canon de midi
(Je ne compte que les heures heureuses)
Walkson
"Horas non numero nisi serenas " Le canon de midi
(Je ne compte que les heures heureuses)
Re: faire signer les personnes sur tablette
Bonsoir,
Merci pour votre réponse, test ça au plus vite et je reviens vers pour vous tenir au courant si c'est bon.
Merci pour votre réponse, test ça au plus vite et je reviens vers pour vous tenir au courant si c'est bon.
- orax
- Modérateur
- Messages : 1479
- Enregistré le : lun. 23 mars 2009 04:50
- Localisation : ::1
- Status : Hors ligne
Re: faire signer les personnes sur tablette
J'ai remplacé les rectangles par des lignes, sinon ça fait des pointillés.
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
ToolTip(" Exit => Alt + x ", 50, 100, "EXIT", 1)
_GDIPlus_Startup()
$iWidth = @DesktopWidth
$iHeight = @DesktopHeight
;~ $hGUI = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED)
$hGUI = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP)
GUISetBkColor(0xABCDEF)
;~ _WinAPI_SetLayeredWindowAttributes($hGUI, 0xFFFFFF, 0x60)
GUISetState()
Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
$g_hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($g_hGfxCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
Global $hPen = _GDIPlus_PenCreate(0xFF000000, 4)
HotKeySet("!x", "_Exit");alt x
OnAutoItExitRegister("_Exit")
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Draw", $hGUI)
Global $om = MouseGetCursor()
GUISetCursor(3, 1, $hGUI)
While Sleep(100000)
WEnd
Func Draw()
;~ ToolTip("")
Local Const $w = 8, $h = 8
Local Const $w2 = $w / 2, $h2 = $h / 2
Local $aMC
Local $aMPosOld = MouseGetPos()
Do
$aMC = GUIGetCursorInfo($hGUI)
_GDIPlus_GraphicsDrawLine($g_hGfxCtxt, $aMPosOld[0], $aMPosOld[1], $aMC[0], $aMC[1], $hPen)
_GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0)
$aMPosOld = $aMC
Until Not $aMC[2]
EndFunc ;==>Draw
Func _Exit()
GUISetCursor($om, 1, $hGUI)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "")
_GDIPlus_ImageSaveToFile($hBitmap, @DesktopDir & '\ESSAI_1.png')
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($g_hGfxCtxt)
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
Exit
EndFunc ;==>_Exit
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
ToolTip(" Exit => Alt + x ", 50, 100, "EXIT", 1)
_GDIPlus_Startup()
$iWidth = @DesktopWidth
$iHeight = @DesktopHeight
;~ $hGUI = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED)
$hGUI = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP)
GUISetBkColor(0xABCDEF)
;~ _WinAPI_SetLayeredWindowAttributes($hGUI, 0xFFFFFF, 0x60)
GUISetState()
Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
$g_hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($g_hGfxCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
Global $hPen = _GDIPlus_PenCreate(0xFF000000, 4)
HotKeySet("!x", "_Exit");alt x
OnAutoItExitRegister("_Exit")
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Draw", $hGUI)
Global $om = MouseGetCursor()
GUISetCursor(3, 1, $hGUI)
While Sleep(100000)
WEnd
Func Draw()
;~ ToolTip("")
Local Const $w = 8, $h = 8
Local Const $w2 = $w / 2, $h2 = $h / 2
Local $aMC
Local $aMPosOld = MouseGetPos()
Do
$aMC = GUIGetCursorInfo($hGUI)
_GDIPlus_GraphicsDrawLine($g_hGfxCtxt, $aMPosOld[0], $aMPosOld[1], $aMC[0], $aMC[1], $hPen)
_GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0)
$aMPosOld = $aMC
Until Not $aMC[2]
EndFunc ;==>Draw
Func _Exit()
GUISetCursor($om, 1, $hGUI)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "")
_GDIPlus_ImageSaveToFile($hBitmap, @DesktopDir & '\ESSAI_1.png')
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($g_hGfxCtxt)
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
Exit
EndFunc ;==>_Exit
Modifié en dernier par orax le dim. 16 oct. 2016 12:57, modifié 1 fois.
Raison : Ajout de _GDIPlus_GraphicsSetSmoothingMode proposé par walkson.
Raison : Ajout de _GDIPlus_GraphicsSetSmoothingMode proposé par walkson.
De petits détails peuvent faire toute la différence. — Quand la boule de neige commence à rouler… poussez-la. (Columbo)
- walkson
- Modérateur
- Messages : 1020
- Enregistré le : ven. 12 août 2011 19:49
- Localisation : Hurepoix
- Status : Hors ligne
Re: faire signer les personnes sur tablette
Bonjour,
En effet, le code ainsi est beaucoup plus véloce !
Petite précision: le code de base est du sieur Uez (forum us) modifié pour sauvegarder l'image
[Edit] l'ajout de
sous la variable $g_hGfxCtxt donne un trait beaucoup plus régulier
En effet, le code ainsi est beaucoup plus véloce !
Petite précision: le code de base est du sieur Uez (forum us) modifié pour sauvegarder l'image
[Edit] l'ajout de
_GDIPlus_GraphicsSetSmoothingMode($g_hGfxCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
sous la variable $g_hGfxCtxt donne un trait beaucoup plus régulier
Cordialement,
Walkson
"Horas non numero nisi serenas " Le canon de midi
(Je ne compte que les heures heureuses)
Walkson
"Horas non numero nisi serenas " Le canon de midi
(Je ne compte que les heures heureuses)
- orax
- Modérateur
- Messages : 1479
- Enregistré le : lun. 23 mars 2009 04:50
- Localisation : ::1
- Status : Hors ligne
Re: faire signer les personnes sur tablette
Oui, le trait est en effet de meilleur qualité avec GraphicsSetSmoothingMode (je l'ai ajouté dans le code).
Dans les modifications que j'avais apportées, j'avais retiré
Dans les modifications que j'avais apportées, j'avais retiré
$WS_EX_LAYERED
et _WinAPI_SetLayeredWindowAttributes
parce que la GUI ne s'affichait pas (testé sur Windows 8.1) ; j'ai laissé ces lignes en commentaire.De petits détails peuvent faire toute la différence. — Quand la boule de neige commence à rouler… poussez-la. (Columbo)
- walkson
- Modérateur
- Messages : 1020
- Enregistré le : ven. 12 août 2011 19:49
- Localisation : Hurepoix
- Status : Hors ligne
Re: faire signer les personnes sur tablette
Je suis étonné car la semaine dernière, j'ai lancé, sur un Win 10, une gui sous cette forme (mon PC est sous win 7)Dans les modifications que j'avais apportées, j'avais retiré $WS_EX_LAYERED et _WinAPI_SetLayeredWindowAttributes parce que la GUI ne s'affichait pas (testé sur Windows 8.1) ; j'ai laissé ces lignes en commentaire.
Global $hGUI = GUICreate("GDI+", $width, $height, 50, 5, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)
GUISetState(@SW_SHOW)
GUISetState(@SW_SHOW)
As tu essayé l'exemple de la fonction _WinAPI_SetLayeredWindowAttributes() ?
Cordialement,
Walkson
"Horas non numero nisi serenas " Le canon de midi
(Je ne compte que les heures heureuses)
Walkson
"Horas non numero nisi serenas " Le canon de midi
(Je ne compte que les heures heureuses)
- orax
- Modérateur
- Messages : 1479
- Enregistré le : lun. 23 mars 2009 04:50
- Localisation : ::1
- Status : Hors ligne
Re: faire signer les personnes sur tablette
Je viens d'essayer sur un Windows 10, mais j'ai le même problème. Le curseur en forme de croix et la GUI (de couleur bleutée) ne s'affichent pas. Mais j'ai quand même essayé de dessiner quelque chose... ESSAI_1.png est créé sur le bureau, mais l'image est toute blanche.
Pour que la GUI s'affiche chez moi, j'ai besoin de changer la ligne _WinAPI_SetLayeredWindowAttributes. Quand je remplace 0xABCDEF par 0x010101 (par exemple), ça marche pour moi :
Je pense que l'exemple de la fonction _WinAPI_SetLayeredWindowAttributes fonctionne correctement.
Quand j'exécute le script d'exemple, si je clique sur "Transparent color 0xABCDEF (Checked) Or 0x010101", alors la GUI (sauf les contours) devient totalement transparente. Si je clique sur la zone transparente, ça ne clique pas sur la GUI mais sur la fenêtre en arrière plan.
Pour que la GUI s'affiche chez moi, j'ai besoin de changer la ligne _WinAPI_SetLayeredWindowAttributes. Quand je remplace 0xABCDEF par 0x010101 (par exemple), ça marche pour moi :
Quand j'exécute le script d'exemple, si je clique sur "Transparent color 0xABCDEF (Checked) Or 0x010101", alors la GUI (sauf les contours) devient totalement transparente. Si je clique sur la zone transparente, ça ne clique pas sur la GUI mais sur la fenêtre en arrière plan.
De petits détails peuvent faire toute la différence. — Quand la boule de neige commence à rouler… poussez-la. (Columbo)
Re: [R]faire signer les personnes sur tablette
Bonjour,
Je viens de tester et cela fonctionne à merveille, cela me permet un temps considérable sur mon projet.
Je vous en remercie énormément.
Yasen
Je viens de tester et cela fonctionne à merveille, cela me permet un temps considérable sur mon projet.
Je vous en remercie énormément.
Yasen
Re: [..] faire signer les personnes sur tablette
Dernière petite question, j'essaye de mettre un bouton (jusque la, aucun problème), mais le bouton ne fonctionne pas.
je chercher sur le net, mais les exemples ressemble à ce que j'ai mis en place.
Auriez vous une petite idée d'où pourrais provenir le problème ?
je chercher sur le net, mais les exemples ressemble à ce que j'ai mis en place.
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <GuiToolTip.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
ToolTip(" Exit => Alt + x ", 50, 100, "EXIT", 1)
_GDIPlus_Startup()
$iWidth = @DesktopWidth
$iHeight = @DesktopHeight
;~ $hGUI = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED)
$hGUI = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP)
GUISetBkColor(0xABCDEF)
;~ _WinAPI_SetLayeredWindowAttributes($hGUI, 0xFFFFFF, 0x60)
Local $idVal = GUICtrlCreateButton("Valider signature", (@DesktopWidth - 150), (@DesktopHeight - 80), 110, 30, $WS_GROUP)
GUISetState(@SW_SHOW)
Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
$g_hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($g_hGfxCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
Global $hPen = _GDIPlus_PenCreate(0xFF000000, 4)
HotKeySet("!x", "_Exit");alt x
OnAutoItExitRegister("_Exit")
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Draw", $hGUI)
Global $om = MouseGetCursor()
GUISetCursor(3, 1, $hGUI)
Local $msg
While 1
$msg = GUIGetMsg()
Switch $msg
Case $idVal
_Exit()
EndSwitch
WEnd
Func Draw()
;~ ToolTip("")
Local Const $w = 8, $h = 8
Local Const $w2 = $w / 2, $h2 = $h / 2
Local $aMC
Local $aMPosOld = MouseGetPos()
Do
$aMC = GUIGetCursorInfo($hGUI)
_GDIPlus_GraphicsDrawLine($g_hGfxCtxt, $aMPosOld[0], $aMPosOld[1], $aMC[0], $aMC[1], $hPen)
_GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0)
$aMPosOld = $aMC
Until Not $aMC[2]
EndFunc ;==>Draw
Func _Exit()
GUISetCursor($om, 1, $hGUI)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "")
_GDIPlus_ImageSaveToFile($hBitmap, 'system\tmp\_tmp_sig.bmp')
_GDIPlus_ImageSaveToFile($hBitmap, 'system\tmp\_tmp_sig.png')
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($g_hGfxCtxt)
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
Exit
EndFunc ;==>_Exit
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <GuiToolTip.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
ToolTip(" Exit => Alt + x ", 50, 100, "EXIT", 1)
_GDIPlus_Startup()
$iWidth = @DesktopWidth
$iHeight = @DesktopHeight
;~ $hGUI = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED)
$hGUI = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP)
GUISetBkColor(0xABCDEF)
;~ _WinAPI_SetLayeredWindowAttributes($hGUI, 0xFFFFFF, 0x60)
Local $idVal = GUICtrlCreateButton("Valider signature", (@DesktopWidth - 150), (@DesktopHeight - 80), 110, 30, $WS_GROUP)
GUISetState(@SW_SHOW)
Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
$g_hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($g_hGfxCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
Global $hPen = _GDIPlus_PenCreate(0xFF000000, 4)
HotKeySet("!x", "_Exit");alt x
OnAutoItExitRegister("_Exit")
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Draw", $hGUI)
Global $om = MouseGetCursor()
GUISetCursor(3, 1, $hGUI)
Local $msg
While 1
$msg = GUIGetMsg()
Switch $msg
Case $idVal
_Exit()
EndSwitch
WEnd
Func Draw()
;~ ToolTip("")
Local Const $w = 8, $h = 8
Local Const $w2 = $w / 2, $h2 = $h / 2
Local $aMC
Local $aMPosOld = MouseGetPos()
Do
$aMC = GUIGetCursorInfo($hGUI)
_GDIPlus_GraphicsDrawLine($g_hGfxCtxt, $aMPosOld[0], $aMPosOld[1], $aMC[0], $aMC[1], $hPen)
_GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0)
$aMPosOld = $aMC
Until Not $aMC[2]
EndFunc ;==>Draw
Func _Exit()
GUISetCursor($om, 1, $hGUI)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "")
_GDIPlus_ImageSaveToFile($hBitmap, 'system\tmp\_tmp_sig.bmp')
_GDIPlus_ImageSaveToFile($hBitmap, 'system\tmp\_tmp_sig.png')
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($g_hGfxCtxt)
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
Exit
EndFunc ;==>_Exit
Re: [..] faire signer les personnes sur tablette
Oublié ma question c'est bon, j'ai ajouter
- orax
- Modérateur
- Messages : 1479
- Enregistré le : lun. 23 mars 2009 04:50
- Localisation : ::1
- Status : Hors ligne
Re: [..] faire signer les personnes sur tablette
J'ai supprimé
GUIGetMsg() ne fonctionne pas avec le mode GUIOnEventMode. Il faut utiliser GUICtrlSetOnEvent().
OnAutoItExitRegister("_Exit")
parce que la fonction _Exit() est exécutée deux fois lors de la fermeture du script.GUIGetMsg() ne fonctionne pas avec le mode GUIOnEventMode. Il faut utiliser GUICtrlSetOnEvent().
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <GuiToolTip.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
ToolTip(" Exit => Alt + x ", 50, 100, "EXIT", 1)
_GDIPlus_Startup()
$iWidth = @DesktopWidth
$iHeight = @DesktopHeight
;~ $hGUI = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED)
$hGUI = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP)
GUISetBkColor(0xABCDEF)
;~ _WinAPI_SetLayeredWindowAttributes($hGUI, 0xFFFFFF, 0x60)
Local $idVal = GUICtrlCreateButton("Valider signature", (@DesktopWidth - 150), (@DesktopHeight - 80), 110, 30, $WS_GROUP)
GUISetState(@SW_SHOW)
Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
$g_hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($g_hGfxCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
Global $hPen = _GDIPlus_PenCreate(0xFF000000, 4)
HotKeySet("!x", "_Exit");alt x
GUICtrlSetOnEvent($idVal, "_Exit")
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Draw")
Global $om = MouseGetCursor()
GUISetCursor(3, 1, $hGUI)
While 1
Sleep(10000)
WEnd
Func Draw()
;~ ToolTip("")
If @GUI_CtrlId = $idVal Then _Exit()
Local Const $w = 8, $h = 8
Local Const $w2 = $w / 2, $h2 = $h / 2
Local $aMC
Local $aMPosOld = MouseGetPos()
Do
$aMC = GUIGetCursorInfo($hGUI)
_GDIPlus_GraphicsDrawLine($g_hGfxCtxt, $aMPosOld[0], $aMPosOld[1], $aMC[0], $aMC[1], $hPen)
_GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0)
$aMPosOld = $aMC
Until Not $aMC[2]
EndFunc ;==>Draw
Func _Exit()
GUISetCursor($om, 1, $hGUI)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "")
_GDIPlus_ImageSaveToFile($hBitmap, 'system\tmp\_tmp_sig.bmp')
_GDIPlus_ImageSaveToFile($hBitmap, 'system\tmp\_tmp_sig.png')
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($g_hGfxCtxt)
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
Exit
EndFunc ;==>_Exit
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <GuiToolTip.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
ToolTip(" Exit => Alt + x ", 50, 100, "EXIT", 1)
_GDIPlus_Startup()
$iWidth = @DesktopWidth
$iHeight = @DesktopHeight
;~ $hGUI = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED)
$hGUI = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP)
GUISetBkColor(0xABCDEF)
;~ _WinAPI_SetLayeredWindowAttributes($hGUI, 0xFFFFFF, 0x60)
Local $idVal = GUICtrlCreateButton("Valider signature", (@DesktopWidth - 150), (@DesktopHeight - 80), 110, 30, $WS_GROUP)
GUISetState(@SW_SHOW)
Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
$g_hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($g_hGfxCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
Global $hPen = _GDIPlus_PenCreate(0xFF000000, 4)
HotKeySet("!x", "_Exit");alt x
GUICtrlSetOnEvent($idVal, "_Exit")
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Draw")
Global $om = MouseGetCursor()
GUISetCursor(3, 1, $hGUI)
While 1
Sleep(10000)
WEnd
Func Draw()
;~ ToolTip("")
If @GUI_CtrlId = $idVal Then _Exit()
Local Const $w = 8, $h = 8
Local Const $w2 = $w / 2, $h2 = $h / 2
Local $aMC
Local $aMPosOld = MouseGetPos()
Do
$aMC = GUIGetCursorInfo($hGUI)
_GDIPlus_GraphicsDrawLine($g_hGfxCtxt, $aMPosOld[0], $aMPosOld[1], $aMC[0], $aMC[1], $hPen)
_GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0)
$aMPosOld = $aMC
Until Not $aMC[2]
EndFunc ;==>Draw
Func _Exit()
GUISetCursor($om, 1, $hGUI)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "")
_GDIPlus_ImageSaveToFile($hBitmap, 'system\tmp\_tmp_sig.bmp')
_GDIPlus_ImageSaveToFile($hBitmap, 'system\tmp\_tmp_sig.png')
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($g_hGfxCtxt)
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
Exit
EndFunc ;==>_Exit
De petits détails peuvent faire toute la différence. — Quand la boule de neige commence à rouler… poussez-la. (Columbo)
Re: [..] faire signer les personnes sur tablette
Bonjour,
J'ai effectué des tests sur une tablette sous windows 8, et la signature ne se fait pas fluidement et s'effectue avec des lignes.
J'ai réduit la taille de la fenêtre, cela améliore la fluidité et le dessin de la signature, mais j'aimerai savoir si on peut améliorer.
J'ai testé sur paint, aucun problème.
Merci pour vos lumières
Yasen
J'ai effectué des tests sur une tablette sous windows 8, et la signature ne se fait pas fluidement et s'effectue avec des lignes.
J'ai réduit la taille de la fenêtre, cela améliore la fluidité et le dessin de la signature, mais j'aimerai savoir si on peut améliorer.
J'ai testé sur paint, aucun problème.
Merci pour vos lumières
Yasen