VBCE.com - The Premier Website For Visual Basic/CE Developers

 

*Dev Corner

Sample Code
Controls
Workarounds
Tips & Tricks
Q & A
Forums

*Goodies
Downloads
Software
Bookstore


*General
Home
What's New
General Info
Misc. Info


*News Worthy
News
Articles
Editorials
KB Articles
Reviews
Awards

*Miscellaneous
Web Links
Partners
Search
Feedback
Advertising

<% On Error Resume Next SiteStats() %>

Sponsors


More...


Miscellaneous Utility Control

Documentation Version 1.0

Download - VBCEMiscUtil.exe (266k)

License Aggreement
THIS SOFTWARE IS PROVIDED "AS-IS". NEITHER THE AUTHOR NOR ITS SUPPLIERS MAKES ANY WARRANTY, EXPRESS OR IMPLIED WITH RESPECT TO THE CONTENT OF THIS SOFTWARE OR THE ACCURACY OF ANY INFORMATION CONTAINED HEREIN, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. BECAUSE SOME STATES / JURISDICTIONS DO NOT ALLOW EXCLUSIONS OF IMPLIED WARRANTIES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU.

IN NO EVENT SHALL THE AUTHOR OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THIS PRODUCT, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU.

Distribution
SHAREWARE - THIS SOFTWARE IS PROVIDED "AS-IS". NEITHER THE AUTHOR NOR ITS SUPPLIERS MAKES ANY WARRANTY, EXPRESS OR IMPLIED WITH RESPECT TO THE CONTENT OF THIS SOFTWARE OR THE ACCURACY OF ANY INFORMATION CONTAINED HEREIN, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

The setup program for this control may not be redistributed without prior permission from the author. You may freely redistribute the dlls with your applications.

Installation
The setup program will register the control on your system for use in the emulator and the desktop (your development environment). You will need to use the control manager to register the control on the devices. Prior to registering the control on the device, you will need to copy the ATLCE.DLL from the appropriate sub-directory (mips or SH3) located in the installation directory to the device and register it. To register the control, simply go to the Windows CE 2.0 Start menu, select Run, and execute the following command:

    regsvrce.exe \Windows\AtlCe.Dll

   or

    regsvr.exe \Windows\AtlCe.Dll

Methods

AlwaysOnTopOff
AlwaysOnTopOn
MsgBox
PlayWaveFile
SendMessageLong
SendMessageString
Shell
WaitCursor


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


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 opperation
End If


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"


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 postion 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:

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


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 Aggreement

Distribution

Installation

Methods
  AlwaysOnTopOff
  AlwaysOnTopOn
  MsgBox
  PlayWaveFile
  SendMessageLong
  SendMessageString
  Shell
  WaitCursor



VBCE.com is DevX Winner!

Unless otherwise noted, all information on VBCE.com is Copyright 1998 - 2002
Windows, Windows CE, and Visual Basic are trademarks of the Microsoft Corporation.
VBCE.com is not responsible for content on external sites.
Send all feedback to webmaster@vbce.com
Webmasters - feel free to link to
VBCE.com - Premier Website for Visual Basic/CE Development

Buy Books!