Your DesktopX Documentation Resource Guide

Documentation Home

Quick Start

User's Guide

Developer's Guide

Resources

Tutorials


By now you should realize just w

System namespace

System.CursorX, System.CursorY

These returns the current coordinates of the mouse cursor.
Example:

Object.Text = "X:" & System.CursorX & " Y:" & System.CursorY

System.PixelColor

This returns the color of the pixel at the specified coordinates.
Example:

Sub Object_OnTimer1
hexcolor = Hex(System.PixelColor(System.CursorX, System.CursorY))
red = Right(hexcolor, 2)
green = Mid(hexcolor, 2,2)
blue = Left(hexcolor, 2)
Object.Text = CStr(CLng("&H" & red)) & ", " & CStr(CLng("&H" & green)) & ", " & CStr(CLng("&H" & blue))
End Sub

System.InternetConnected, System.Ping

Many good examples of DXScript objects make use of the Internet, so it makes sense to detect whether access to the Internet is available. You can also check the speed of access to a web address (ping) by using System.Ping.
Examples:

1) If System.InternetConnected = False Then Msgbox "Go online"
2) x = System.Ping("www.wincustomize.com")

System.SetWallpaper

This allows you to specify the Windows wallpaper. You need to provide a full path to the wallpaper and then an option to feine how to display the wallpaper.
Option:

0 = use default wallpaper
1 = Center wallpaper
2 = Tile wallpaper
3 = Stretch wallpaper

Examples:

System.SetWallpaper "C:\temp\wall1.bmp", 1
System.SetWallpaper Object.Directory & "wall1.jpg", 1
System.SetWallpaper "", 0 This will restore the original wallpaper.

System.ScreenWidth, System.ScreenHeight

System.ScreenHeight and System.ScreenWidth return the height and width of the primary monitor. This is mostly kept for backward compatibility. New objects should use System.Vscreen* properties instead, since these are multimonitor compatible (see the next chapter).
Examples:

Msgbox "Primary monitor resolution: " & System.ScreenHeight & "x" & System.ScreenWidth

System.VscreenLeft, System.VScreenTop, System.VScreenWidth, System.VScreenHeight

These are the suggested properties to use when checking the monitor coordinates, since they take in consideration the whole virtual screen area, and not only the primary monitor. This will still work in a single monitor setup but will also support multi-monitor setups.
Note that the virtual screen origin is NOT generally (0,0), but it is (VscreenLeft, VscreenTop). Because of this .VscreenWidth returns the WIDTH of the virtual screen, not the right border! To calculate the right and bottom borders use the following code:

VirtualScreenRight = System.VScreenLeft + System.VScreenWidth
VirtualScreenBottom = System.VScreenTop + System.VScreenHeight

System.WorkareaLeft, System.WorkareaRight, System.WorkareaTop, System.WorkareaBottom

These properties retrieve the boundaries of the desktop workarea. This is usually even better than System.Vscreen* properties to base calulations for moving and keeping objects in the wanted position, since it represents the actual “available” working area.

System.FolderDialog (info, initialDir, flags)

This shows a dialog that allows the user to select a specific folder which can then be acted upon. The parameters to provide are a string which places information at the top of the dialog, the path where browsing should commence from, and then a range of customization flags. The full list of the flags is shown below:

'Only file system directories
BIF_RETURNONLYFSDIRS = &H1
'No network folders below domain level
BIF_DONTGOBELOWDOMAIN = &H2
'Allows user to rename selection
BIF_EDITBOX = &H10
'Insist on valid edit box result (or CANCEL)
BIF_VALIDATE = &H20
'Allow URLs To be displayed Or entered
BIF_BROWSEINCLUDEURLS = &H80
'Only returns computers
BIF_BROWSEFORCOMPUTER = &H1000
'Only returns printers
BIF_BROWSEFORPRINTER = &H2000
'Browse for everything
BIF_BROWSEINCLUDEFILES = &H4000
'Sharable resources displayed
BIF_SHAREABLE = &H8000

Examples:

Const BIF_RETURNONLYFSDIRS = &H1
x = System.FolderDialog ("Please select your image folder:", "c:\", BIF_RETURNONLYFSDIRS)
Const BIF_EDITBOX = &H10
x = System.FolderDialog ("", "", BIF_EDITBOX)
Const BIF_BROWSEINCLUDEFILES = &H4000
x = System.FolderDialog ("Please select the directory:", DesktopX.ExecutableDirectory, BIF_BROWSEINCLUDEFILES)

System.FileOpenDialog (title, defaultFile, intialDir, extensions, flags), System.FileSaveDialog (title, defaultFile, intialDir, extensions, flags)

This shows a dialog that allows the user to select a specific folder which can then be acted upon. The parameters are a title for the dialog, the default file name, the path where browsing should commence from. You then specific the file types to select in the dialog in a series of pipe (‘|’) separated description/extention pairs such as Text files|*.txt|All files|*.* .
Finally, you can provide a range of customization flags. The full list of the flags is shown below:

'Causes the Read Only check box to be selected when the dialog is created
OFN_READONLY = &H1
'Causes the Save As dialog box to generate a message box if the selected file already exists. The user must confirm whether to overwrite the file
OFN_OVERWRITEPROMPT = &H2
'Hides the read only check box
OFN_HIDEREADONLY = &H4
'Restores the current directory if the user changes directory while searching
OFN_NOCHANGEDIR = &H8
'Allow invalid characters in the returned file name
OFN_NOVALIDATE = &H100
'Specifies that the user typed a file name extension that differs from the default extension specified
OFN_EXTENSIONDIFFERENT = &H400
'Specifies that the user can type only valid paths and file names
OFN_PATHMUSTEXIST = &H800
'User can type only names of existing files in the File Name entry field
OFN_FILEMUSTEXIST = &H1000
'If a file that doesn’t exist is selected ask for confirmation to create it
OFN_CREATEPROMPT = &H2000
'If the command fails because of a network sharing violation, error is ignored
OFN_SHAREAWARE = &H4000
'Specifies that the returned file does not have the Read Only check box selected and is not in a write-protected directory
OFN_NOREADONLYRETURN = &H8000
'Specifies that the file is not created before the dialog box is closed
OFN_NOTESTFILECREATE = &H10000
'Hides and disables the Network button
OFN_NONETWORKBUTTON = &H20000
'Directs the dialog box to return the path and file name of the selected shortcut (.LNK) file. If this value is not specified, the dialog box returns the path and file name of the file referenced by the shortcut
OFN_NODEREFERENCELINKS = &H100000

Examples:

x = System.FileSaveDialog("My title", "new.txt", "c:\", "Text files|*.txt|All files|*.*",0)
x = System.FileOpenDialog("Select document ...", "", Desktopx.ExecutableDirectory & "docs", "DesktopX Help|*.pdf", 0)

System.KeyState(vk)

This allows to establish the state of any given key from the list available here:

http://msdn.microsoft.com/library/en-us/winui/WinUI/WindowsUserInterface/
UserInput/VirtualKeyCodes.asp


The value returned is either 0 (), 1 (), or 2 () depending on the key state.
Example:

Function Object_OnLButtonUp(x,y,dragged)
Const VK_NUMLOCK = &H90
x = System.KeyState(VK_NUMLOCK)
If x = 0 Then
msgbox "NumLock is Off"
ElseIf x = 1 Then
msgbox "NumLock is being pressed"
ElseIf x = 2 Then
msgbox "NumLock is On"
End If
End Function

System.Clipboard

Property to get and set the text content of the system clipboard.
Example:

System.Clipboard = Object.text

System.CPUActivity

Property to get the percentage of current CPU activity.
Example:

Object.text = “CPU usage: “ & System.CPUActivity & “%”

System.Volume

Property to get/set the system audio volume level (0-100).

System.Mute

Property to get/set the system audio muting (boolean).

System.DesktopColor

Sets the current desktop solid color.
Example:

System.DesktopColor = RGB(128, 128, 128)

 

System.DownloadFile(remoteUrl, localPath, bAsync)

Downloads a remote file.

RemoteUrl points to the remote file location.
LocalPath points to the local postition to save the file.
bAsync is a boolean value that tells the host to download the file synchronously (the function return only when the file is downloaded) or asynchronously (the function returns immediately and a System_OnDownloadFinish(url) callback is used to notify when the download has finished.

Example:

System.DownloadFile "http://www.mysite.com/myfile.zip", "c:\temp\myfile.zip", True

Sub System_OnDownloadFinish(url)
  'url equals "http://www.mysite.com/myfile.zip"
End Sub

 

System.SendRequest(remoteUrl, postParams, bAsync)

Sends an HTTP request (POST or GET).

RemoteUrl points to the remote page location.
PostParams can contain a string to pass POST parameters. If no parameters are passed there, GET is used. You can also pass GET parameters in remoteUrl using standard conventions.
bAsync is a boolean value that tells the host to request the page synchronously (the function return only when the page is completely downloaded) or asynchronously (the function returns immediately and a System_OnRequestFinish(url, pagecontent) callback is used to notify when the download has finished.

Example:

strPage = System.SendRequest("http://www.mysite.com/page.asp", "param1=123&param2=456", false

strPage = System.SendRequest("http://www.mysite.com/page2.asp", "param1=123&param2=456", true

Sub System_OnRequestFinish(url, pagecontent)
  If instr(szurl, "page2.asp") > 0 Then
    'parse pagecontent...
  End if
end sub

 

System.SimpleWrite(path, content, param)

It writes a file to disk with passed content.
Only param=1 is currently supported.

Example:

System.SimpleWrite baseDir & "Data/mylog.txt", logString, 1
 

 

System.SimpleRead(path, param)

It reads a file from disk to a string variable.

Only param=1 is currently supported.

Example:

txtLog = System.SimpleRead(baseDir & "Data\mylog", 1)
 

 


7/29 

SkinStudio 6.2 Released

7/25 

A God Has Fallen - New Demigod Trailer Released

7/24 

Sins of a Solar Empire v1.1 Beta has Arrived

7/23 

Stardock Releases New WindowBlinds 6.2 Update

7/22 

Stardock Releases The Political Machine v1.04 with New Characters

7/22 

Stardock Releases MyColors 2.5

7/17 

DesktopX 3.5 Officially Released

7/11 

Corel WinDVD 9 and Painter X Now Available on Impulse!