Embedded Visual Basic 3.0 and the planning of Windows Ce 3.0

Submitted on: 1/27/2015 9:34:00 PM
By: michele berardi (from psc cd)  
Level: Advanced
User Rating: By 6 Users
Compatibility: VB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0, VB Script, ASP (Active Server Pages) , VBA MS Access, VBA MS Excel
Views: 7164
     It is mattering with the times that they run to be able to have access in immediate and simple manner to the always increasing mole of information of whom we need, even if to be able have carried them of breast pocket I do not ruin..... N.B: You can found an Italian Version of this Article here:

This article has accompanying files
I articulate

<--[if gte mso 9]>

<--[if gte mso 10]>

Download here the project source code


Embedded Visual Basic 3.0

and the planning of Windows Ce 3.0

by Michele Berardi


The explosive mania of the pocket applications


It is mattering with the times that they run to be able to have access in immediate and simple manner to the always increasing mole of information of whom we need,  even if to be able have carried them of breast pocket I do not ruin.


After to to be run to gain a PDA and to have some past now to play us on, we notice ourselves that for those this technological wonder hand to hand itself yourselves it it more indispensable not only to organize our engagements but also for very other requirements, even if  we have the talent of the computer program and  in mind a shining idea to apply these technologies, we wonder us if the house motherPlanned the operating system (we will analyze in this case windows ce) makes available us some tools of development.


The suite in matter released like free is called embedded visual I study, itself compone of 2 environments orientated to the development in c/c + + and visual basic, we will take care of ourselves this one. These finish renamed for the occasion in “embedded visual basic”, in synthesis a version to hoc of vbscript. Our escursus will drive us between the characteristic of this environment that for how much pertains the structure of the RAD reflects faithfully the environment visual made basic exception

For some actual features of the systems embedded.


The environment of  development and test.

A time unloaded the environment of development hence:

  (That it weighs about like sole 300mb installer), we proceed in easy manner to its installation on the car of development that I remember to be able to to be used to emulate the embedded systems should ascend an operating system NT compatibile (nt or 2000 goes well).


At the conclusion of the installation we will have embedded coupled it visual basic and visual c + + ready to to be thrown.

Performing embedded visual basic we notice themselves with big satisfaction that for ourselves gotten used to the warm and friendly RAD of visual basic nothing is changed, we note alone some windows in more where we will note for example a pigeonhole to come down with to the indicating inside the name of one of the varied device supported from the technology windows ce.


Certainty we will note the classic helm with the typical controls of vb and all the windows to their place, but extited for the desire to write a program of example, even if a simple form with a button that us show the classic hallo world,

Choosing from menu file a novelty I project we will choose the platform for that breed the form of example, on which operate like with visual basic (introducing controls and code clicking or writing by hand the necessary lines of code). The successive step will be at our discretion the generation of the code vbscript from uploadare on the car pocket pc join to our pc how described in the manual of use of our peripheral pocket pc or the execution of the application in one of the varied environments of emulation distributed with the suite (the emulation will be possible alone on the systems of development having like S. OR. windows.


The differences with Visual Basic

The systems windows ce is a windows32 bit compatible (while is not supported win16 bit for example..)

Whose together of bookstores and functions of system much are reduced and laughs at the bone for obvious motive of solidarity

And meager availability of resources (in origin perhaps could be worth, but today the power of such peripheral grew sensitively).


The first one what that jumps to the eye is the missed support of the UDT (user defined types), thing that goes around with the due sense and simulating the structure that it is wanted representative, therefore in phase of import of the code from visual traditional basic behaves a total rewrote of the portions of code that do use of abovementioned structures.


The general controls of use and of support to the interface user they are all presents (listbox,treeview,filesystem,ecc..) and all supported the  methods exhibited from their seeming desktop, even if turning between the newsgroup complain themselves bug in the management of some methods (for example of winsock control..) .


Other scarcity the direct management of the popup menu (using the calls to the bookstores of system we can hold in check this feauture , the web abounds of code of example..)


The relevant functions to the register there are all and an appropriate api-viewer installed with the tools of embedded visual I study, will help to recreate us the part of code necessary basic code function to the purposes of our program is correctly defined.


To manage THE Pop Up and the function “tap and hold” menu from Embedded Visual Basic


How indicated in the short panoramic one on embedded visual basic an of the scarcities in limits of management directed by part of embedded visual basic they are the Pop Up menu and the function “tap and hold” typical of the palm systems equipped of touch screen, equivalent of the function “right key of the mouse” natural part of the traditional pc.


I will pick the occasion for drive you throught some steps in the accomplishment of a simple application with embedded visual inclusive basic of the management of the  Pop menu Up, using some actual functions of bookstore of the kernel of windows ce.


Basic visual basic environment skill is required, therefore alone some intervent when in the course of the guided accomplishment will be found us opposite to actual operations of embeded visual basic.


Ahead all we will proceed to the creation of a new project, if to the start of embedded visual basic will not appear the window “new project”, we will proceed choosing from the menu “File” the voice “new project” and from the window will choose a relevant project to an of the platforms installed. For convenience we choose the model named: “Windows CE for Pocket PC project” and we choose “ok”.  Now we will have the classic empty form on which build our application.



For first thing we add to the project a new form of program, moving us in the window project or from the menu file choosing the voice “add moduls”, to its inside we will introduce the following lines of code:


Option Explicit


Public CurX As Integer, CurY As Integer, MenuX As Integer, MenuY As Integer


Public Const MF_ENABLED = &H0&

Public Const MF_STRING = &H0&

Public Const MF_GRAYED = &H1&

Public Const MF_CHECKED = &H8&

Public Const MF_UNCHECKED = &H0&

Public Const MF_SEPARATOR = &H800&


Public Const TPM_CENTERALIGN = &H4

Public Const TPM_RIGHTALIGN = &H8

Public Const TPM_BOTTOMALIGN = &H20

Public Const TPM_VCENTERALIGN = &H10

Public Const TPM_TOPALIGN = &H0&

Public Const TPM_LEFTALIGN = &H0&

Public Const TPM_RETURNCMD = &H100&


Public OpVec(10), OpName (10) As Integer


Public Declare Function CreatePopupMenu Lib "Coredll" () As Long


Public Declare Function AppendMenu Lib "Coredll" Alias "AppendMenuW" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As String) As Long


Public Declare Function TrackPopupMenuEx Lib "Coredll" (ByVal hMenu As Long, ByVal an As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal hWnd As Long, lpTPMParams As Long) As Long


Function ShowPopupMenu (intPosLeft As Integer, intPosTop As Integer, frmName As Form) As Integer


Dim hMenu As Long


' -beginning- construction and popolamento of the pop up menu


hMenu = CreatePopupMenu


               AppendMenu hMenu, OpVec(1), 1, OpName (1)

               AppendMenu hMenu, OpVec(2), 2, OpName (2)

           AppendMenu hMenu, MF_SEPARATOR, 0, "--------------------"

               AppendMenu hMenu, OpVec(3), 3, OpName (3)

               AppendMenu hMenu, OpVec(4), 4, OpName (4)

                AppendMenu hMenu, OpVec(5), 5, OpName (5)



' -end- construction


ShowPopupMenu = (TrackPopupMenuEx (hMenu, TPM_LEFTALIGN Or TPM_TOPALIGN Or TPM_RETURNCMD, intPosLeft, intPosTop, frmName. hWnd, 0))


End Function




Now we return at our empty form and insert a button of order making sure us of to name it “cmdOpzioni” and a label, to which we will give the name “lblRisultato”.


Subsequently we add to the form an event Timer, rename it “mnuTimer”, this event will be occupied to monitor and to moderate intervals of time if the user carries out operations of tap & hold on the button of order “cmdOpzioni”, additional to our form.


Select our form and go in the code display of formal procedure.


select in the procedure started of default to the loading of the Form, which will make turn the execution of the program (safe different choice in phase of definition of the project), named Form_Load(), and we introduce this code:



' we boot the strip of the options to pass the function that emulates

' the menu to come down...








OpName (1) = "       First Option"

OpName (2) = "     Second Option"

OpName (3) = "    Inactive Option"

OpName (4) = "   Chosen of Default"

OpName (5) = "Inactive-Chosen"


Subsequently  and outside from the procedure Form_Load() , we introduce these lines of code:


Private Sub cmdOpzioni_MouseDown (ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

  CurX = X

  CurY = Y

  MenuX = X + cmdOpzioni. Left

  MenuY = Y + cmdOpzioni. Top

  mnuTimer. Enabled = True

End Sub


Private Sub cmdOpzioni_MouseMove (ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

  '  if the pen is moved from the object we are unaware of the function of "tap & hold"

  If Abs (CurX - X) > 4 Then mnuTimer. Enabled = Fake

  If Abs (CurY - Y) > 4 Then mnuTimer. Enabled = Fake

End Sub


Private Sub cmdOpzioni_MouseUp (ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

  mnuTimer. Enabled = Fake

End Sub


Private Sub mnuTimer_Timer ()


   Dim intMenuResult As Integer

   mnuTimer. Enabled = Fake

   intMenuResult = ShowPopupMenu (MenuX, MenuY + 30, Me)

   lblRisultato. Caption = "you chose the option: " & OpName (1)

 ' introducing a structure houses.. select

 ' we can manage better the operations

 ' To perform in base to the choice of the user.


 Select Houses intMenuResult

   Houses 1

      ' you introduce here the code that will go performed if the user

     ' it chooses this option..........................

   Houses 2

   Houses 3

     'the option is disabled....

   Houses 4

   Houses 5

      'option disabled..........

 End Select

  ' to activate and to deactivate the option man hand that we work over be there we entrust

  ' to the function exclusive...Or

  OpVec (intMenuResult) = OpVec (intMenuResult) Xor MF_CHECKED

End Sub






Now we are ready to make endorser under emulation or directly on the car target the ours program,

and it is therefore arrived the time to illustrate the phases of set up of the environment of emulation and the installation of packet of creation stand-alonr for all systems windows ce compatible with our application of example (in this case there we entrust alone to functions of the kernel of windows ce present in all his reincarnations. .).


How to boot the environment for the emlation and create packet of installation for the target machine


move itself in the menu File, choose the option make (near the voice “nomeprogetto. vb”) and to breed the file



Subsequently to move itself in Tools / Remote Tools / and to choose “Application Install Wizard”.


The wizard will follow us during everything  the phases of construction of the file. cab asking us the route of the files of project and other information, in the following order:


1. file of project. ebp

2. file I project. vb

3. folder where will come created the file of the installer

4. the/the processors for which include the runtimes

5. eventual active-additional x to include in the file of installation

6. files of data additional user

7. the directory of destination, more a series of data describing the application (description,producer,ecc..)


Us not awn that click on install and to breed the file. cab and the remote installer.  The phase of copy of the file of installation of the application happens is copying directly on the device the file. cab that starting the application of install bred from the trial, that will provide is to copy the necessary files on the pocket pc that to invite the user to install I applied it.





All it adds the suite Microsoft Embedded visual I study 3.0 is free and is rich of relevant documentation to the planning of the windows ce devices, even I notice some bug in the planning of some relevant components to adoce (I think does not reduced to the smaller limits and suitable to manage the systems windows ce...) and winsock.


The community of developers is lively at work for patching or use some tricks for scarcities aside of mommy microsoft like for example the direct support for the popup menu  and the scarcity of UDT (user defined types).




[1] Pocket PC Development in the Enterprise Microsoft Press, Andreas Sjostrom and Christian Forsberg.

[2] to Program Windows Ce Microsoft Press , Douglas Boling.





Michele Berardi

Computer program Senior

It has working for different months on the pocket pc for account of a partner Hewlett Packard.

It works at present like Computer Program Senior.

E-mail(s ) : 03473192000@vizzavi. it

winzip iconDownload article

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net

Other 8 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Advanced category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)

To post feedback, first please login.