Jump to content
ScriptJunky

Constants for _WinAPI_GetSystemMetrics()

Recommended Posts

ScriptJunky

I noticed a lack of a constants file for _WinAPI_GetSystemMetrics() so I made this for anyone who wants to add it to their library. Enjoy! :) (file attached below)

#include-once

; #INDEX# =======================================================================================================================
; Title .........: WinAPI GetSystemMetrics Constants
; AutoIt Version : 3.3.14.5
; Language ......: English
; Description ...: Constants for _WinAPI_GetSystemMetrics().
; Author(s) .....: ScriptJunky
; ===============================================================================================================================

; #CONSTANTS# ===================================================================================================================
; _WinAPI_GetSystemMetrics()

Global Const $ARRANGE = 56
Global Const $CLEANBOOT = 67
Global Const $CMONITORS = 80
Global Const $CMOUSEBUTTONS = 43
Global Const $CONVERTIBLESLATEMODE = 0x2003
Global Const $CXBORDER = 5
Global Const $CXCURSOR = 13
Global Const $CXDLGFRAME = 7
Global Const $CXDOUBLECLK = 36
Global Const $CXDRAG = 68
Global Const $CXEDGE = 45
Global Const $CXFIXEDFRAME = 7
Global Const $CXFOCUSBORDER = 83
Global Const $CXFRAME = 32
Global Const $CXFULLSCREEN = 16
Global Const $CXHSCROLL = 21
Global Const $CXHTHUMB = 10
Global Const $CXICON = 11
Global Const $CXICONSPACING = 38
Global Const $CXMAXIMIZED = 61
Global Const $CXMAXTRACK = 59
Global Const $CXMENUCHECK = 71
Global Const $CXMENUSIZE = 54
Global Const $CXMIN = 28
Global Const $CXMINIMIZED = 57
Global Const $CXMINSPACING = 47
Global Const $CXMINTRACK = 34
Global Const $CXPADDEDBORDER = 92
Global Const $CXSCREEN = 0
Global Const $CXSIZE = 30
Global Const $CXSIZEFRAME = 32
Global Const $CXSMICON = 49
Global Const $CXSMSIZE = 52
Global Const $CXVIRTUALSCREEN = 78
Global Const $CXVSCROLL = 2
Global Const $CYBORDER = 6
Global Const $CYCAPTION = 4
Global Const $CYCURSOR = 14
Global Const $CYDLGFRAME = 8
Global Const $CYDOUBLECLK = 37
Global Const $CYDRAG = 69
Global Const $CYEDGE = 46
Global Const $CYFIXEDFRAME = 8
Global Const $CYFOCUSBORDER = 84
Global Const $CYFRAME = 33
Global Const $CYFULLSCREEN = 17
Global Const $CYHSCROLL = 3
Global Const $CYICON = 12
Global Const $CYICONSPACING = 39
Global Const $CYKANJIWINDOW = 18
Global Const $CYMAXIMIZED = 62
Global Const $CYMAXTRACK = 60
Global Const $CYMENU = 15
Global Const $CYMENUCHECK = 72
Global Const $CYMENUSIZE = 55
Global Const $CYMIN = 29
Global Const $CYMINIMIZED = 58
Global Const $CYMINSPACING = 48
Global Const $CYMINTRACK = 35
Global Const $CYSCREEN = 1
Global Const $CYSIZE = 31
Global Const $CYSIZEFRAME = 33
Global Const $CYSMCAPTION = 51
Global Const $CYSMICON = 50
Global Const $CYSMSIZE = 53
Global Const $CYVIRTUALSCREEN = 79
Global Const $CYVSCROLL = 20
Global Const $CYVTHUMB = 9
Global Const $DBCSENABLED = 42
Global Const $DEBUG = 22
Global Const $DIGITIZER = 94
Global Const $IMMENABLED = 82
Global Const $MAXIMUMTOUCHES = 95
Global Const $MEDIACENTER = 87
Global Const $MENUDROPALIGNMENT = 40
Global Const $MIDEASTENABLED = 74
Global Const $MOUSEPRESENT = 19
Global Const $MOUSEHORIZONTALWHEELPRESENT = 91
Global Const $MOUSEWHEELPRESENT = 75
Global Const $NETWORK = 63
Global Const $PENWINDOWS = 41
Global Const $REMOTECONTROL = 0x2001
Global Const $REMOTESESSION = 0x1000
Global Const $SAMEDISPLAYFORMAT = 81
Global Const $SECURE = 44
Global Const $SERVERR = 289
Global Const $SHOWSOUNDS = 70
Global Const $SHUTTINGDOWN = 0x2000
Global Const $SLOWMACHINE = 73
Global Const $STARTER = 88
Global Const $SWAPBUTTON = 23
Global Const $TABLETPC = 86
Global Const $XVIRTUALSCREEN = 76
Global Const $YVIRTUALSCREEN = 77

 

WinAPISystemMetricsConstants.au3

Share this post


Link to post
Share on other sites
spudw2k
ScriptJunky
On 6/17/2018 at 7:39 PM, spudw2k said:

Thanks for sharing.  Might I suggest appending SM_ to the constants?

Here ya go!

#include-once

; #INDEX# =======================================================================================================================
; Title .........: WinAPI GetSystemMetrics Constants
; AutoIt Version : 3.3.14.5
; Language ......: English
; Description ...: Constants for _WinAPI_GetSystemMetrics().
; Author(s) .....: ScriptJunky
; ===============================================================================================================================

; #CONSTANTS# ===================================================================================================================
; _WinAPI_GetSystemMetrics()

Global Const $SM_ARRANGE = 56
Global Const $SM_CLEANBOOT = 67
Global Const $SM_CMONITORS = 80
Global Const $SM_CMOUSEBUTTONS = 43
Global Const $SM_CONVERTIBLESLATEMODE = 0x2003
Global Const $SM_CXBORDER = 5
Global Const $SM_CXCURSOR = 13
Global Const $SM_CXDLGFRAME = 7
Global Const $SM_CXDOUBLECLK = 36
Global Const $SM_CXDRAG = 68
Global Const $SM_CXEDGE = 45
Global Const $SM_CXFIXEDFRAME = 7
Global Const $SM_CXFOCUSBORDER = 83
Global Const $SM_CXFRAME = 32
Global Const $SM_CXFULLSCREEN = 16
Global Const $SM_CXHSCROLL = 21
Global Const $SM_CXHTHUMB = 10
Global Const $SM_CXICON = 11
Global Const $SM_CXICONSPACING = 38
Global Const $SM_CXMAXIMIZED = 61
Global Const $SM_CXMAXTRACK = 59
Global Const $SM_CXMENUCHECK = 71
Global Const $SM_CXMENUSIZE = 54
Global Const $SM_CXMIN = 28
Global Const $SM_CXMINIMIZED = 57
Global Const $SM_CXMINSPACING = 47
Global Const $SM_CXMINTRACK = 34
Global Const $SM_CXPADDEDBORDER = 92
Global Const $SM_CXSCREEN = 0
Global Const $SM_CXSIZE = 30
Global Const $SM_CXSIZEFRAME = 32
Global Const $SM_CXSMICON = 49
Global Const $SM_CXSMSIZE = 52
Global Const $SM_CXVIRTUALSCREEN = 78
Global Const $SM_CXVSCROLL = 2
Global Const $SM_CYBORDER = 6
Global Const $SM_CYCAPTION = 4
Global Const $SM_CYCURSOR = 14
Global Const $SM_CYDLGFRAME = 8
Global Const $SM_CYDOUBLECLK = 37
Global Const $SM_CYDRAG = 69
Global Const $SM_CYEDGE = 46
Global Const $SM_CYFIXEDFRAME = 8
Global Const $SM_CYFOCUSBORDER = 84
Global Const $SM_CYFRAME = 33
Global Const $SM_CYFULLSCREEN = 17
Global Const $SM_CYHSCROLL = 3
Global Const $SM_CYICON = 12
Global Const $SM_CYICONSPACING = 39
Global Const $SM_CYKANJIWINDOW = 18
Global Const $SM_CYMAXIMIZED = 62
Global Const $SM_CYMAXTRACK = 60
Global Const $SM_CYMENU = 15
Global Const $SM_CYMENUCHECK = 72
Global Const $SM_CYMENUSIZE = 55
Global Const $SM_CYMIN = 29
Global Const $SM_CYMINIMIZED = 58
Global Const $SM_CYMINSPACING = 48
Global Const $SM_CYMINTRACK = 35
Global Const $SM_CYSCREEN = 1
Global Const $SM_CYSIZE = 31
Global Const $SM_CYSIZEFRAME = 33
Global Const $SM_CYSMCAPTION = 51
Global Const $SM_CYSMICON = 50
Global Const $SM_CYSMSIZE = 53
Global Const $SM_CYVIRTUALSCREEN = 79
Global Const $SM_CYVSCROLL = 20
Global Const $SM_CYVTHUMB = 9
Global Const $SM_DBCSENABLED = 42
Global Const $SM_DEBUG = 22
Global Const $SM_DIGITIZER = 94
Global Const $SM_IMMENABLED = 82
Global Const $SM_MAXIMUMTOUCHES = 95
Global Const $SM_MEDIACENTER = 87
Global Const $SM_MENUDROPALIGNMENT = 40
Global Const $SM_MIDEASTENABLED = 74
Global Const $SM_MOUSEPRESENT = 19
Global Const $SM_MOUSEHORIZONTALWHEELPRESENT = 91
Global Const $SM_MOUSEWHEELPRESENT = 75
Global Const $SM_NETWORK = 63
Global Const $SM_PENWINDOWS = 41
Global Const $SM_REMOTECONTROL = 0x2001
Global Const $SM_REMOTESESSION = 0x1000
Global Const $SM_SAMEDISPLAYFORMAT = 81
Global Const $SM_SECURE = 44
Global Const $SM_SERVERR = 289
Global Const $SM_SHOWSOUNDS = 70
Global Const $SM_SHUTTINGDOWN = 0x2000
Global Const $SM_SLOWMACHINE = 73
Global Const $SM_STARTER = 88
Global Const $SM_SWAPBUTTON = 23
Global Const $SM_TABLETPC = 86
Global Const $SM_XVIRTUALSCREEN = 76
Global Const $SM_YVIRTUALSCREEN = 77

 

WinAPISystemMetricsConstants.au3

Share this post


Link to post
Share on other sites
spudw2k

So, turns out most of those constants are included in the <WindowsConstants.au3> include.  I did some quick analysis and found the discrepancies:

WindowsConstants.au3 is missing:
Global Const $SM_CONVERTIBLESLATEMODE = 0x2003
Global Const $SM_CXFIXEDFRAME = 7
Global Const $SM_CXPADDEDBORDER = 92
Global Const $SM_CXSIZEFRAME = 32
Global Const $SM_CYFIXEDFRAME = 8
Global Const $SM_CYSIZEFRAME = 33
Global Const $SM_DIGITIZER = 94
Global Const $SM_MAXIMUMTOUCHES = 95
Global Const $SM_MOUSEHORIZONTALWHEELPRESENT = 91

WinAPISystemMetricsConstants.au3 is missing:
Global Const $SM_CARETBLINKINGENABLED = 0x2002
Global Const $SM_CMETRICS = 90
Global Const $SM_RESERVED1 = 24
Global Const $SM_RESERVED2 = 25
Global Const $SM_RESERVED3 = 26
Global Const $SM_RESERVED4 = 27

and WinAPISystemMetricsConstants.au3 has a small typo:
Global Const $SM_SERVERR = 289
should be
Global Const $SM_SERVERR2 = 89 (included in WindowsConstants.au3)

Share this post


Link to post
Share on other sites
mLipok

MSDN reference link please. 

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library
 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-10-31

Share this post


Link to post
Share on other sites
spudw2k

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

    • VADemon
      By VADemon
      I've encountered a problem with a single file where I cannot retrieve it's Date-time. So far my code has worked well for over 30 files, but this one is a mystery I cannot debug myself due to insufficient Au3 knowledge.
      In line 11 "_Date_Time_FileTimeToArray" is called and for this particular file it sets the @error to 10. I don't know what that error code means, but it's not set by the _Date functions themselves I think.
      Overall, it could be a problem caused by any of the functions below, how can I properly debug this? / Does anybody know a what's causing this?
      _WinAPI_CreateFile() / _Date_Time_GetFileTime() / _Date_Time_FileTimeToArray()
      Func _SetFileTimes($sFilePath) Local $monthNumber[13] = ["", "January", "February", "March", "April", "May", "Juny", "July", "August", "September", "October", "November", "December"] Local $dayNumber[7] = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] Local $fHandle = _WinAPI_CreateFile($sFilePath, 2, 2) ; read-only ; may NOT return a valid date for some reason! TODO Local $fTagFILETIME = _Date_Time_GetFileTime($fHandle) _WinAPI_CloseHandle($fHandle) ; This will return an empty array if theres no valid date $fModTime = _Date_Time_FileTimeToArray($fTagFILETIME[2]) ; last Modified if @error <> 10 then Local $year = $fModTime[2] Local $month = $fModTime[0] Local $day = $fModTime[1] Local $hour = $fModTime[3] Local $min = $fModTime[4] Local $sec = $fModTime[5] Local $ms = $fModTime[6] Local $weekday = $fModTime[7] Global $prettyTimestamp = StringFormat("%s, %s %d, %04d %02d:%02d:%02d", $dayNumber[$weekday], $monthNumber[$month], $day, $year, $hour, $min, $sec) Global $uploadDate = StringFormat("%04d-%02d-%02d", $year, $month, $day) $fModTime = _Date_Time_FileTimeToArray(_Date_Time_FileTimeToLocalFileTime($fTagFILETIME[2])) ; last Modified Local $year = $fModTime[2] Local $month = $fModTime[0] Local $day = $fModTime[1] Local $hour = $fModTime[3] Local $min = $fModTime[4] Local $sec = $fModTime[5] Local $ms = $fModTime[6] Local $weekday = $fModTime[7] ; GetUnixTime accounts for Local time, hence feed it local time Global $unixTimestamp = _GetUnixTime($year &"/"& $month &"/"& $day &" "& $hour&":"& $min &":"& $sec) else Global $prettyTimestamp = "N/A" Global $uploadDate = "" Global $unixTimestamp = "N/A" endif endfunc  
      _GetUnixTime returned the year 1601 start date, showing that $fModTime is probably equal 0. (But Why?)
      The file reports these dates in Explorer, it's on local NTFS drive:
      Created: ‎‎Wednesday, ‎31. ‎Januar ‎2018, ‏‎18:55:02
      Modified: ‎Wednesday, ‎10. ‎Januar ‎2018, ‏‎12:39:23
      Accessed: ‎Wednesday, ‎10. ‎Januar ‎2018, ‏‎12:39:23
    • caramen
      By caramen
      I watched _OL_ItemSend&_OL_ItemFind&_OL_ItemCreate in OutlookEx UDF but hmmm
       
      Since it use the test environnement i cant get the orders of the mail creation
       
      Can someone make me win some time of reading all exemples script and lead me how to do one ?
      That whould be lovely.
      Gnight
    • Tersion
      By Tersion
      Here the this wiki page with list of available UDFs for data compression. For my tasks I only need ZIP support, so I started looking at pure AutoIt UDFs without any 3rd party dlls. And found out that most of available realizations uses standard ("native method") Windows dll - "zipfldr.dll". So for now I chose ZIP UDF by wraithdu. I've tested it on Windows 7 (x64) and it seem works fine. But here the comment from another topic where user says that Windows 10 discontinued support of "zipfldr.dll". Now I confused. I don't have around any Windows 10 machine to tested it. So maybe someone could confirm or deny that? Or maybe would better to switch to UDF with 7zip dll?
      I need an advice...
    • astrionn
      By astrionn
      Hi Guys,
       
      I`m trying to record with my webcam in 5s intervalls and do some stuff between starting to record and stoping.
      I took code from here: https://www.autoitscript.com/forum/topic/27925-webcam-example/
      and took what looked relevant to me.
      I use 3 different files:
       Is called WMS.au3 and contains all the constants for the dll calls is called rec.au3 and does all necessary dll calls to start a webcam recording to a file Is called stopcam.exe and does the dll calls to stop recording into a file WMS.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 rec.au3  :
       
      #include <WMS.au3> #include <GUIConstants.au3> if not FileExists(@ScriptDir&"\vid\"&string(@MON)&"\"&string(@mday)) Then DirCreate(@ScriptDir&"\vid\"&"\"&string(@MON)&"\"&string(@mday)) EndIf $moviefile = @ScriptDir&"\vid"&"\"&string(@MON)&"\"&string(@mday)&"\test.avi" $avi = DllOpen("avicap32.dll") $user = DllOpen("user32.dll") FileWrite(@scriptdir&"\clop.clop",$user) $Main = GUICreate("Camera",350,270) $moviefile=@ScriptDir&"\test.avi" $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) FileWrite(@scriptdir&"\clip.clip",$cap[0]) run(@scriptdir&"\stopcam.exe") 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) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_FILE_SET_CAPTURE_FILEA, "int", 0, "str", $moviefile) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SEQUENCE, "int", 0, "int", 0) Stopcam.exe is the compiled version of this:
      #include "WMS.au3" #include <GUIConstants.au3> $cap = Int(FileRead(@scriptdir&"\clip.clip")) $user = int(fileread(@scriptdir&"\clop.clop")) Sleep(10000) DllCall($user, "int", "SendMessage", "hWnd", $cap, "int", $WM_CAP_STOP, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap, "int", $WM_CAP_END, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap, "int", $WM_CAP_DRIVER_DISCONNECT, "int", 0, "int", 0) DllClose($user) FileDelete(@scriptdir&"\clip.clip") FileDelete(@scriptdir&"\clop.clop")  
      Unfortunately this is not working as I thought it would be working.
      Does someone see what I´m doing wrong?
      It should record the webcam for about 10 seconds ( a little less) and save that to an .avi file.
      It does not stop the recording , I have to stop the process manually...
      Secondly, which confuses me more is that it creates the test.avi not in the location is specified in the script... its stored in the ScriptDir for whatever reason haha
      I hope you can help me
       
      ~HappyCoding
    • TheSaint
      By TheSaint
      Here is the bare bones of a UDF I have started work on.
      Mostly just a proof of concept at this stage, and still need to add some functions and dress the UDF up a bit ... to look like a UDF ... though it has my own distinct styling, especially as I have never really developed a UDF before now .... used plenty and modified plenty though. I've even invented my own UDF variable naming convention, which I am sure some of you will be aghast at. I work with what feels best for me, but others are free to adapt if they wish.
      The idea is to emulate the simplicity of INI files, but gain the benefits of SQL.
      Two scripts are provided.
      (1) The UDF, a work in progress - SimpleSQL_UDF.au3
      (2) An example or testing script - UDF_Test.au3
      Another first for me, is creating a 2D array from scratch, never done that before, that I can recall ... never had a need, and even for 1 dimension arrays, for a long time now, I have just used _StringSplit to create them. So I needed a bit of a refresher course, which my good buddy @TheDcoder assisted me with ... not without some angst I might add. LOL
      SimpleSQL_UDF.zip  (12 downloads previously)
      (I have now completed all the functions I intended to. My next update will be a big improvement, bringing things more inline with my latest INItoSQL DB program changes.)
      Program requires the sqlite3.dll, not included, but easily enough obtained.
      Hopefully the usage is self-evident ... just change the Job number variable in the UDF_Test.au3 file to check the existing functions out.
      Enjoy!
      P.S. This is also related to a new program I have just finished and uploaded - INItoSQL DB
×