![]() |
|||
Version 3.34 © 1997-2005 by CapeSoft Software (Pty) Ltd www.capesoft.com Updated Friday 20 January 2006 |
|||
Enabling
WinEvent Functions
WinAlert
Functions
Comm's
Functions
Taskbar
Functions
Window
Behavior Functions
Windows
System Functions
RAM
& Disk
Functions
Time
& Date
Functions
File
Functions
Process
& Thread
Functions
DLL
Functions
SMS
Functions
Debugging
& Error Reporting
Functions
Auto-Shutdown
Functions
Other
Functions
Reference
Section
Frequently
Asked Questions (FAQ's)
Version
History
Welcome to WinEvent. This small library package allows you to leverage the power
of the Windows API. In addition to the WinAlert functions (which allow you access
to the native Windows messages) there are also now Comm's (RS232) functions, Taskbar
functions and Windows Behaviour & System functions.
All the functionality provided in WinEvent is built into Windows itself in one
way or another. The main advantage of WinEvent is two fold.
Main Advantages |
|||
|
It provides the functions in a simple easy-to-use manner, avoiding the complexities of the Windows API. | ||
|
The functions are (mostly) cross-compatible between 16 and 32 bit implementations of your program. The Taskbar functions and some advanced Comm's functions are only available in 32 bit programs, but all the other functions are the same in 16 and 32 bit programs. | ||
WinEvent functionality is divided into 5 areas:
Functionality |
|||
|
Windows message capturing
functions (WinAlert) WinAlert allows your CW programs more access to the native Window messages. This is in itself nothing new. Using the sub-classing technique access to the Windows messages has been available since almost the first days of CW. WinAlert provides a simple wrapper to subclassing, which removes the complexities and makes the code both simple to follow, easy to implement, and consistent with the rest of the Clarion language. In essence one new major function, and a couple of support functions allow the flexibility and ease of use that we've come to expect from Clarion. In addition it comes with a template that makes adding this wrapper to your applications even easier. You can use the template to alert messages on individual windows. In addition a utility template makes it possible to enable Auto Shut Down across your entire application. |
||
|
RS 232 Port functions Very often developers need simple access to a Comm's port. This simple functionality is built into the Windows API, but is quite complex ad difficult to code. In addition to this the APIs for 16 bit and 32 bit Windows are very different. The Comm's section of the WinEvent package provides some simple easy-to-use functions that allow you to read and write to Comm's ports. In addition almost all the functions are the same in 16 and 32 bit ( the library takes care of the API differences ) so it's easier to move from one platform to another. The library also corrects a bug in the Windows functions that affect Comm's at speeds of greater than 19200. Some advanced functions to test specific hardware handshaking lines for their current status are only supported in 32 bit as no 16 bit equivalent exists. |
||
|
Taskbar functions Users of Windows 95, and Windows NT 4.0, will be familiar with the Taskbar that usually sits at the bottom of the screen. The taskbar functions allow you to add / change and delete an icon from the "Tray" ( the area at the right hand side of the taskbar ) as well as detect when the mouse has been clicked on an icon in the tray. This is very useful for apps which are running in the background on a full time basis. In addition, you can make use of a function that prevents your program from appearing on the main area of the Taskbar itself. |
||
|
Window behaviour functions A small group of functions that allow you to change the behaviour of a window. This includes the ability to make a window permanently "on top", and also the ability to bring the window to the front. |
||
|
System functions These functions return system information to your application. The Windows, and Dos (if applicable) version numbers are available to your application. Also you are able to get the current free disk space in 16 and 32 bit. This is useful for detecting low disk space conditions before they occur. A function for playing a wav file is also included. |
||
WinEvent is copyrighted © 2004 by CapeSoft Software (Pty) Ltd. CapeSoft Software
(Pty) Ltd assumes no responsibility for applications created which incorporate
WinEvent. WinEvent is used entirely at your own risk. You may not distribute any
of the WinEvent files.
Each developer needs his own license to use WinEvent. (Need to buy
more licenses?)
We welcome your comments, suggestions, and criticisms. Please do not hesitate
to contact us if you have a problem, or a suggestion.
You can contact CapeSoft in one of the following ways:
CapeSoft Support |
|||
![]() |
|||
Telephone | +27 21 715 4000 | ||
Fax | +27 21 715 2535 | ||
Post | PO Box 511, Plumstead, 7801, Cape Town, South Africa | ||
Purchase WinEvent at $149.00 from:
CapeSoft Sales |
|||
Web | www.capesoft.com | ||
sales@capesoft.com | |||
Telephone | +27 21 715 4000 | ||
Fax | +27 21 715 2535 | ||
Post | PO Box 511, Plumstead, 7801, Cape Town, South Africa | ||
Buy Online |
|||
Web | |||
To install WinEvent, run the supplied installation file and follow the prompts.
You are free to distribute the WinEvent DLLs with any of your Applications without
extra charge.
The DLLs your program require will depend on your version of Clarion. Note that
programs compiled in Local Mode do not use DLLs and therefore there is
nothing extra for you to distribute.
DLLs required (Standalone mode only) |
|||
Clarion Version
|
DLL required | ||
Clarion 6 | WE60X.DLL | ||
Clarion 5.5 | WE55X.DLL | ||
Clarion 5 | EVENT532.DLL | ||
This manual is split into two sections. This first section contains a general
overview of the WinEvent features. Each of the WinEvent function areas is dealt
with and the templates provided are discussed here.
The second section is the Technical Reference. In this section the individual
functions are described, along with their syntax. This is particularly useful
as most of these functions are designed to be used in simple embed points etc.
Included in the WinEvent package is a simple example program that demonstrates all of WinEvent's features. This example is in the \Clarion\3rdParty\Examples\Winevent\Windemo directory and is called WinDemo.
There is also an example of a barcode collector
program. This is stored in \Clarion\3rdParty\Examples\Winevent\Barcode
To use the WinEvent functions in your application you must first enable them. This is done by selecting the Global Properties option from the Application dropdown menu, selecting the Extensions button then the Insert button, scrolling down the extension options and then selecting EnableWinEvent - Enable the WinEvent functions in your app.
Once the WinEvent functions have been enabled in your application, you can use the Auto-Shutdown on tick box to apply the automatic shutdown function to your application. This will then be globally applied to the application.
First some terminology. An Event is the Clarion word for a message that is provided
to you via the ACCEPT loop. A Message is the Windows equivalent. Part of the job
of the Accept command is to filter out many of these Messages, and pass on only
those Events that are usually required.
The idea is to use a new function, called WinAlert in the same way you would use
the Alert function for keystrokes. This allows you to get at the messages before
the Accept command does, taking further action where it is required. In addition
to simply spotting the message, you can also specify its action at the same time.
Some messages require an immediate reply (usually True or False) to the procedure
that sent the message. However most messages would be required simply so that
you can gain more control over the things that are happening. In this case a user
event, is posted to the Accept loop, after storing the value of the Message.
To further complicate the issue Messages can also have additional data tagged
on with them. This data is stored in 2 variables, often going by the somewhat
cryptic names of wParam and lParam. The w and l represent the data type (w for
Word - ie a Short (16bit programs) or Long (32 bit programs) and l for Long). On receiving the User event, WinMessageEvent
you can use 2 new support functions, WinParam1() and WinParam2() to get the values
of these parameters when the message arrived, as well as the Winevent() function
to see which windows message triggered the event.
One of the most frequently asked questions on the Internet's cw-talk mailing list, is "How do I get my application to terminate automatically when the user shuts down Windows ?" Using WinEvent the answer is both simple and elegant.
Once the WinEvent functions have been enabled, use the Extension Alert Window Messages utility template to enable Auto Shutdown (only if has not been set globally).
If Auto Shutdown has been globally set for your application, this option will enable you to disable the Auto Shutdown for when a selected window is the focus window (i.e. a window that requires you to save information before closing).
You simply add the following line of code in the "After Opening Window" embed of your window.
WinAlert(WM_QueryEndSession,,Return1)
and the following in the "Before Closing Window" embed.
WinAlert()
Note: You need to add these lines to all windows that may be open at the time that Windows is shut down. If a window without this code is open, and has the focus, then the application will not shut down.
Basically when you ask Windows to shut itself down it polls each running application by sending it the WM_QueryEndSession message. If all the applications respond by returning True, then they are each, in turn, instructed to close. In the above line of code you are telling the WinEvent library, that when the window receives this message, then it must return True. The utility template automatically adds an instance of the WinEvent extension template to each of your procedures.
The WinEvent extension template, which is included, assist's you in using the WinAlert functions. It organizes in one place the three items that are required, namely Alerting the message, handling any action that may be required, and unAlerting the message before closing the window. The template leads you through the options that you have, and provides you with the required embed point for processing the WinMessageEvent. You may alert as many Windows messages as you like.
This details how to add WinAlert functionality to a hand-coded project. For a
detailed description of each of the functions, see the Reference section of this
document.
Adding WinAlert to a function |
|||
|
Use the WinAlert function to alert the message. This should be called before the Accept command, but after the window is opened. | ||
|
Use the WinAlert function, with no parameters, before Closing the window. | ||
|
Use the WinEvent's WinControl, WinParam1 and WinParam2 functions to examine the message. | ||
Enabling WinAlert in the root module |
|||
|
Include the (supplied in \clarion\libsrc ) map file, EventMap.Clw, in your Global Map. | ||
|
Include the (supplied in \clarion\libsrc ) equates file, EventEqu.Clw in your main module's data section. | ||
|
Clarion 5: Add the Event532.Lib file to your project
for Stand-Alone compile mode or EvLib532.Lib for Local compiles.
All these library files are in your \clarion5\3rdparty\lib directory. Clarion 5.5: Add the we55x.Lib file to your project for Stand-Alone compile mode or we55xL.Lib for Local compiles. All these library files are in your \clarion 55\3rdparty\lib directory. Clarion 6: Add the we60x.Lib file to your project for Stand-Alone compile mode or we60xL.Lib for Local compiles. All these library files are in your \clarion 60\3rdparty\lib directory. |
||
Note: A WinEvent Demo has been included with WinEvent (\Clarion X\3rdParty\examples\WinEvent\Demo\windemo.app) and can be used to view how these features can be used.
Using Comms functions in a hand-coded project |
|||
|
Include the (supplied in \clarion\libsrc ) map file, EventMap.Clw, in your Global Map. | ||
|
Include the (supplied in \clarion\libsrc ) equates file, EventEqu.Clw in your main module's data section. | ||
|
Clarion 5: Add
the Event532.Lib file to your project for Stand-Alone compile mode or EvLib532.Lib
for Local compiles. All these library files are in your \clarion5\3rdparty\lib
directory. Clarion 5.5: Add the we55x.Lib file to your project for Stand-Alone compile mode or we55xL.Lib for Local compiles. All these library files are in your \clarion55\3rdparty\lib directory. Clarion 6: Add the we60x.Lib file to your project for Stand-Alone compile mode or we60xL.Lib for Local compiles. All these library files are in your \clarion6\3rdparty\lib directory. |
||
Newport
ReadPort
WritePort
ResetPort
ClosePort
KillAllPorts
SetHandShake
CtsHigh
DsrHigh
RingHigh
CdHigh
SetRts
SetDtr
For a detailed description of each of the functions, see the reference section.
There are a number of Taskbar functions which allow your application to interact with the Windows Taskbar. These functions allow you to add icons to the Taskbar's tray, add balloon text, menu option and also allow you to prevent your application (icon) from appearing on the taskbar.
WinTaskbarAddIcon
WinTaskbarChangeIcon
WinTaskbarRemoveIcon
WinNotOnTaskbar
ds_WinTaskbarBalloon
For a detailed description of each of the functions, see the reference section.
An Extension template has been provided to add an icon to the tray. This icon
will automatically be put in the tray when the window is opened, and automatically
removed when the window is closed. You can also use the functions in hand code
to add, change and remove icons at will.
If you place an Icon in the tray, then you will also probably want to capture
mouse events when the user interacts with this icon. In WinEvent this is done
automatically for you. The template also takes care of all the details - there
are embed points so you can add your code for the event, and there are buttons
on the AddIcon template to easily get to those embed points.
Tip: Use the Mouse Right Up embed point for opening a Pop-up menu.
Note : The message is ultimately processed by the Accept command. If your
program spends a long time processing between calls to the Accept loop then you
may notice a delay between clicking on the Icon, and the execution of your embedded
code. For better responses make sure your program frequently returns to the Accept
command.
Note: If you have hand-coded handling these events then you should be aware that the method has changed and your old code will no longer work. In the past the event came through as WinMessageEvent. This has been changed - the mouse events are now separated and come through as WinMessageEvent+500+x where x is 512 (mouse move) or 513(mouse left down) or 514(mouse left up) or 515(double left click) or 516(mouse right down) or 517(mouse right up).
WinOnTop
WinNotOnTop
WinBringToFront
ds_WinTransparent
ds_VisibleOnDesktop
ds_ShowWindow
ds_HideWindow
For a detailed description of each of the functions, see the reference section.
ds_GetWinVersion
WindowsVersion
WindowsRelease
DosVersion
DosRelease
Sound
GetWindowsDir
GetSystemWindowsDir
ScreenWidth
ScreenHeight
ScreenDepth
ds_GetScreenDPI
For a detailed description of each of the
functions, see the reference section.
GetFreeDiskSpace
GetDiskSpace
ds_GetDiskMegs
ds_Memory
For a detailed description of each of the
functions, see the reference section.
ds_FastClock
ds_FormatFastTime
ds_Timer
ds_Sleep
ds_WeekDay
ds_ReadCPUTimeStamp
For a detailed description of each of the
functions, see the reference section.
ds_DeleteFile
ds_GetFileDirEntry
ds_SetFileAttributes
ds_CreateDirectory
ds_RemoveDirectory
ds_SetFileDateTime
ds_MoveFile
ds_GetFolderPath
ds_GetTempPath
ds_String2File
ds_File2String
ds_GetHModule
ds_GetHIcon
ds_CreateShortcut
ds_GetFileVersionInfo
For a detailed description of each of the
functions, see the reference section.
ds_GetCurrentProcess
ds_GetCurrentThread
ds_GetProcessTime
ds_GetThreadTime
ds_SetRealTimePriority
For a detailed description of each of the
functions, see the reference section.
ds_LoadDLLProc
ds_UnloadDLLProc
ds_GetDLLVersion
For a detailed description of each of the
functions, see the reference section.
ds_GSMSendSMS
ds_GSMEnterPin
ds_GSMEchoOFF
ds_GSMSetSMSTextmode
ds_GetGSMReply
ds_EmptyPort
ds_GSMReadSMSInit
ds_GSMReadSMS
ds_GSMDeleteSMS
ds_GSMSetSMSReporting
ds_GSMSelectSR
ds_GSMReadSMSReportInit
ds_GSMReadSMSReport
ds_GSMDeleteSMSReport
ds_GSMReadEvents
ds_GSMSetEvents
ds_GSMReset
For a detailed description of each of the
functions, see the reference section.
ds_Debug
ds_WineventDebug
ds_ViewDebug
ds_ViewDebugClose
ds_Error
ds_ErrorCode
ds_ErrorReset
ds_SaveStack
ds_TestStack
For a detailed description of each of the
functions, see the reference section.
ds_SetOKToEndSessionHandler
ds_SetEndSessionHandler
ds_SetNoEndSession
For a detailed description of each of the
functions, see the reference section.
ds_FormatHex
ds_SetClipboard
ds_ShutDown
ds_WineventVersion
ds_Ulong64ToReal
For a detailed description of each of the
functions, see the reference section.
WinAlert
Winevent
WinControl
WinParam1
WinParam2
WinChangeUserEvent
WinSysEvent
WinSysParam1
WinSysParam2
WinWtsEvent
WinWtsID
NewPort
ResetPort
ClosePort
KillAllPorts
WritePort
ReadPort
SetHandShake
CtsHigh
DsrHigh
RingHigh
CdHigh
SetRts
SetDtr
WinTaskBarAddIcon
WinTaskBarRemoveIcon
WinTaskBarChangeIcon
WinNotOnTaskBar
ds_WinTaskbarBalloon
WinOnTop
WinNotOnTop
WinBringToFront
ds_WinTransparent
ds_VisibleOnDesktop
ds_GetWinVersion
WindowsVersion
WindowsRelease
DosVersion
DosRelease
GetFreeDiskSpace
GetDiskSpace
Sound
GetWindowsDir
GetSystemWindowsDir
ScreenWidth
ScreenHeight
ScreenDepth
ds_GetScreenDPI
ds_FastClock
ds_FormatFastTime
ds_Timer
ds_Sleep
ds_WeekDay
ds_DeleteFile
ds_GetFileDirEntry
ds_SetFileAttributes
ds_CreateDirectory
ds_RemoveDirectory
ds_SetFileDateTime
ds_MoveFile
ds_GetFolderPath
ds_GetTempPath
ds_String2File
ds_File2String
ds_GetHModule
ds_GetHIcon
ds_CreateShortcut
ds_GetFileVersionInfo
ds_LoadDLLProc
ds_UnloadDLLProc
ds_GSMSendSMS
ds_GSMEnterPin
ds_GSMEchoOFF
ds_GSMSetSMSTextmode
ds_GetGSMReply
ds_EmptyPort
ds_GSMReadSMSInit
ds_GSMReadSMS
ds_GSMDeleteSMS
ds_GSMSetSMSReporting
ds_GSMSelectSR
ds_GSMReadSMSReportInit
ds_GSMReadSMSReport
ds_GSMDeleteSMSReport
ds_GSMReadEvents
ds_GSMSetEvents
ds_GSMReset
ds_Debug
ds_WineventDebug
ds_ViewDebug
ds_ViewDebugClose
ds_Error
ds_ErrorCode
ds_ErrorReset
ds_SaveStack
ds_TestStack
WinAlert : For alerting windows messages
WinEvent : For handling standard windows messages.
WinWtsEvent : For handling the wm_WTSSESSION_CHANGE windows message.
Value | Meaning |
---|---|
WTS_CONSOLE_CONNECT 0x1 |
A session was connected to the console session. |
WTS_CONSOLE_DISCONNECT 0x2 |
A session was disconnected from the console session. |
WTS_REMOTE_CONNECT 0x3 |
A session was connected to the remote session. |
WTS_REMOTE_DISCONNECT 0x4 |
A session was disconnected from the remote session. |
WTS_SESSION_LOGON 0x5 |
A user has logged on to the session. |
WTS_SESSION_LOGOFF 0x6 |
A user has logged off the session. |
WTS_SESSION_LOCK 0x7 |
A session has been locked. |
WTS_SESSION_UNLOCK 0x8 |
A session has been unlocked. |
WTS_SESSION_REMOTE_CONTROL 0x9 |
A session has changed its remote controlled status.
To determine the status, call |
WinAlert : For alerting windows messages
WinEvent : For handling standard windows messages.
WinSysEvent : For handling the wm_SYSCOMMAND windows message.
mode ( string ) : This is a mode string such as would be accepted by the Dos MODE
command.
in buffer size (long) ( optional parameter - default 512 bytes )
out buffer size (long) ( optional parameter - default 512 bytes )
These are the sizes Windows must use for the In and Out buffers.
pUseEvents (byte) (optional parameter - default = 0)
When set (TRUE) the current window will receive com events.
Comms transmit buffer empty event = WinEventMessage + 5601
Comms characters received = WinEventMessage + 5602
Comms handshaking lines changed = WinEventMessage + 5602
Returns :
Long
<0 if an error has occurred. Otherwise a port number used by readport and writeport.
Parameters
pText (string) : The balloon text. If no balloon text is supplied then any open balloon is closed. Embedding '<13,10>' in the text produces multiline text.
pTitle (string) : Optional. The balloon title. Icons only appear if the title is supplied.
pFlags (uLong) : Optional. Default = 1 (An information icon).
NIIF_ERROR EQUATE(003h) An error icon.
NIIF_INFO EQUATE(001h) An information icon. (Default)
NIIF_NONE EQUATE(000h) No icon.
NIIF_WARNING EQUATE(002h) A warning icon.
NIIF_NOSOUND EQUATE(010h) XP only. Do not play the associated sound.
pTimeout (ulong) : Optional. Default=1500 (15 seconds). Balloon minimum
display time in 100ths of a second. (clarion time)
To hide the window
window{prop:iconize} = TRUE
window{prop:hide} = TRUE
To unhide the window
window{prop:hide} = FALSE
window{prop:iconize} = FALSE
Note that the order of the hide / iconize commands is important
pGrabFocus (byte) : Optional. Defaults to TRUE. When set you window takes focus and so keyboard input goes to your window.
Returns
None.
Returns
pWinY (*long) : Optional. If omitted then the current target window is used. If supplied then the variable is updated.
pWinWidth (*long) : Optional. If omitted then the current target window is used. If supplied then the variable is updated.
pWinHeight (*long) : Optional. If omitted then the current target window is used. If supplied then the variable is updated.
pMode (long) : Optional. Default=1 When set this flags that
the window must not be obscured by the taskbar.
Win XXX
...............
pSelector (string) : Optional. Defaults to 'USER FREE' This modifies the returned disk size.
'USER FREE' Returns the free disk space
available to the current user.
'TOTAL'
Returns the total disk size.
'TOTAL FREE' Returns the free disk space on the
drive.
pSelector (string) : Optional. Defaults to 'USER' This specifies which RAM size is returned.
'USER'
Returns the virtual memory used by this application.
'SWAP USED' Returns the page file used
kBytes.
'SWAP FREE' Returns the page file free
kBytes.
'SWAP TOTAL' Returns the page file total
kBytes.
'RAM USED' Returns
the physical RAM used kBytes.
'RAM FREE' Returns
the physical RAM free kBytes.
'RAM TOTAL' Returns the
physical RAM total kBytes.
'VMEM USED' Returns the virtual memory
used kBytes.
'VMEM FREE' Returns the virtual memory
free kBytes.
'VMEM TOTAL' Returns the virtual memory
total kBytes.
UseCPUTimeStamp (byte) : Optional, Default = FALSE. If set then the
ds_ReadCPUTimeStamp() function is used to return the time down to a resolution
of the CPU clock. (1 GHz = 1ns resolution)
ReSyncTime (byte) : Optional, Default = FALSE. Use (once) when time has
been adjusted and so ds_FastClock <> Clock().
pFastTime (real) : The time in 100 ths of a second (clarion time).
pDecimalPlaces (long) : Optional. The number of decimal places to display.
pFastTime (real) : The time in 100 ths of a second (clarion time) for which
to sleep.
pTimerNumber (long) : Used to specify multiple timers (per thread)
pFastTime (real) : The time in 100 ths of a second (clarion time).
Returns
pDate (long) : The date for which the week day is required. (Clarion date)
pShortFormatFlag (byte) : Optional. If TRUE(1) then the short name for
the day is returned. "Wednesday" would return as "Wed"
Returns
pSaveREal (*real) : The 64 bit number returned by the CPU is saved into this real. Will overflow after 52 bits. (50 days at 1GHz)
pSaveREal (*real) : The 64 bit number returned by the CPU is saved into this real. Will overflow after 52 bits. (50 days at 1GHz)
pFileName (string) : Specify the file (with path) to delete.
Returns
code
ds_DeleteFile('c:\FileName.ext')
pFileName (string) : Specify the file (with path) for which the directory entry data is required.
pEntryG (*string) : Provide the lable of an EntryG structure. See example below.
Returns
EntryG group,PRE(EntryG)
name STRING(256)
shortname string(13)
date
LONG
time
LONG
size
LONG
attrib BYTE
end
code
ds_GetFileDirEntry('c:\FileName.ext',EntryG)
!
fills the EntryG with the files directory attributes.
pFileName (string) : Specify the file (with path) for which the directory entry data is required.
pNewFileAttribs (byte) : Specify the new attributes.
ff_:NORMAL EQUATE(0) !Always active
ff_:READONLY EQUATE(1) !Not for use as attributes parameter
ff_:HIDDEN EQUATE(2)
ff_:SYSTEM EQUATE(4)
ff_:DIRECTORY EQUATE(10H)
ff_:ARCHIVE EQUATE(20H) ! NOT Win95 compatible
Returns
code
ds_SetFileAttributes('c:\FileName.ext',0)
! clears files attributes.
pNewDirectoryName (string) : Specify the name (including path) of the new directory to create.
Returns
code
ds_CreateDirectory('c:\My
New Directory') ! creates the directory
pDirectoryName (string) : Specify the name (including path) of the directory to remove.
Returns
code
ds_RemoveDirectory('c:\My
New Directory') ! removes any empty directory.
pFileName (string) : Specify the file (with path) for which the directory is to be modified.
pNewDate (long) : New date (clarion date) for the file.
pNewTime (long) : New time (clarion time) for the file.
Returns
code
ds_SetFileDateTime('c:\MyFile.txt',today(),clock())
! Sets the files date and time to now.
pFileName (string) : Specify the file (with path) to be moved.
pNewFileName (string) : Specify the new file (with new path).
Returns
code
ds_MoveFile('c:\MyFile.txt','c:\NewDirectory\NewFileName.ext')
! moves and renames the file to the directory.
pCSIDL (long) : A CSIDL equate specifying the windows folder.
pCreateFlag (byte) : Optional. If TRUE (1) then the folder will be created if it does not exist.
CSIDL_DESKTOP equate(000h)
! C:\Documents and Settings\username\Desktop
CSIDL_PROGRAMS equate(002h)
! C:\Documents and Settings\username\Start
Menu\Programs
CSIDL_PERSONAL equate(005h)
! C:\Documents and Settings\username\My
Documents
CSIDL_FAVORITES equate(006h)
! C:\Documents and Settings\username\Favorites
CSIDL_STARTUP equate(007h)
! C:\Documents and Settings\username\Start
Menu\Programs\Startup
CSIDL_RECENT equate(008h)
! C:\Documents and Settings\username\My Recent
Documents
CSIDL_SENDTO equate(009h)
! C:\Documents and Settings\username\SendTo
CSIDL_STARTMENU equate(00Bh)
! C:\Documents and Settings\username\Start Menu
CSIDL_MYMUSIC equate(00Dh)
! C:\Documents and Settings\username\My
Documents\My Music
CSIDL_DESKTOPDIRECTORY equate(010h)
! C:\Documents and
Settings\username\Desktop
CSIDL_NETHOOD equate(013h)
! C:\Documents and Settings\username\NetHood
CSIDL_FONTS equate(014h)
! C:\Windows\Fonts
CSIDL_TEMPLATES equate(015h)
! C:\Documents and Settings\username\Templates
CSIDL_COMMON_STARTMENU equate(016h)
!*C:\Documents and Settings\All
Users\Start Menu
CSIDL_COMMON_PROGRAMS equate(017h)
! C:\Documents and Settings\All
Users\Start Menu\Programs
CSIDL_COMMON_STARTUP equate(018h)
!*C:\Documents and Settings\All
Users\Start Menu\Programs\Startup
CSIDL_COMMON_DESKTOPDIRECTORY equate(019h)
!*C:\Documents and Settings\All
Users\Desktop
CSIDL_APPDATA equate(01Ah)
! C:\Documents and Settings\username\Application
Data
CSIDL_PRINTHOOD equate(01Bh)
! C:\Documents and Settings\username\PrintHood
CSIDL_LOCAL_APPDATA equate(01Ch)
! C:\Documents and Settings\username\Local
Settings\Application Data
CSIDL_ALTSTARTUP equate(01Dh)
!*
CSIDL_COMMON_ALTSTARTUP equate(01Eh)
!*
CSIDL_COMMON_FAVORITES equate(01Fh)
!*C:\Documents and Settings\All
Users\Favorites
CSIDL_INTERNET_CACHE equate(020h)
! C:\Documents and Settings\username\Local
Settings\Temporary Internet Files
CSIDL_COOKIES equate(021h)
! C:\Documents and Settings\username\Cookies
CSIDL_HISTORY equate(022h)
! C:\Documents and Settings\username\Local
Settings\History
CSIDL_COMMON_APPDATA equate(023h)
! C:\Documents and Settings\All
Users\Application Data
CSIDL_WINDOWS equate(024h)
! C:\Windows
CSIDL_SYSTEM equate(025h)
! C:\Windows\System32
CSIDL_PROGRAM_FILES equate(026h)
! C:\Program Files
CSIDL_MYPICTURES equate(027h)
! C:\Documents and Settings\username\My
Documents\My Pictures
CSIDL_PROFILE equate(028h)
!*C:\Documents and Settings\username
CSIDL_PROGRAM_FILES_COMMON equate(02Bh)
!#C:\Program Files\Common
CSIDL_COMMON_TEMPLATES equate(02Dh)
!*C:\Documents and Settings\All
Users\Templates
CSIDL_COMMON_DOCUMENTS equate(02Eh)
! C:\Documents and Settings\All
Users\Documents
CSIDL_COMMON_ADMINTOOLS equate(02Fh)
! C:\Documents and Settings\All
Users\Start Menu\Programs\Administrative Tools
CSIDL_ADMINTOOLS equate(030h)
! C:\Documents and Settings\username\Start
Menu\Programs\Administrative Tools
CSIDL_COMMON_MUSIC equate(035h)
!*C:\Documents and Settings\All
Users\Documents\My Music
CSIDL_COMMON_PICTURES equate(036h)
!*C:\Documents and Settings\All
Users\Documents\My Pictures
CSIDL_CDBURN_AREA equate(03Bh)
!*C:\Documents and Settings\username\Local
Settings\Application Data\Microsoft\CD Burning
Returns
code
DisplayPath = ds_GetFolderPath(CSIDL_PROGRAMS,1)
! C:\Documents and Settings\username\Start Menu\Programs
None.
Returns
code
DisplayPath = ds_GetTempPath()
! C:\WINDOWS\TMP
pWriteString (string) : String to be written to file.
pWriteLen (long) : Optional. The length of the string to be written to file. If omitted then the string is clipped before writing to file.
pFileName (string) : The name of the file (including path).
Returns
code
if ds_String2File('Just
Testing',,'C:\MyTestFile.TXT') ! Creates / empties file and then writes data
to file.
message('ds_string2file failed : ' &
ds_error())
end
pStringRef (ds_StringRef) : The label of a ds_StringRef structure.
pMaxLen (long) : Optional. The max length of the string to be returned. File contents truncated at this length if required.
pFileName (string) : The name of the file (including path).
Returns
TestFileRead GROUP(ds_StringRef)
END
code
if ds_string2file('testing 123...',,'c:\testing.txt')
message('ds_string2file failed : ' & ds_error())
end
if ds_file2string(TestFileRead,,'c:\testing.txt')
message('ds_file2string failed : ' & ds_error())
else
DisplayString = TestFileRead.bin ! string read from file.
DisplayLength = TestFileRead.len ! Length of string read from
file.
end
pIconName (string) : The name of the icon file or icon resource. Compiled-in icon names must be prefixed with '~'.
pHIconModule (ulong) : Optional. A handle to the module containing the icon.
pIconSize (long) : Optional. The size required. Usually 16X16, 32X32 or 48X48. Defaults to 16X16 if it exists.
pTargetFile (string) : The file, including the path, to which a shortcut must
be made.
Example C:\WINDOWS\SYSTEM32\CALC.EXE
pIconName (<string>) : The file, including the path, which contains the icon to be used with this shortcut. If omitted then the first icon in the pTargetFile is used.
pIconIndex (long) : The index of the icon within the pIconName file to use. If omitted then the first icon is used.
pDescription (string) : The tip which will appear if the cursor is held over the shortcut.
pHotKey (long) : The hot key to run the shortcut. Omit or use ZERO if
not required.
Example CTRLALTC
pStartIn (string) : The path to the directory in which the file must be run / opened.
pShortCut (string) : The name for the shortcut.
Example 'Calculator.LNK'
pShortCutPath (<string >) : The destination where the shortcut must be
placed. If omitted then defaults to the desktop.
Example C:\Documents and Settings\Derek\Desktop
pDescription (string) : Default='FileVersion' The name version data required.
Standard descriptions are as follows:
Comments | InternalName | ProductName |
CompanyName | LegalCopyright | ProductVersion |
FileDescription | LegalTrademarks | PrivateBuild |
FileVersion | OriginalFilename | SpecialBuild |
pFileName (*string) : Default=Current Module. The name including path of the file from which version data is required.
Returns
code
DisplayInfo = ds_GetFileVersionInfo() ! returns FileVersion by
default.
pProcName (string) : The name of the DLL procedure. This procedures call address will be returned.
pLibName (string) : The name of the DLL to load.
pProcAddress (ulong) : The call address of the DLL procedure is saved here. Subsequent calls to ds_LoadDLLProc will simply return if this is already set.
pLibInstance (ulong) : Optional. This is used by ds_UnloadDLLProc to
unload the DLL if it is no longer required.
Windows will unload the DLL when your application quits and so this is not
required.
Returns
"Inside global map" - Global embed point
module('windows')
WC_GetDiskFreeSpaceEx(ulong,*dlong,*dlong,*dlong), byte, raw,
pascal, Dll(_fp_) ! The Dll(_fp_) tells the
compiler not to link in this function.
end
"Global Data" - Global embed point
fp_GetDiskFreeSpaceEx
ulong,static,name('WC_GetDiskFreeSpaceEx')
code
if ~ds_LoadDLLProc('GetDiskFreeSpaceExA','kernel32',fp_GetDiskFreeSpaceEx)
result =
WC_GetDiskFreeSpaceEx(0,dlongUserFree,dlongTotal,dlongTotalFree)
...
else
! lib or function not found
message('ds_LoadDLLProc failed : ' & ds_Error())
end
Parameters
pProcAddress (ulong) : The call address of the DLL procedure will be reset. This will force a subsequent call to ds_LoadDLLProc to reload the DLL.
pLibInstance (ulong) : This must be set by ds_LoadDLLProc.
Returns
"Inside global map" - Global embed point
module('windows')
WC_GetDiskFreeSpaceEx(ulong,*dlong,*dlong,*dlong), byte, raw,
pascal, Dll(_fp_) ! The Dll(_fp_) tells the
compiler not to link in this function.
end
"Global Data" - Global embed point
fp_GetDiskFreeSpaceEx
ulong,static,name('WC_GetDiskFreeSpaceEx')
LibInstance
ulong,static
code
if ~ds_LoadDLLProc('GetDiskFreeSpaceExA','kernel32',fp_GetDiskFreeSpaceEx,LibInstance)
result =
WC_GetDiskFreeSpaceEx(0,dlongUserFree,dlongTotal,dlongTotalFree)
...
else
! lib or function not found
message('ds_LoadDLLProc failed : ' & ds_Error())
end
.....
if ds_UnloadDLLProc(fp_GetDiskFreeSpaceEx,LibInstance) ! Unload DLL as no
longer required
message('ds_UnloadDLLProc failed : ' & ds_Error())
end
pDLLName (string) : The name of the DLL from which version info is required.
pDLLVerInf (*ds_DLLVersionG) : This structure is filled with the version
info.
Returns
DLLVerInf group(ds_DLLVersionG) .
code
if ~ds_GetDLLVersion('shell32.dll',DLLVerInf)
! ds_DLLVersionG group
! MajorVersion ulong
! MinorVersion ulong
! BuildNumber ulong
! PlatformID ulong
! String string(30)
! end
if DLLVerInf.MajorVersion > 4
! Taskbar balloons supported under shell
version 5 and higher.
else
! Taskbar balloons not supported.
end
end
Note : Uses ds_Timer(999).
ds_GSMSendSMS calls the following 4 procedures:
ds_GSMEchoOFF(pPID)
ds_GSMEnterPin(pPID,pPIN)
ds_GSMSetSMSTextmode(pPID)
ds_GSMGetReply...
Parameters
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
pSMSText (string) : The SMS text string to send. Example 'Please call me. I am low on airtime :)'
pSMSPhoneNumber (string) : The mobile number to send the SMS to.
pPIN (string) : Optional. The PIN number to gain access to the SIM card in
the GSM modem.
The PIN code request on the SIM card may be disabled. In this case the PIN
is not required.
NB : If you try the wrong PIN code 3 times then your SIM may be locked and will
need the PUK number to unlock it. This is not handled by WinEvent.
pSMSID (*long) : Optional. Most GSM modems return an SMS identifier that may
be used with the SMS delivery report to identify which SMS was delivered.
Returns
PID long
SMSID long
code
PID = NewPort('com1:9600,n,8,1')
if ds_GSMSendSMS(PID,'Hello There','08XXXXXXXXX','1234',SMSID)
message = ds_Error()
else
message = 'Send Succeeded, SMSID=' & SMSID1
end
Parameters
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
pPIN (string) : The PIN number to gain access to the SIM card in
the GSM modem.
The PIN code request on the SIM card may be disabled. In this case ds_GSMEnterPin
will return 0 (Success).
NB : If you try the wrong PIN code 3 times then your SIM may be locked and will
need the PUK number to unlock it. This is not handled by WinEvent.
Returns
PID long
code
PID = NewPort('com1:9600,n,8,1')
if ds_GSMEchoOFF(PID)
message('ds_GSMEchoOFF failed : ' & ds_Error())
elsif ds_GSMEnterPIN(PID,PIN)
message('ds_GSMEnterPIN failed : ' & ds_Error())
else
message('PIN OK')
end
Parameters
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
Returns
PID long
code
PID = NewPort('com1:9600,n,8,1')
if ds_GSMEchoOFF(PID)
message('ds_GSMEchoOFF failed : ' & ds_Error())
else
message('ECHO OFF')
end
Parameters
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
Returns
PID long
code
PID = NewPort('com1:9600,n,8,1')
if ds_GSMEchoOFF(PID)
message('ds_GSMEchoOFF failed : ' & ds_Error())
elsif ds_GSMSetSMSTextmode(PID)
message('ds_GSMSetSMSTextmode failed : ' & ds_Error())
else
message('ds_GSMSetSMSTextmode OK')
end
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
pCMD (string) : The command to send to the modem.
Tip : Most modems require a CR / LF terminator on the command ie. 'AT+CPIN?<13,10>' where ascii 13 is CR and ascii 10 is LF.
pCmdLen (long) : Optional. This is the command string length to send. If omitted then the string is clipped before sending.
pReplyString (*string) : The modem response is returned in this string.
pTimeout (long) : Optional. Default =25 (0.25 secs). This is the timeout for the first character of the modem response.
pTimeout2 (long) : Optional. Default =25 (0.25 secs). This is the timeout for subsequent characters of the modem response.
pTrailingOK (byte) : Optional. Default=FALSE. This flag when set specifies that the modem response terminates with an '<13,10>OK<13,10>' .
If not set then the first '<13,10>' will be taken as the end of the modem response.
pFindPrompt (byte) : Optional. Default=FALSE. This flag when set specifies that the modem response terminates with an '> ' .
pIgnorePrompt (byte) : Optional. Default=FALSE. This flag when set then leading '> ' characters in the modem response are discarded.
Returns
PID long
ReplyString string(1024)
code
PID = NewPort('com1:9600,n,8,1')
ds_GetGSMReply(PID,'AT+CPIN?<13,10>',,ReplyString,,,1) ! Query +CPIN
state and waits for OK response.
ds_GetGSMReply(PID,'AT+CMGS="082XXXXXX"<13,10>',,ReplyString,1000,,,1) !
Dials Mobile Number and waits for "> " response.
Parameters
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
pTimeout (long) : Optional. Default =50 (0.5 secs). This is the timeout for attempting to empty the com port input buffer.
Returns
PID long
code
PID = NewPort('com1:9600,n,8,1')
if ds_ds_EmptyPort(PID)
message('ds_EmptyPort failed : ' & ds_Error())
else
message('ds_EmptyPort OK')
end
Parameters
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
pPIN (string) : Optional. The PIN number to gain access to the SIM card in
the GSM modem.
The PIN code request on the SIM card may be disabled. In this case the PIN
is not required.
NB : If you try the wrong PIN code 3 times then your SIM may be locked and will
need the PUK number to unlock it. This is not handled by WinEvent.
Returns
PID long
code
PID = NewPort('com1:9600,n,8,1')
if ds_GSMReadSMSInit(PID)
message('ds_GSMReadSMSInit failed : ' & ds_Error())
else
message('ds_GSMReadSMSInit OK')
end
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
pSMSIndex (long) : Which memory index to read.
pSMSG (*ds_SMSMessageG) : This structure is filled with the data from the memory index.
Returns
PID long
SMSIndex long
SMSG group(ds_SMSMessageG)
end
code
SMSIndex = 0
PID = NewPort('com1:9600,n,8,1')
if ds_GSMReadSMSInit(PID,PIN)
message('ds_GSMReadSMSInit failed : ' & ds_Error())
else
loop
SMSIndex += 1
if ds_GSMReadSMS(PID,SMSIndex,SMSG) then break .
! SMSIndex
! ds_SMSMessageG group,type
! Type string(20)
! MobileNumber string(50)
! Date long
! Time long
! TimeZone long
! Text string(255)
! end
end
end
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
pSMSIndex (long) : Which memory index to clear.
Returns
PID long
code
PID = NewPort('com1:9600,n,8,1')
if ds_GSMDeleteSMS(PID,3) ! delete index 3
message('ds_GSMDeleteSMS failed : ' & ds_Error())
else
message('ds_GSMDeleteSMS OK')
end
Note : ds_GSMReadSMSInit calls the following.
ds_GSMEnterPin(PID,PIN)
ds_GSMSetSMSTextmode(PID)
ds_GSMGetReply....
Parameters
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
pEnableReport (byte) : Optional. Default=1 (TRUE) If this flag is
reset (0) then the SMS delivery reporting is disabled.
pTimeout (long) : Optional. Default =1440 minutes (24 Hours). This
is the length of time in minutes that the network must try to send the SMS for
before sending a failed report.
The range of the timeout is from 5 minutes to 63 weeks.
if pTimeOut > 43200 ! 30 days
the resolution is weeks [5 to 63 weeks]
elsif pTimeOut > 1440 ! 1 day
the resolution is days [2 to 30 days]
elsif pTimeOut > 720 ! 12 hours
the resolution is 30 minute blocks [12:30 to 24:00]
else ! <= 12 hours
the resolution is 5 minute blocks [0:05 to 12:00]
end
pPIN (string) : Optional. The PIN number to gain access to the SIM card in
the GSM modem.
The PIN code request on the SIM card may be disabled. In this case the PIN
is not required.
NB : If you try the wrong PIN code 3 times then your SIM may be locked and will
need the PUK number to unlock it. This is not handled by WinEvent.
Returns
PID long
code
PID = NewPort('com1:9600,n,8,1')
if ds_GSMSetSMSReporting(PID)
message('ds_GSMSetSMSReporting failed : ' & ds_Error())
else
message('ds_GSMSetSMSReporting OK')
end
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
pSRMemory (byte) : Optional. Default=1 (TRUE) If this flag is
set then the SMS delivery report storage area is selected.
If this flag is reset then the received SMS storage area is selected.
Returns
PID long
code
PID = NewPort('com1:9600,n,8,1')
if ds_GSMSelectSR(PID)
message('ds_GSMSelectSR failed : ' & ds_Error())
else
message('ds_GSMSelectSR OK')
end
Parameters
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
pPIN (string) : Optional. The PIN number to gain access to the SIM card in
the GSM modem.
The PIN code request on the SIM card may be disabled. In this case the PIN
is not required.
NB : If you try the wrong PIN code 3 times then your SIM may be locked and will
need the PUK number to unlock it. This is not handled by WinEvent.
Returns
PID long
code
PID = NewPort('com1:9600,n,8,1')
if ds_GSMReadSMSReportInit(PID)
message('ds_GSMReadSMSReportInit failed : ' & ds_Error())
else
message('ds_GSMReadSMSReportInit OK')
end
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
pSMSReportIndex (long) : Which memory index to read.
pDRG (*ds_SMSReportG) : This structure is filled with the data from the memory index.
Returns
PID long
SMSReportIndex long
DRG group(ds_SMSReportG)
end
code
SMSReportIndex = 0
PID = NewPort('com1:9600,n,8,1')
if ds_GSMReadSMSReportInit(PID,PIN)
message('ds_GSMReadSMSReportInit failed : ' & ds_Error())
else
loop
SMSReportIndex += 1
if ds_GSMReadSMSReport(PID,SMSReportIndex,DRG) then break .
! SMSReportIndex
! ds_SMSReportG group,type
! Type string(20)
! SMSID long
! MobileNumber string(50)
! SentDate long
! SentTime long
! SentTimeZone long
! DeliveredDate long
! DeliveredTime long
! DeliveredTimeZone long
! StatusCode long
! Status string(20)
! end
end
end
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
pSMSReportIndex (long) : Which memory index to clear.
Returns
PID long
code
PID = NewPort('com1:9600,n,8,1')
if ds_GSMDeleteSMSReport(PID,3) ! delete index 3
message('ds_GSMDeleteSMSReport failed : ' & ds_Error())
else
message('ds_GSMDeleteSMSReport OK')
end
Parameters
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
pERG (*ds_GSMEventG) : This structure is filled with any event data found.
Returns
PID long
ERG group(ds_GSMEventG)
end
code
PID = NewPort('com1:9600,n,8,1')
if ds_GSMReadEvents(PID,ERG)
message('GSMReadEvents failed : ' & ds_Error())
else
! ds_GSMEventG group,type
! Date long
! Time long
! Text string(255)
! Type string(3)
! Index long
! end
end
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
pEventsMask (long) : Optional. Default=255. This long selects
which events are enabled.
Returns
PID long
code
PID = NewPort('com1:9600,n,8,1')
if ds_GSMSetEvents(PID)
message('ds_GSMSetEvents failed : ' & ds_Error())
else
message('ds_GSMSetEvents OK')
end
pPID (long) : This is the PortID of the open com port to which the GSM modem is connected. See the NewPort function.
Returns
PID long
code
PID = NewPort('com1:9600,n,8,1')
if ds_GSMReset(PID)
message('ds_GSMReset failed : ' & ds_Error())
else
message('ds_GSMReset OK')
end
pDebugString (string) : Debug info string.
pWindowLabel (string) : Optional. This label identifies which procedure is sending the debug info. The thread number is added to the end of this string.
pEventNumber (long) : Optional. Used by the template in order to display the window events.
pFieldNumber (long) : Optional. Used by the template to display which control received the event.
Returns
code
ds_ViewDebug ! opens the debug viewer.
ds_Debug('Just testing') ! sends "Just Testing" to the windows debug
viewer.
pEnable (byte) : If TRUE (1) then WinEvent internal debugging info is sent to
the debug viewer. If FALSE (0) then WinEvent internal debugging info is
suppressed.
Returns
fp_Testing ulong
code
ds_WineventDebug(1)
ds_LoadDLLProc('Testing','NoneExistant.dll',fp_Testing) !
Attempt to locate a procedure in an non-existant dll.
Debug string ! ds_LoadDLLProc error, LoadLibrary failed DLL=NoneExistant.dll
The specified module could not be found.
None.
Returns
fp_Testing ulong
code
ds_ViewDebug ! open debug viewer.
ds_WineventDebug(1)
ds_LoadDLLProc('Testing','NoneExistant.dll',fp_Testing) !
Attempt to locate a procedure in an non-existant dll.
Debug string ! ds_LoadDLLProc error, LoadLibrary failed DLL=NoneExistant.dll
The specified module could not be found.
None.
Returns
fp_Testing ulong
code
ds_DebugView ! open debug viewer.
ds_WineventDebug(1)
ds_LoadDLLProc('Testing','NoneExistant.dll',fp_Testing) !
Attempt to locate a procedure in an non-existant dll.
Debug string ! ds_LoadDLLProc error, LoadLibrary failed DLL=NoneExistant.dll
The specified module could not be found.
ds_DebugViewClose ! close the debug viewer.
pThisErrorCode (long) : Optional. If omitted then the current ds_ErrorCode() is used. This is the error code for which the text error message is required.
Returns
fp_Testing ulong
code
if ds_LoadDLLProc('Testing','NoneExistant.dll',fp_Testing) !
Attempt to locate a procedure in an non-existant dll.
message('Error ' & ds_error())
end
None.
Returns
fp_Testing ulong
SaveErrorCode long
code
if ds_LoadDLLProc('Testing','NoneExistant.dll',fp_Testing) !
Attempt to locate a procedure in an non-existant dll.
SaveErrorCode = ds_ErrorCode()
message('Error ' & ds_error())
end
pCallingProcedure (string) : Optional. This procedure name will be returned with any ds_Error() message string. Useful for identifying the parent procedure where a procedure is called from various procedures.
Returns
fp_Testing ulong
SaveErrorCode long
code
if ds_LoadDLLProc('Testing','NoneExistant.dll',fp_Testing) !
Attempt to locate a procedure in an non-existant dll.
SaveErrorCode = ds_ErrorCode()
message('Error ' & ds_error())
end
None.
Returns
code
ds_SaveStack
! some external procedure call.
ds_TestStack
pDisplayValue (ulong) : The number to format as hex.
pPadSpaces (byte) : The length of the hex number to return (leading zeros).
Returns
DisplayHex string(10)
code
DisplayHex = ds_FormatHex(31,4) ! 001F
pClipFormat (ulong) : The format specifier.
CF_TEXT
equate(1)
CF_BITMAP
equate(2)
CF_METAFILEPICT equate(3)
CF_SYLK
equate(4)
CF_DIF
equate(5)
CF_TIFF
equate(6)
CF_OEMTEXT equate(7)
CF_DIB
equate(8)
CF_PALETTE equate(9)
CF_PENDATA equate(10)
CF_RIFF
equate(11)
CF_WAVE
equate(12)
CF_UNICODETEXT equate(13)
CF_ENHMETAFILE equate(14)
CF_HDROP
equate(15)
CF_LOCALE equate(16)
CF_DIBV5
equate(17)
pNewContents (string) : The data to be placed in the clipboard.
Returns
This example places the name "C:\autoexec.bat"
into the windows clipboard.
Using windows explorer you can then paste a copy of the file elsewhere.
hDropStruct group
pFiles
long ! offset from here to FileList
pt
ulong
ulong
fNC
long
fWide
long
FileList
string(255) ! Null terminated list of null terminated file names.
end
code
hDropStruct.filelist = 'C:\autoexec.bat<0,0>' ! List of files.
Note the double null terminator.
hDropStruct.pFiles = 20
hDropStruct.fWide = 0 ! ASCII
if ~ds_SetClipboard(CF_hDrop,hDropStruct) ! Place name in
clipboard.
message('SetClipboardFailed')
end
pForce (byte) : Optional. When set (1) then any processes that do not "respond" are terminated by windows.
Returns
code
ds_Shutdown() ! Request a windows shutdown.
None.
Returns
code
if ds_WinEventVersion < 3.21
message('Error old WinEvent DLL in use')
end
pUlongHigh (long) : The first 4 bytes of the ulong64.
pUlongLow (long) : The last 4 bytes of the ulong64.
Returns
RealVar
real
ulong64G
group
High
long
Low
long
end
code
RealVar = ds_Ulong64toReal(ulong64G:High,ulong64G:Low)
pCallBackAddress (ulong) : The address of the OKToEndSessionHandler.
The OKToEndSessionHandler must be prototyped as :
MyOKToEndSessionHandler(long pLogoff),long,pascal
Returns
OldHandlerAddress ulong
code
OldHandlerAddress =
ds_SetOKToEndSessionHandler(address(MyOKToEndSessionHandler))
pCallBackAddress (ulong) : The address of the EndSessionHandler.
The EndSessionHandler must be prototyped as :
EndSessionHandler(long pLogoff),long,pascal
Returns
OldHandlerAddress ulong
code
OldHandlerAddress = ds_SetEndSessionHandler(address(MyEndSessionHandler))
pNoEndSession (long) : When set (1) then the Auto-Shutdown is disabled.
Returns
code
ds_SetNoEndSession(TRUE)
! Do backup routine here
ds_SetNoEndSession(FALSE)
None.
Returns
long hProcess
code
hProcess = ds_GetCurrentProcess()
None.
Returns
long hThread
code
hThread = ds_GetCurrentThread()
hProcess (long) : Optional. The windows handle to the process.
Defaults to the current process.
IncludeFlags (long) : Optional. 1 = User Time, 2 = Kernal Time, 0 = Total
Time (Default)
Returns
real UserTime
code
UserTime = ds_GetProcessTime(,1)
DisplayTime = ds_FormatFastTime(UserTime,6) !
HH:MM:SS.SSSSSS
hThread (long) : Optional. The windows handle to the thread.
Defaults to the current thread.
IncludeFlags (long) : Optional. 1 = User Time, 2 = Kernal Time, 0 = Total
Time (Default)
Returns
real UserTime
code
UserTime = ds_GetThreadTime(,1)
DisplayTime = ds_FormatFastTime(UserTime,6) !
HH:MM:SS.SSSSSS
hProcess (long) : Optional. The windows handle to the process.
Defaults to the current process.
hThread (long) : Optional. The windows handle to the thread.
Defaults to the current thread.
RealTimeFlag (byte) : Optional. When set (Default) then Real Time Priority
is selected. When clear then Normal Priority is selected.
Returns
code
ds_SetRealTimePriority(,,TRUE) ! Select Real Time
priority
......
ds_SetRealTimePriority(,,FALSE) ! Select Nornal
priority
(1) Question: I want my application to auto-shutdown. I have checked the 'Auto
Shutdown Enabled' checkbox on the WinEvent extension template on my frame, but
it still does not auto-shutdown.
Answer: Are you using 'WinNotOnTaskBar'? auto-shutdown is not
compatible with 'WinNotOnTaskBar'. Use window{prop:hide} instead
(click here for an example).
You need to either check the 'Auto shutdown on' checkbox in the WinEvent
Global Extension template (the easiest way), check each 'Auto shutdown enabled'
checkbox on each of the windows or hand code the relevant function yourself. You
may prefer to take the second option if there are windows which must be closed
(like forms, etc) by the user before the application is automatically closed.
In this case, you can leave those 'Auto shutdown enabled' checkbox cleared, so
that your application won't auto-shutdown when these windows are open. For those
more daring, you can do the hand coding method (click here
for more details).
(4) Question: I'm trying to import a procedure from another application,
but 2 instances of the WinEvent template appear after import on that procedure.
Answer: There are 2 possible solutions to this (depending on which may be
better in your situation):
1. Delete the WinEvent global template from the application that you want to
export the procedures from. Export the procedures to a txa file, and then add
the WinEvent global template back into your application. You can the import the
txa file into your new application.
Pros: Simpler and quicker.
Conns: Can lose some template settings (of the templates that were temporarily
removed).
This should only be done in applications where the default template settings are
used.
2. Export the procedures that you want to a txa file. You now need to manually edit the txa file and remove all WinEvent: Alert Windows Messages template instances in that file. Basically, what you need to delete is the following (wherever it occurs in the txa file:
Do a search for NAME WinEvent WinEvent and the immediately preceeding [ADDITION] marks the start of the template prompts and the next [ADDITION], [WINDOW] or [CALLS] statement marks the end of the template prompts.[ADDITION]
NAME WinEvent WinEvent
[INSTANCE]
INSTANCE 2
OWNER 1
[PROMPTS]
%DisableWinEvent LONG (0)
%AutoDown LONG (0)
%NoAutoDown LONG (0)
%EnableWheelMouse LONG (0)
%AlertWinEventDebug LONG (0)
%DisplayCompileDate LONG (0)
%DisplayCompileDateFormat DEFAULT ('@D6')
%WinAlert MULTI LONG ()
%Mess DEPEND %WinAlert DEFAULT TIMES 0
%Act1 DEPEND %WinAlert DEFAULT TIMES 0
%act2 DEPEND %WinAlert DEFAULT TIMES 0
%SortListbox MULTI LONG ()
%ThisListbox DEPEND %SortListbox DEFAULT TIMES 0
%ThisListboxHeader DEPEND %SortListbox MULTI DEFAULT TIMES 0
%gloWinEventTesting LONG (0)
%gloWinEventTestingColor1 LONG (15728618)
%gloWinEventTestingColor2 LONG (16777215)
1) | Template Fix: Regression in 3.33 - RetryCreateIcon definition was not always being generated. |
2) | Fix: Regression in 3.33 - Message removed from COM initialisation. |
1) | Template Fix: Taskbar icon now works with Services |
2) | WinAccept (DLL) - optimised procedure |
1) | Fixed bug in ds_Memory where 0 returned under clarion 6.x. |
2) | Fixed bug in comms status pin functions CTSHigh, DSRHigh, RingHigh and CDHigh. Broken in 3.31. |
1) | Added ds_DestroyIcon(), use with ds_GethIcon() to free memory. |
2) | Added option "Left-Click Icon shows Window" to the TaskBarIcon template. |
3) | Added a separator to the TaskbarIcon popup menu. |
4) | Fixed bug in ds_FormatFastTime where times past midnight displayed incorrectly. |
5) | Added a ReSyncTime optional parameter to ds_FastClock() for use when the time has been adjusted. |
1) | Fixed bug in ds_GSMSendSMS where random SMS send error occurred. |
2) | Fixed bug in ds_GSMSendSMS where program takes 99% of CPU during send. (Thank you Nardus) |
3) | Removed ds_QueryPerformance, see 3.29 below. |
4) | Added ds_ReadCPUTimeStamp() and ds_ReadCPUTimeStampDelta(). |
5) | Updated ds_FastClock(). |
6) | Added ds_GetCurrentProcess(). |
7) | Added ds_GetCurrentThread(). |
8) | Added ds_GetProcessTime(). |
9) | Added ds_GetThreadTime(). |
1) | Fixed bug in ds_FormatFastTime where very small times, nano seconds displayed as milliseconds. |
2) | Added a template to open a com port. See Use com port template. |
3) | Added support for com port events. See new com port template. See modified newport command. |
4) | Fixed a bug in the GSM Modem routines that caused a GPF under clarion 6.X |
5) | Modified template call to ds_DebugView, removed start(). This was causing a GPF under 6.2 |
6 | Added ds_SetRealTimePriority(). |
7 | Added ds_QueryPerformance(). |
8 | Added ds_Ulong64ToReal(). |
9 | Modified "Add Icon to system tray" template to include optional Show|Hide|Close popup. (Thank you Geoff) |
10 | Added ds_HideWindow procedure |
11 | Added ds_ShowWindow procedure |
12 | Updated WinEvent() documentation.WinEvent |
13 | Documented the WinSysEvent and WinWtsEvent functions. |
1) | Modified template so that importing a procedure with a WinEvent template does not cause template errors. |
2) | Modified template so that the Load Icon and Refresh Icon embed points are correct. Refresh Icon was missing. |
1) | Fixed bug in ds_GetWinVersion where Win2003 was reported as WinNT. |
1) | Fixed bug in template where "Disable WinEvent in the application" did not always work, some code was still generated. |
2) | Fixed bug in ds_SetClipboard(). |
1) | Fixed bug in ds_GetFileVersionInfo where extra characters were returned with the version string. |
2) | Fixed bug in EzHelp version checking routine. |
3) | Added priority attributes to template embed code. This is to assist with souce comparison at Jim's request. |
4) | Renamed WinEvent internal modules, prefixed with "ds_we". This is to remove module naming conflicts. |
5) | Added ds_SaveStack and ds_TestStack procedures. These may help in locating stack corruptions. |
1) | Fixed export of ds_GetFileVersionInfo for cw55 and cw50 |
1) | Added ds_GetFileVersionInfo. |
2) | Fixed bug in template where exporting multi-dll info caused a compiler error. |
1) | Major re-write of documentation. |
2) | Added TaskbarShowBalloon and TaskbarHideBalloon code templates. |
3) | Upgraded to new CapeSoft look. |
4) | Added template help buttons. |
5) | Modified WinEvent template to use EVENTMAP.CLW instead of adding each procedure prototype to the global map. |
6) | Added error reporting to most WinEvent functions. See ds_Error |
7) | Modified ds_CreateDirectory to work with relative paths ie ..\MyNewDirectory |
1) | Fixed memory leak in ScreenWidth(), ScreenHeight() & ScreenDepth() |
2) | Added ds_GetScreenDPI() which returns the user screen DPI settings. 96=Small Fonts, 120=Large Fonts or custom font setting. |
3) | Added ds_CreateShortcut() which will create a shortcut to a file. |
1) | Modified "Add Icon to the intray" template so that WinTaskBarAddIcon is now called from a posted event. This is because sometimes the Icon does not add. |
2) | Added some compile warnings when WinNotOnTaskBar is used with auto-shutdown as this is not compatible. |
1) | Rebased DLL for faster loading. |
2) | Added save to file / clipboard functionality to the builtin debug viewer. |
3) | Added embed points for TaskBar balloon events. |
4) | Added the field equate lables to the builtin debug viewer. |
5) | Updated CSIDL equates. |
6) | Added ds_GetHModule() which returns a handle to the current module or a specified DLL. Use with ds_GetHIcon(). |
7) | Added ds_GetHIcon() which returns a handle to icons that are compiled into the EXE or DLL. |
8) | Added ds_GetWindowsColour() which returns the current users windows colour setting in clarion colour format. |
1) | Fixed bug in WinTaskbarAddIcon where line breaks were removed from tip strings. Should only remove for WIN9x. |
1) | Fixed bug in ds_MoveFile. |
2) | Modified WinTaskbarAddIcon and WinTaskbarChangeIcon to ignore calls with IconName blank. |
1) | Fixed bug where calling Sound(soundfilename) would fail under Win2k. |
1) | Fixed bug where calling Sound() with an empty wavefile name string caused a GPF. |
1) | Modified WinSysEvent() and WinWTSEvent() functions to optionally clear the value after reading. New prototype! |
1) | Fixed bug in template where the Sound function was incorrectly prototyped. Sound would cause app to close without GPF, just gone. |
1) | Fixed bug in GSM Modem SMS delivery Reporting where some Siemens modems were not properly supported. |
1) | Fixed bug in template where WinEvent events were not handled. |
2) | WinEvent examples upgraded. (Thank you Jono) |
1) | Fixed conflict with Secwin. |
1) | Fixed bug in ds_WinTaskbarBalloon where Win2000 balloons did not work. |
1) | Fixed bug in ds_WinTaskbarBalloon where Win2000 and Win NT4 Balloons were positioned off the visible desktop. |
1) | Added TaskbarIcon "Balloon" support. See ds_WinTaskbarBalloon |
2) | Modified WinTaskbarAddIcon to accept "compiled in" icons. Example WinTaskbarAddIcon('~MyAppIcon.ico'... |
3) | Modified Auto-Shutdown. Added
Callback functions MyOKToEndSessionHandler & MyEndSessionHandler Added WinEvent functions ds_SetOKToEndSessionHandler & ds_SetEndSessionHandler. See Auto-Shutdown for details. |
1) | Fixed bug where WinEvent could not be linked into a non data DLL. WinEvent now has a DLL !!!!! |
2) | Modified GSM Modem SMS delivery reporting. |
3) | Added GSM Modem Event monitoring. See example. |
1) | Fixed bug where WinEvent could not be linked into a data DLL. |
2) | Fixed bug in ds_VisibleOnDesktop where window would remain obscured on the right side. |
1) | Modified the NewPort function to cater for using LPTx as a parameter. |
2) | Fixed bug in (don't laugh) ds_debug. |
3) | Added new function ds_VisibleOnDesktop. |
1) | Added GSM Modem SMS delivery reporting support. |
1) | Modified the ds_GSMGetReply function. Added an extra optional parameter. |
2) | Added GSM Modem SMS read support. See ds_GSMReadSMS |
3) | Added an date format string to the "Append compile date to title bar" option on WinEvent extension general tab. |
1) | Added a batch of new functions. See New Functions |
1) | Fixed bug introduced in 2.98 where ReadPort caused a GPF. |
2) | Added alternate Auto-Shutdown method. This allows you
to execute closing down code but will exit even if user cancels the shutdown. See option under the Auto-Shutdown option on WinEvent extensions. |
1) | Fixed bugs in WindowsRelease function. |
1) | Fixed bugs in ScreenWidth, ScreenHeight and ScreenDepth functions. |
2) | Added a new function. ds_WinTransparent() . This
function is completely useless but looks really cool. WinXP and Win2000
only. (Not Win98). ds_WinTransparent(255) = Normal window ds_WinTransparent(0) = Transparent window ds_WinTransparent(128) = recommended. |
1) | Added new example code to the WinOnTop function. This is the ideal code for hiding and showing a window from the Task Bar. |
1) | Fixed bug in Modified NewPort (2.93) where an error on opening a port (port in use) caused a stop . |
2 | Fixed bug in SetRTS and SetDTR functions. Was causing linker error. |
3) | Problems with Wheel Mouse Support. Some mouse drivers are not compatible with WinEvent Wheel Mouse support and cause random GPF's. |
1) | Modified NewPort to support buffer size setting. |
1) | Modified WinTaskBarAddIcon so that the Icon is redrawn whenever a new taskbar is started. Note the new "Refresh icon event" embed point. |
2) | Added function GetSystemDir. This returns c:\windows\system |
3) | Removed GetSystemWindowsDir as this only works under terminal server. |
1) | Fixed bug where WinEvent events were suppressed while running EzHelp. |