Skip to main content

Past Blast

Featured Products

Windows Mobile Developer Controls
Windows Mobile Developer Controls
Stay in touch using the DEVBUSS RSS feeds.
 

News

Windows Mobile Developer Controls
Windows Mobile Developer Controls

Access PC information from your Pocket PC

Written by Pete Vickers  [author's bio]  [read 57956 times]
Edited by Derek

Download the code

Page 1  Page 2  Page 3 

Using the key sent in ItemKey, we extract the value into WkItem. We then add into the text box the 'title' and the data. The title is extracted from the SplitWords function. If we pass in as in the above case 'PcInfo/User Name', we get returned 'User Name', just to make it look prettier. This routine will allow us to extract the data into text boxes for our user information, memory information and operating system.

The disc space goes into a listview control, with 3 columns:- Drive Letter, Total Space and Space Available.

To fill this listview, we use the following code...

Dim xmlNodeList As IXMLDOMNodeList
Dim xmlNode As IXMLDOMNode
Dim xmlChildNode As IXMLDOMNode
Dim ict As Integer
Dim Lv
Dim NewItem As Boolean

Set xmlNodeList = _
xmlDoc.selectnodes("//DiscSpace")
For Each xmlNode In xmlNodeList
  ' Use the Text property of each node
  ' to write the listview
  NewItem = True
  ict = 0
  For Each xmlChildNode In xmlNode.childnodes
    If NewItem Then
       Set Lv = lvDisc.ListItems.Add _
          (, , xmlChildNode.Text)
       NewItem = False
    Else
       ict = ict + 1
       Lv.SubItems(ict) = _
       xmlChildNode.Text
    End If
  Next
 Next

This will loop through the node list of 'DiscSpace', and then loop through the child nodes, populating the listview.

Finally, we size the listview, enable the tab control, and place the user textbox first in the zorder, and display the user data.

The click event on the tab control, sorts out which control to show...

Private Sub tbs1_Click()
 Select Case tbs1.SelectedItem.Index
 Case 1 'user
   txtUser.Visible = True
   txtUser.ZOrder
   txtOpSys.Visible = False
   txtMemory.Visible = False
   lvDisc.Visible = False
 Case 2 'disc space
   txtUser.Visible = ZOrder
   txtOpSys.Visible = False
   txtMemory.Visible = False
   lvDisc.Visible = True
   lvDisc.ZOrder
 Case 3 'memory
   txtUser.Visible = False
   txtOpSys.Visible = False
   txtMemory.Visible = True
   lvDisc.Visible = False
   txtMemory.ZOrder
 Case 4 'os
   txtUser.Visible = False
   txtOpSys.Visible = True
   txtOpSys.ZOrder
   txtMemory.Visible = False
   lvDisc.Visible = False
 End Select
End Sub

So, clicking on the Disc Space tab gives us...

The Memory tab gives us...

and the Op Sys tab gives us...

This article has tried to tie together the use of the Winsock control, and the suggestion of using it to move around XML data.

Again, this is just a taster of what is possible and to stimulate ideas and discussions. Using this method, you could get at the event logs on a remote PC, deeper user information, in fact, anything that the API and VB will give you.

Thanks then are due to Chris Tacke, Jim Poe, Shakil Siraj and all the other contributors to DEVBUZZ who continue to share their knowledge and ideas.

Previous Page