Here is some code that is not working right for me. This is designed to run on Compact Framework 1, so I cannot just use the registry classes. Obviously GetInstalledVersions() is incomplete as far as what it is returning , but the part that I can't figure out is the call to RegQueryValueEx, which returns a value of 2 instead 0. I already tried passing in an array of bytes instead of the StringBuilder but this did not fix it. The device I am testing this code on does have a registry entry here. I looked it up using a registry viewer. Any ideas? - public class CompactFrameworkVersionChecker
-
-
{
-
private const uint HKEY_LOCAL_MACHINE = 0x80000002;
-
-
[DllImport("coredll.dll", CharSet=CharSet.Unicode)]
-
private static extern uint RegOpenKeyEx(
-
uint HKEY,
-
string lpSubKey,
-
int ulOptions,
-
uint samDesired,
-
out uint phkResult);
-
-
[DllImport("coredll.dll", CharSet=CharSet.Unicode)]
-
private static extern uint RegQueryValueEx(
-
uint hKey,
-
string lpValueName,
-
int lpReserved,
-
ref int lpType,
-
StringBuilder lpData,
-
ref int lpcbData);
-
-
[DllImport("coredll.dll")]
-
private static extern int RegCloseKey(uint hkey);
-
-
public static string[] GetInstalledVersions()
-
{
-
uint key;
-
uint ret;
-
-
int lpType = new int();
-
StringBuilder lpData = new StringBuilder();
-
int lpcbData = lpData.Length;
-
ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft", 0, 0, out key);
-
string[] installedVersions = new string[] { };
-
if (ret == 0)
-
{
-
ret = RegQueryValueEx(key, ".NETCompactFramework", 0, ref lpType, lpData, ref lpcbData);
-
if (ret == 0)
-
{
-
// success, your data in in lpData to be converted
-
installedVersions = new string[] { lpData.ToString() };
-
}
-
}
-
RegCloseKey(key);
-
return installedVersions;
-
}
-
}
-
3 4479
You are using a compact framework app to check the version of compact framework?
... This is designed to run on Compact Framework 1...s
Shouldn't the program just give Compact Framework 1 as the answer then?
That command pops up a window to tell you what version of CF you have running. Although it requires that you not be headless, and it doesn't help you at runtime.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Duncan |
last post by:
I am using the evaluation version of CE.NET 4.1.
I had also installed the release version of the Compact
Framework.
I uninstalled the CE.NET 4.1, and then realized I needed
it again and...
|
by: Asad Khan |
last post by:
Hi, I have Visual Studio 2002 Enterprise Architecture Edition. I was
wondering if anyone has any information on how I can develop applications
for .Net Compact Framework using this IDE. I've heard...
|
by: paul |
last post by:
I have developed an application for pocket pc that requires multiple forms to be open at any one time. The user is able to flick from one to the other, making changes to each as and when necessary...
|
by: j.b.messina |
last post by:
This has not yet been published by Microsoft. It will be published
within the next few weeks, mainly because I asked them to. I felt this
was information badly needed, and I think this is the...
|
by: André Giesing |
last post by:
Hello NG!
I've got a short question:
Is there a difference of the internal representation of a Hashtable between
the Compact Framework and the normal Framework?
I've got the suspicion,...
|
by: Hans Kesting |
last post by:
Is it possible to mix code meant for the CompactFramework and
code meant for the standard framework?
We are trying to make PDA and light-weight "laptop" versions of
one application. This means a...
|
by: Jak Sparrow |
last post by:
What are some good ways to programmatically check for software already
installed on a computer?
For example, to check a version of Internet Explorer, a program can check
the registry for the...
|
by: eSolTec, Inc. 501(c)(3) |
last post by:
Thank you in advance for any and all assistance. It is greatly appreciated.
Is there a way to programmatically check for .NET Framework versions
installed on the computer?
--
Michael Bragg,...
|
by: dancer |
last post by:
I have made a new post because when I try to respond to another, I get the
error, "Article Rejected -- Ill-formed message id"
This is in response to the advice of Juan Libre to install Net...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
| |