Hello,

I am trying to create a setup.dll file. In the "Install_Exit" part of
Setup.dll i am trying to find if .net compact framework is installed
or not. My knowledge of evc++ is minimal. I understand from what i
read, that i should use RegOpenKeyEx :

RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\Microsoft\
\.NETCompactFramework"),0,0,&key)

After i open this how do i read the values of this key. I will need
the values to know which version of .NET CF is installed on the
system. I read some where that it would be 2.0.0.0 for .NET CF 2.0,
but when i checked that value on my PPC using remote registry editor,
that value was 2.0.5238.00.

So my question is, is there any way with which i can read these values
programmatically. And i guess i can assume that if any of these values
starts with "2.0", then .Net CF is installed.


Also it would be great if some one could point me to some link where i
can open a web link programmatically from this setup.dll in IE. In
this link i intend to place the .NET CF binaries for the user to
download.

Thanks in advance and Regards,
Rithesh

Re: Read Values of Registry Key by ctacke/>

ctacke/>
Wed Sep 12 04:53:48 PDT 2007

Here's a list of version numbers:

http://blog.opennetcf.com/ncowburn/2007/08/22/HOWTODeterminingTheNETCompactFrameworkVersion.aspx


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com


"Rithesh" <rithesh.rg@gmail.com> wrote in message
news:1189596344.990818.227070@y42g2000hsy.googlegroups.com...
> Hello,
>
> I am trying to create a setup.dll file. In the "Install_Exit" part of
> Setup.dll i am trying to find if .net compact framework is installed
> or not. My knowledge of evc++ is minimal. I understand from what i
> read, that i should use RegOpenKeyEx :
>
> RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\Microsoft\
> \.NETCompactFramework"),0,0,&key)
>
> After i open this how do i read the values of this key. I will need
> the values to know which version of .NET CF is installed on the
> system. I read some where that it would be 2.0.0.0 for .NET CF 2.0,
> but when i checked that value on my PPC using remote registry editor,
> that value was 2.0.5238.00.
>
> So my question is, is there any way with which i can read these values
> programmatically. And i guess i can assume that if any of these values
> starts with "2.0", then .Net CF is installed.
>
>
> Also it would be great if some one could point me to some link where i
> can open a web link programmatically from this setup.dll in IE. In
> this link i intend to place the .NET CF binaries for the user to
> download.
>
> Thanks in advance and Regards,
> Rithesh
>



RE: Read Values of Registry Key by dbgrick

dbgrick
Wed Sep 12 06:36:01 PDT 2007

Here is some sample code that let's you read the values

void ReadCFVersion
{
TCHAR tzValueName[MAX_PATH];
BYTE tzValue[MAX_PATH];
DWORD dwValueSize, dwValueNameSize, dwType;
DWORD dwIndex = 0;
BOOL returnValue = TRUE;
HKEY hKEY;

long l = RegOpenKeyEx (HKEY_LOCAL_MACHINE,
_T("Software\\Microsoft\\.NETCompactFramework"), 0, 0, &hKEY);

if (l != ERROR_SUCCESS)
{
return TRUE;
}
else
{
memset(tzValueName, 0, MAX_PATH * sizeof(TCHAR));
memset(tzValue, 0, MAX_PATH);
dwValueSize = MAX_PATH;
dwValueNameSize = MAX_PATH;

while(RegEnumValue(hKEY, dwIndex, tzValueName, &dwValueNameSize,
NULL, &dwType, tzValue, &dwValueSize) == ERROR_SUCCESS)
{
// Do something with the tzValueName you could check
tzValue[0] to see if it is 2 for CF Version 2. The cf version is located in
the key name

dwIndex++;
}

RegCloseKey(hKEY);
return returnValue;
}
}
else
{
return FALSE;
}
}

Rick D.
Contractor

"Rithesh" wrote:

> Hello,
>
> I am trying to create a setup.dll file. In the "Install_Exit" part of
> Setup.dll i am trying to find if .net compact framework is installed
> or not. My knowledge of evc++ is minimal. I understand from what i
> read, that i should use RegOpenKeyEx :
>
> RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\Microsoft\
> \.NETCompactFramework"),0,0,&key)
>
> After i open this how do i read the values of this key. I will need
> the values to know which version of .NET CF is installed on the
> system. I read some where that it would be 2.0.0.0 for .NET CF 2.0,
> but when i checked that value on my PPC using remote registry editor,
> that value was 2.0.5238.00.
>
> So my question is, is there any way with which i can read these values
> programmatically. And i guess i can assume that if any of these values
> starts with "2.0", then .Net CF is installed.
>
>
> Also it would be great if some one could point me to some link where i
> can open a web link programmatically from this setup.dll in IE. In
> this link i intend to place the .NET CF binaries for the user to
> download.
>
> Thanks in advance and Regards,
> Rithesh
>
>

RE: Read Values of Registry Key by dbgrick

dbgrick
Wed Sep 12 06:40:04 PDT 2007

Here's a C# version

private void GetCFVersion()
{
Microsoft.Win32.RegistryKey key = null;
string[] subKeyNames;

try
{
key =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\.NETCompactFramework");

subKeyNames = key.GetValueNames();

// Do something with the key names in subKeyNames. The cf
versions exist here
}
catch(Exception ex)
{
// Do something with the error
}
finally
{
if (key != null)
{
key.Close();
}
}
}

Rick D.
Contractor

"dbgrick" wrote:

> Here is some sample code that let's you read the values
>
> void ReadCFVersion
> {
> TCHAR tzValueName[MAX_PATH];
> BYTE tzValue[MAX_PATH];
> DWORD dwValueSize, dwValueNameSize, dwType;
> DWORD dwIndex = 0;
> BOOL returnValue = TRUE;
> HKEY hKEY;
>
> long l = RegOpenKeyEx (HKEY_LOCAL_MACHINE,
> _T("Software\\Microsoft\\.NETCompactFramework"), 0, 0, &hKEY);
>
> if (l != ERROR_SUCCESS)
> {
> return TRUE;
> }
> else
> {
> memset(tzValueName, 0, MAX_PATH * sizeof(TCHAR));
> memset(tzValue, 0, MAX_PATH);
> dwValueSize = MAX_PATH;
> dwValueNameSize = MAX_PATH;
>
> while(RegEnumValue(hKEY, dwIndex, tzValueName, &dwValueNameSize,
> NULL, &dwType, tzValue, &dwValueSize) == ERROR_SUCCESS)
> {
> // Do something with the tzValueName you could check
> tzValue[0] to see if it is 2 for CF Version 2. The cf version is located in
> the key name
>
> dwIndex++;
> }
>
> RegCloseKey(hKEY);
> return returnValue;
> }
> }
> else
> {
> return FALSE;
> }
> }
>
> Rick D.
> Contractor
>
> "Rithesh" wrote:
>
> > Hello,
> >
> > I am trying to create a setup.dll file. In the "Install_Exit" part of
> > Setup.dll i am trying to find if .net compact framework is installed
> > or not. My knowledge of evc++ is minimal. I understand from what i
> > read, that i should use RegOpenKeyEx :
> >
> > RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\Microsoft\
> > \.NETCompactFramework"),0,0,&key)
> >
> > After i open this how do i read the values of this key. I will need
> > the values to know which version of .NET CF is installed on the
> > system. I read some where that it would be 2.0.0.0 for .NET CF 2.0,
> > but when i checked that value on my PPC using remote registry editor,
> > that value was 2.0.5238.00.
> >
> > So my question is, is there any way with which i can read these values
> > programmatically. And i guess i can assume that if any of these values
> > starts with "2.0", then .Net CF is installed.
> >
> >
> > Also it would be great if some one could point me to some link where i
> > can open a web link programmatically from this setup.dll in IE. In
> > this link i intend to place the .NET CF binaries for the user to
> > download.
> >
> > Thanks in advance and Regards,
> > Rithesh
> >
> >

Re: Read Values of Registry Key by Rithesh

Rithesh
Wed Sep 12 21:30:34 PDT 2007

Thanks a lot Rick and Chris. That was exactly what i wanted.

Anyways the answer to the 2nd question i had posted is to use the
CreateProcess method

PROCESS_INFORMATION pi = {0};
LPCTSTR lpExe = _T("iexplore.exe");
LPCTSTR lpCmdLine = _T("The http link");
CreateProcess(lpExe, lpCmdLine, NULL, NULL, FALSE, 0, NULL, NULL,
NULL, &pi);

Thanks a lot again.

Regards,
Rithesh


On Sep 12, 6:40 pm, dbgrick <dbgr...@discussions.microsoft.com> wrote:
> Here's a C# version
>
> private void GetCFVersion()
> {
> Microsoft.Win32.RegistryKey key = null;
> string[] subKeyNames;
>
> try
> {
> key =
> Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\.NETCompactFramework");
>
> subKeyNames = key.GetValueNames();
>
> // Do something with the key names in subKeyNames. The cf
> versions exist here
> }
> catch(Exception ex)
> {
> // Do something with the error
> }
> finally
> {
> if (key != null)
> {
> key.Close();
> }
> }
> }
>
> Rick D.
> Contractor
>
> "dbgrick" wrote:
> > Here is some sample code that let's you read the values
>
> > void ReadCFVersion
> > {
> > TCHAR tzValueName[MAX_PATH];
> > BYTE tzValue[MAX_PATH];
> > DWORD dwValueSize, dwValueNameSize, dwType;
> > DWORD dwIndex = 0;
> > BOOL returnValue = TRUE;
> > HKEY hKEY;
>
> > long l = RegOpenKeyEx (HKEY_LOCAL_MACHINE,
> > _T("Software\\Microsoft\\.NETCompactFramework"), 0, 0, &hKEY);
>
> > if (l != ERROR_SUCCESS)
> > {
> > return TRUE;
> > }
> > else
> > {
> > memset(tzValueName, 0, MAX_PATH * sizeof(TCHAR));
> > memset(tzValue, 0, MAX_PATH);
> > dwValueSize = MAX_PATH;
> > dwValueNameSize = MAX_PATH;
>
> > while(RegEnumValue(hKEY, dwIndex, tzValueName, &dwValueNameSize,
> > NULL, &dwType, tzValue, &dwValueSize) == ERROR_SUCCESS)
> > {
> > // Do something with the tzValueName you could check
> > tzValue[0] to see if it is 2 for CF Version 2. The cf version is located in
> > the key name
>
> > dwIndex++;
> > }
>
> > RegCloseKey(hKEY);
> > return returnValue;
> > }
> > }
> > else
> > {
> > return FALSE;
> > }
> > }
>
> > Rick D.
> > Contractor
>
> > "Rithesh" wrote:
>
> > > Hello,
>
> > > I am trying to create a setup.dll file. In the "Install_Exit" part of
> > > Setup.dll i am trying to find if .net compact framework is installed
> > > or not. My knowledge of evc++ is minimal. I understand from what i
> > > read, that i should use RegOpenKeyEx :
>
> > > RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\Microsoft\
> > > \.NETCompactFramework"),0,0,&key)
>
> > > After i open this how do i read the values of this key. I will need
> > > the values to know which version of .NET CF is installed on the
> > > system. I read some where that it would be 2.0.0.0 for .NET CF 2.0,
> > > but when i checked that value on my PPC using remote registry editor,
> > > that value was 2.0.5238.00.
>
> > > So my question is, is there any way with which i can read these values
> > > programmatically. And i guess i can assume that if any of these values
> > > starts with "2.0", then .Net CF is installed.
>
> > > Also it would be great if some one could point me to some link where i
> > > can open a web link programmatically from this setup.dll in IE. In
> > > this link i intend to place the .NET CF binaries for the user to
> > > download.
>
> > > Thanks in advance and Regards,
> > > Rithesh