| Documentation - Version 2.0 Installation
Instructions | Sample Projects | FAQ's
Methods
AddToRecentDocs
Purpose:
The AddToRecentDocs method adds a specified document/file to
the document menu under the Start button.
Syntax:
control.AddToRecentDocs Filename
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed on a form. |
| Filename |
Required. A valid filename. |
Return Value:
None.
Example Code:
vbce.AddToRecentDocs "\doc1.txt"
AlwaysOnTopOff
Purpose:
The AlwaysOnTopOff method sets the style of a window back to
normal after the AlwaysOnTopOn method has been used to place the window on top of all
other windows.
Syntax:
control.AlwaysOnTopOff hwnd
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed on a form. |
| hwnd |
Required. A valid handle to a window, usually a form |
Return Value:
None.
Example Code:
VBCEUtil1.AlwaysOnTopOff Form2.hwnd
AlwaysOnTopOn
Purpose:
The AlwaysOnTopOn method places a window on top of all other
windows. When the window is no longer needed to be on top, use the AlwaysOnTopOff method
to turn it off.
Syntax:
control.AlwaysOnTopOn hwnd
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed on a form. |
| hwnd |
Required. A valid handle to a window, usually a form |
Return Value:
None.
Remarks:
This method can be used to simulate a modal form. Disable the
first form be setting its Enabled property to false and then show the second "fake
modal" form. In the Form_Load event of the second "fake modal" form use the
code sample below.
Example Code:
VBCEUtil1.AlwaysOnTopOn Form2.hwnd
Beep
Purpose:
The Beep method will play a specified tone.
Syntax:
control.Beep Type
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed on a form. |
| Type |
Required. A constant representing a specified tone. |
Return Value:
None.
Example Code:
'-- MessageBeep Constants
Const MB_ICONHAND = &H10&
Const MB_ICONQUESTION = &H20&
Const MB_ICONEXCLAMATION = &H30&
Const MB_ICONASTERISK = &H40&
Const MB_OK = &H0&
Const MB_SYSTEM_DEFAULT = 255
VBCEUtil1.Beep MB_ICONEXCLAMATION
CreateShortcut
Purpose:
The CreateShortcut method allows you to create a shortcut to
a file.
Syntax:
control.CreateShortcut Shortcut, AppName
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed
on a form. |
| Shortcut |
Required. Shortcut location and name.
Must have the extension .lnk |
| Appname |
Required. The file that the Shortcut will point
to. |
Return Value:
None
Example Code:
vbceutil1.CreateShortcut "\Windows\Desktop\Hearts.lnk",
"\Windows\Hearts.exe"
GetHwnd
Purpose:
Retrieves the handle of a control.
Syntax:
control.GetHwnd
Parameters:
| Part |
Description |
| control
|
A valid reference to a VBCEUtil
control placed on a form. |
Return Value:
Long vale indicating the HWND of the control which has focus.
Remarks:
None
Example Code:
command1.SetFocus
msgbox vbceUtil1.GetHwnd
GetShortcutTarget
Purpose:
Retrieves the filename that a Shortcut points to.
Syntax:
control.GetShortcutTarget Shortcut
Parameters:
| Part |
Description |
| control
|
A valid reference to a VBCEUtil
control placed on a form. |
| Shortcut |
Required. Name of a shortcut. |
Return Value:
String Expressions representing the filename the shortcut
points to.
Remarks:
None
Example Code:
MsgBox vbceutil1.GetShortcutTarget("\Windows\Desktop\Hearts.lnk")
InputBox
Purpose:
Display standard VB InputBox for PPC devices.
Syntax:
control.InputBox Prompt, Title
Parameters:
| Part |
Description |
| control
|
A valid reference to a VBCEUtil
control placed on a form. |
| Prompt |
Message to appear in InputBox. |
| Title |
InputBox Title |
Return Value:
String value entered into InputBox textbox
Remarks:
None
Example Code:
msgbox vbce.InputBox("What is your name", "Name")
MemoryStatus
Purpose:
Method to determine the total amount of memory and the amount
of memory used.
Syntax:
control.MemoryStatus Type
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed
on a form. |
| Type |
Required. Constant specifying what type of
memory status to query |
Return Value:
Specified memory value
Remarks:
None
Example Code:
Const MEMORY_PERCENTAGE_USED = 0
Const MEMORY_PHYSICAL_TOTAL = 1
Const MEMORY_PHYSICAL_AVAIL = 2
Const MEMORY_VIRTUAL_TOTAL = 3
Const MEMORY_VIRTUAL_AVAIL = 4
Dim lPhysTotal As Long
lPhysTotal = CLng(vbce.MemoryStatus(MEMORY_PHYSICAL_TOTAL)) / 1024
MsgBox "Phy Total: " & iPhysTotal
MsgBox
Purpose:
Displays a message in a dialog box, waits for the user to
click a button, and returns an Integer indicating which button the user clicked.
The MsgBox function is identical to that of the standard VBCE
MsgBox function, except that the message box displayed will be modal to the application
unlike the VBCE function.
Syntax:
control.MsgBox (prompt [, buttons] [,title])
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed
on a form. |
| prompt |
Required. String expression displayed as the
message in the dialog box. The maximum length of prompt is approximately 1024 characters,
depending on the width of the characters used. If prompt consists of more than one line,
you can separate the lines using a carriage return character (Chr(13)), a linefeed
character (Chr(10)), or carriage return linefeed character combination
(Chr(13) & Chr(10)) between each line. |
| buttons |
Optional. Numeric expression that is the sum of
values specifying the number and type of buttons to display, the icon style to use, the
identity of the default button, and the modality of the message box. If omitted, the
default value for buttons is 0. |
| title |
Optional. String expression displayed in the
title bar of the dialog box. If you omit title, the application name is placed in the
title bar. |
Return Value:
| Constant |
Value |
Description |
| vbOk |
1 |
OK |
| vbCancel |
2 |
Cancel |
| vbAbort |
3 |
Abort |
| vbRetry |
4 |
Retry |
| vbIgnore |
5 |
Ignore |
| vbYes |
6 |
Yes |
| vbNo |
7 |
No |
Remarks:
The message box is not modal in the emulator, only on the
handheld devices.
Example Code:
Dim myResult
myResult = VBCEUtil1.MsgBox("Are you sure you wish to exit?", vbQuestion +
vbYesNo, "My App")
if myResult = vbYes then
App.End
else
'return to normal program operation
End If
ObjectStore
Purpose:
Determines the total amount and free space in object store.
Syntax:
control.ObjectStore Type
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed
on a form. |
| Type |
Required. Constant specifying what type of
ObjectStore status to query |
Return Value:
Value indicating object total space or free space
Remarks:
None
Example Code:
Const FREE_SPACE = 0
Const TOTAL_SPACE = 1
MsgBox vbce.ObjectStore(FREE_SPACE)
MsgBox vbce.ObjectStore(TOTAL_SPACE)
PlayWaveFile
Purpose:
Plays a *.wav file.
Syntax:
control.PlayWaveFile filename
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed on a form. |
| filename |
Required. A path and filename of a wav file. |
Return Value:
None
Remarks:
Check that the file exists before calling this function.
Example Code:
VBCEUtil1.PlayWaveFile "\windows\alarm1.wav"
PowerStatus
Purpose:
Determine power status of CE device
Syntax:
control.PowerStatus Type, Cache
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed on a form. |
| Type |
Required. Integer Constant specifying what status to query. |
| Cache |
Required. Boolean value. True = Query driver directly.
False = Use cached data. |
|
|
Return Value:
Power Status Requested
Remarks:
None
Example Code:
'-- ===============
'-- Power Constants
'-- ===============
Const POWER_CACHED_DATA = False
Const POWER_DRIVER_DATA = True
'-- Return Values
Const AC_LINE_OFFLINE = 0
Const AC_LINE_ONLINE = 1
Const AC_LINE_BACKUP_POWER = 2
Const AC_LINE_UNKNOWN = 255
Const BATTERY_FLAG_HIGH = 1
Const BATTERY_FLAG_LOW = 2
Const BATTERY_FLAG_CRITICAL = 4
Const BATTERY_FLAG_CHARGING = 8
Const BATTERY_FLAG_NO_BATTERY = 80
Const BATTERY_FLAG_UNKNOWN = 255
Const BATTERY_PERCENTAGE_UNKNOWN = 255
Const BATTERY_LIFE_UNKNOWN = -1
Const BACKUP_BATTERY_LIFEPERCENT_UNKNOWN = 255
Const BACKUP_BATTERY_LIFETIME_UNKNOWN = -1
Const BACKUP_BATTERY_FULL_LIFETIME_UNKNOWN = -1
'-- Query Constants
Const POWER_AC_LINE_STATUS = 0
Const POWER_BATTERY_FLAG = 1
Const POWER_BATTERY_LIFEPERCENT = 2
Const POWER_BATTERY_LIFETIME = 3
Const POWER_BATTERY_FULLLIFETIME = 4
Const POWER_BACKUP_BATTERYFLAG = 5
Const POWER_BACKUP_BATTERYLIFEPERCENT = 6
Const POWER_BACKUP_BATTERYLIFETIME = 7
Const POWER_BACKUP_BATTERYFULLLIFETIME = 8
MsgBox vbce.PowerStatus(POWER_BATTERY_LIFETIME, True)
RegCreateKey
Purpose:
Creates a registry key
Syntax:
control.RegCreateKey Section, Key
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed on a form. |
| Section |
Required. Registry folder - LOCAL_MACHINE, LOCAL_USER,
etc... |
| Key |
Required. The sub-folder to be created in the registry. |
Return Value:
None
Remarks:
None
Example Code:
vbce.RegCreateKey HKEY_LOCAL_MACHINE,
"Software\Dice"
RegDeleteKey
Purpose:
Deletes a registry key.
Syntax:
control.RegDeleteKey Section, Key
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed on a form. |
| Section |
Required. Registry folder - LOCAL_MACHINE, LOCAL_USER,
etc... |
| Key |
Required. The sub-folder to be deleted in the registry. |
Return Value:
None
Remarks:
None
Example Code:
vbce.RegDeleteKey HKEY_LOCAL_MACHINE,
"Software\Dice"
RegDeleteValue
Purpose:
Deletes a registry value.
Syntax:
control.RegDeleteValue Section, Key
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed on a form. |
| Section |
Required. Registry folder - LOCAL_MACHINE, LOCAL_USER,
etc... |
| Key |
Required. The sub-folder + value name to be deleted in the
registry. |
Return Value:
None
Remarks:
None
Example Code:
vbce.RegDeleteValue HKEY_LOCAL_MACHINE,
"Software\Dice\NickName"
RegGetValue
Purpose:
Retrieves a registry value.
Syntax:
control.RegGetValue Section, Key,
ValueName
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed on a form. |
| Section |
Required. Registry folder - LOCAL_MACHINE, LOCAL_USER,
etc... |
| Key |
Required. The sub-folder(key) in the registry. |
| Value Name |
Required. Name of value to retrieve |
Return Value:
Reg Data
Remarks:
None
Example Code:
MsgBox "Return Value: " &
vbce.RegGetValue(HKEY_LOCAL_MACHINE, "Software\Dice", "NickName")
RegSetValue
Purpose:
Sets a registry value.
Syntax:
control.RegSetValue Section, Key, Type,
ValueName, Value
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed on a form. |
| Section |
Required. Registry folder - LOCAL_MACHINE, LOCAL_USER,
etc... |
| Key |
Required. The sub-folder(key) in the registry. |
| Type |
Required. Data Type of value |
| Value Name |
Required. Name of value to set |
| Value |
Required. Actual value to set |
Return Value:
None
Remarks:
None
Example Code:
vbce.RegSetValue HKEY_LOCAL_MACHINE,
"Software\Dice", REG_SZ, "NickName", "The DiceMan"
SendMessageLong
Purpose:
Sends a message to a window. This can be used for multiple
purposes.
Syntax:
control.SendMessageLong(Hwnd, Msg,
wParam, lParam)
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed on a form. |
| hwnd |
Required. A valid Window Handle. |
| Msg |
Required. Msg constant to send to window |
| wParam |
Required. wParam for message |
| lParam |
Required. lParam for message (long value) |
Return Value:
Depends on the message sent.
Remarks:
Consult the SDK documentation on the use of the SendMessage
API.
Example Code:
Const EM_SCROLLCARET = &HB7
'Works around the SelStart scrolling Bug
'Scrolls the text box so that the
'caret (cursor) is in view
Call VBCEUtil1.SendMessageLong( _
Text1.hwnd, EM_SCROLLCARET, 0, 0)
SendMessageString
Purpose:
Sends a message to a window. This can be used for multiple
purposes.
Syntax:
control.SendMessageString(Hwnd, Msg,
wParam, lParam)
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed on a form. |
| hwnd |
Required. A valid Window Handle. |
| Msg |
Required. Msg constant to send to window |
| wParam |
Required. wParam for message |
| lParam |
Required. lParam for message (string value) |
Return Value:
Depends on the message sent.
Remarks:
Consult the SDK documentation on the use of the SendMessage
API.
Example Code:
Const CB_FINDSTRING = &H14C
Dim MyIndex
Combo1.AddItem "Item1"
Combo1.AddItem "Item2"
'Get the position of "Item1"
MyIndex = VBCEUtil1.SendMessageString( _
Combo1.hwnd, CB_FINDSTRING,
-1, "Item1")
If myIndex >= 0 then
VBCEUtil1.Msgbox "Item is at position " & MyIndex
else
VBCEUtil1.Msgbox "Item is not in combo box."
end if
'Get position of "This Item is not there"
MyIndex = VBCEUtil1.SendMessageString( _
Combo1.hwnd, CB_FINDSTRING,
-1, "This Item is not there")
If myIndex >= 0 then
VBCEUtil1.Msgbox "Item is at position " & MyIndex
else
VBCEUtil1.Msgbox "Item is not in combo box."
end if
Shell
Purpose:
Runs an executable program
Syntax:
control.Shell PathName [, Arguments]
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed on a form. |
| PathName |
Required. A valid Filename of an executable to run. |
| Arguments |
Optional. Command line arguments to be passed to the
executable. |
Return Value:
True if the executable was launched,
otherwise False.
Remarks:
Enhanced to work on HPC/Pro's. Windows CE searches the
following directories for the executable (in order):
- The root of the PC Card if it exists.
- The Windows (\windows) directory
- The root directory (\ ) of the device.
Example Code:
if VBCEUtil1.Shell("peghelp.exe",
"soltr.hlp") then
MsgBox "Solitare help was launched."
else
MsgBox "Solitare help was not launched."
End If
Sleep
Purpose:
Causes the application to pause processing for a set amount
of time
Syntax:
control.Sleep Seconds
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed on a form. |
| Seconds |
Required. Number of seconds in thousands to pause. Ex.
5000 = 5 seconds |
Return Value:
None
Remarks:
None
Example Code:
vbce.Sleep 5000
MsgBox "Done sleeping for 5 seconds"
WaitCursor
Purpose:
Shows the WaitCursor (hourglass).
Syntax:
control.WaitCursor WaitCursorOn
Parameters:
| Part |
Description |
| control |
A valid reference to a VBCEUtil control placed on a form. |
| WaitCursorOn |
Required. Boolean (true or false) whether the cursor should
be on. |
Return Value:
None.
Remarks:
WaitCursor does not work in the emulator, only on the device.
Example Code:
VBCEUtil1.WaitCursor True ' Hourglass On
VBCEUtil1.WaitCursor False ' Hourglass Off
|
License
Agreement Distribution
Installation
Methods
AddToRecentDocs
AlwaysOnTopOff
AlwaysOnTopOn
Beep
CreateShortcut
GetHwnd
GetShortcutTarget
InputBox
MemoryStatus
MsgBox
ObjectStore
PlayWaveFile
PowerStatus
RegCreateKey
RegDeleteKey
RegDeleteValue
RegGetValue
RegSetValue
SendMessageLong
SendMessageString
Shell (Enhanced)
Sleep
WaitCursor |