Windows Mobile 6 Registry
Windows Mobile 6 Registry
Windows Mobile 6 Registry
Windows Mobile 6 Registry
Windows Mobile 6 Registry
Windows Mobile 6 Registry Windows Mobile 6 Registry Windows Mobile 6 Registry Windows Mobile 6 Registry Windows Mobile 6 Registry Windows Mobile 6 Registry Windows Mobile 6 Registry Windows Mobile 6 Registry
Windows Mobile 6 Registry Windows Mobile 6 Registry
Windows Mobile 6 Registry
Go Back  Xtreme Visual Basic Talk > > > Windows Mobile 6 Registry


Reply
 
Thread Tools Display Modes
  #1  
Old 02-13-2008, 04:52 AM
Musicman247 Musicman247 is offline
Newcomer
 
Join Date: Feb 2008
Posts: 8
Question Windows Mobile 6 Registry


First of all, hello. This is my first post, and I am somewhat of a VB n00b.

I am trying to write a program for Windows Mobile 6 Pro that will allow the user to see specific values from the registry and then edit them (preferably using the same textbox for reading and editing).

I've been searching the Net for a few days now, but I have not been able to find code that is specifically for Windows Mobile. Is there a difference when calling a WM registry and a Windows Registry?

I looked at AllAPI.net suggested by AtmaWeapon to another user and found several pages about the Registry, but upon trying to run the code found there VB came back with over 24 errors. I tried to fix them, but when I ran the Debug nothing was working correctly.

I'm sorry to be a pain, but I have tried searching, and maybe I just don't know here to to look, but I have not found anything helpful yet. I am not asking for a step-by-step (although one would be greatly appreciated), just a place to get started. I would prefer to stay in OOP, since I understand that much better than C#.

Any help would be appreciated.
Reply With Quote
  #2  
Old 02-13-2008, 08:25 AM
AtmaWeapon's Avatar
AtmaWeaponWindows Mobile 6 Registry AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

Welcome to the forums, Musicman247. Before I help you I'm afraid I'm going to call something out.
Quote:
Originally Posted by Musicman247 View Post
I would prefer to stay in OOP, since I understand that much better than C#.
This is obviously false; I question whether you even know what OOP is, and it is my duty as a responsible programmer to educate you in the hopes that you learn how to be more effective. The following is a high-level overview; I encourage you to study further.

*snipped* This was harsh; I apologize in advance for putting it in here, but please go read up on OOP to understand why your statement is wrong. OOP is a design methodology. VB6 is a language that is almost OOP. VB .NET is OOP. C# is OOP. All .NET languages must be OOP. The claim that you want to avoid C# because you want to stick to OOP is a sign that you do not understand OOP.

Now, to address the problem, when you found where I talked about API for the registry, did it include a healthy suggestion to use the Registry class in .NET? As far as I know, there's no reason to use API to access the registry. The only members not supported in the Compact Framework seem to be CurrentConfig and PerformanceData, and I take this to mean that those base keys do not exist on Windows Mobile.

Can you address the following things?
  • Are you using VB6 or VB .NET?
  • Can you post the code you have tried that failed?
  • Can you point to the thread where I suggested some AllAPI code? If I didn't suggest using the Registry class there might be a good reason.
  • What were the 24 errors?
  • Have you tried the Registry class? If so, why didn't it work?
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.

Last edited by AtmaWeapon; 02-13-2008 at 08:31 AM.
Reply With Quote
  #3  
Old 02-13-2008, 09:00 AM
Musicman247 Musicman247 is offline
Newcomer
 
Join Date: Feb 2008
Posts: 8
Default

Thank you for calling me out. I am not familiar with the terminology associated with programming, as the last time I programmed it was 6 years ago in C++. And even then it was just a college course.

I guess I was referring to VB .NET.

I have tried the code from AllAPI http://allapi.mentalis.org/apilist/RegOpenKey.shtml (link found at the bottom of the page)

As well as the code posted here: http://www.programmersheaven.com/mb/...=B20000#368454

I apologize for attributing the link to AllAPI to you. I checked again and found I was mistaken. Import/Export a small registry Hive/subhive That is the thread I saw, but I did not visit the site until I had read several other posts that came up after my search for "mobile registry".

The 24 errors seemed to be dealing with syntax. This piece of code

strBuf = String(lDataBufSize, Chr$(0))

Gave me an error of improper use of String and $ not fitting with the variable Char.

To be honest I don't have a clue what the Registry class is or how to use it. I've been up all night trying to make sense of the pages on MSDN http://msdn2.microsoft.com/en-us/library/aa914389.aspx and can make neither heads nor tales of it.

Like I said to begin with I'm a n00b who doesn't deserve to be led by the hand through this stuff, but I wouldn't mind somebody pointing me in the right direction.

It seems like it should be a pretty straightforward thing to do (read a registry value, then update it based on user input). Maybe it's more difficult than I expected?

Thanks for any help you can give me.
Reply With Quote
  #4  
Old 02-13-2008, 11:54 AM
AtmaWeapon's Avatar
AtmaWeaponWindows Mobile 6 Registry AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

OK, now we're getting somewhere and I think I can help you a good bit. The forum post you are referencing is in the VB 4/5/6 parts of the forums. These legacy versions of VB have similar syntax and spirit as VB .NET, but there were also significant changes to the language in the past few years, so things don't always correspond one-to-one between legacy VB and VB .NET.

The Registry class is a .NET class that is used to manipulate values in the registry, along with a few other related classes.

The code below demonstrates getting and setting the value of a registry key. Make a form with two text boxes and two buttons, then paste the code below into a form. Button1 will be our "get" button, and Button2 will be our "set" button. TextBox1 will contain the value that we get from the registry, and TextBox2 will contain the value you want to set. For simplicity, we'll use a string value. The registry key we'll work with is HKEY_CURRENT_USER\Software\Test\Test
Code:
Imports Microsoft.Win32

Public Class Form1
    Const RegKey As String = "Software\Test\Test"

    ' Get the value of a registry key
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim HKCU As RegistryKey = Registry.CurrentUser
        Dim myKey As RegistryKey = HKCU.OpenSubKey(RegKey, False)

        ' If the registry key does not exist, then Nothing will be returned by OpenSubKey.
        If myKey IsNot Nothing Then
            ' Get the default value and display it in a text box
            TextBox1.Text = myKey.GetValue("").ToString()
            myKey.Close()
        Else
            TextBox1.Text = "Doesn't exist!"
        End If

        HKCU.Close()
    End Sub

    ' Set the value of a registry key
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If TextBox1.Text.Length <= 0 Then
            ' Don't do anything if there's no text
            Return
        End If

        Dim HKCU As RegistryKey = Registry.CurrentUser
        Dim myKey As RegistryKey = HKCU.OpenSubKey(RegKey, True)

        If (myKey Is Nothing) Then
            ' If the registry key wasn't already there, create it
            HKCU.CreateSubKey(RegKey)
            myKey = HKCU.OpenSubKey(RegKey, True)
        End If

        myKey.SetValue("", TextBox2.Text)
    End Sub
End Class
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #5  
Old 02-15-2008, 02:13 AM
Musicman247 Musicman247 is offline
Newcomer
 
Join Date: Feb 2008
Posts: 8
Default

Thanks for the help!

I searched for Registry class on MSDN and found just what I needed!

Last edited by Musicman247; 02-15-2008 at 03:19 AM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Windows Mobile 6 Registry
Windows Mobile 6 Registry
Windows Mobile 6 Registry Windows Mobile 6 Registry
Windows Mobile 6 Registry
Windows Mobile 6 Registry
Windows Mobile 6 Registry Windows Mobile 6 Registry Windows Mobile 6 Registry Windows Mobile 6 Registry Windows Mobile 6 Registry Windows Mobile 6 Registry Windows Mobile 6 Registry
Windows Mobile 6 Registry
Windows Mobile 6 Registry
 
Windows Mobile 6 Registry
Windows Mobile 6 Registry
 
-->