Re: VS2005 compatibility
- From: "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT com>
- Date: Tue, 5 Sep 2006 16:41:59 -0700
Yes, the application might have the wrong setting for the OS version
(although I think that this might have a customized error), the wrong
setting for the Windows subsystem, the wrong processor selected. There
isn't a long list, but there are a few items. I'm looking to see if I can
figure out what the list is, exactly. Try putting the registry class in the
same file as the tmain() function.
Paul T.
"Long" <Long@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3A0B9671-30B2-4855-90F3-8E9CA6030AE1@xxxxxxxxxxxxxxxx
Hi Paul, Thanks for your helping. Yes, I'm using CE 5.0. Would that
message
be a generic one? I mean that other errors could also generate this
message?
"Paul G. Tobey [eMVP]" wrote:
And the device that you are targeting is running Windows CE 5.0? I don't
see any problems with the header or the imports. The header is marked
for
THUMB processor, Windows CE 5.0, GUI, all standard stuff for targeting
Windows CE ARM-based devices running 5.0 or later.
Paul T.
"Long Deng" <langdeng@xxxxxxxxxxx> wrote in message
news:OcfJaVT0GHA.3440@xxxxxxxxxxxxxxxxxxxxxxx
Hi Paul,
Attached is the ZIP of the problem EXE. Thank you.
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT
com> wrote in message news:%23956p%23S0GHA.4408@xxxxxxxxxxxxxxxxxxxxxxx
If you're using a Web-based interface, I can't help you with
attachments.
I'm using a real newsreader which has no problems with it.
You say "I can download the program to the target device to run it".
So,
what happens if you try to run the problem program in the debugger?
Paul T.
"Long" <Long@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:DD9213CA-BF6A-47E2-BA60-2EA3BC140A69@xxxxxxxxxxxxxxxx
I don't think I was using an emulator, because I can download the
program
to
the target device to run it (first example) or copy the program
manually
to
the device and run it.
As for the Workspace I mentioned, actually the two example are using
the
same project "workspace". I just modified the _tmain() function to
call
APIs
or use the CReg. So the project settings should be the same. They
are
all
compiled successfully. The only differece is one can run and the
other
not.
I don't know how to attached the exe here. I cannot find any other
options.
"Paul G. Tobey [eMVP]" wrote:
2. In this wizard, you adjusted things so that the targets listed
are
just
your specific device?
Are you sure you're not building for the Colibri emulator? That
would
be
an
x86 EXE, not ARM, as needed for the real device. Project settings
are
not
attached to a workspace; they are part of the project. If the
project
was
not generated as a Smart Device application, you've found your
problem.
You can attach the EXE itself and I'll see what the headers look
like,
but
the system works well, generally, so you're doing something way off
the
track...
Paul T.
"Long" <Long@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5EDFDEB1-4B4D-4869-A0D4-02278F09E4A7@xxxxxxxxxxxxxxxx
I must make some mistakes when typing the second examples, i.e.
ValueDW(),
instead of copying and pasteing the code. I think I did the same
as
you
did
except my program cannot run. This is what I did.
1. Create a Smart Device project.
2. Remove the default device and select my device: Colibri.
3 Select Console Application. ATL, MFC and Empty project are
unchcked.
4. Then finish thw wizard. Everything is in default settings.
5. Then type in my code, compile and run with or without
debugging.
These projects do not need additional libraries. But I don't know
what
default libs they use. So I don't think I change them. Besides I
use
the
same workspace and settings to compile the two examples, one can
run
and
the
other doesn't. If that is not a problem from VS2005, would that
comes
from
BSP or its SDK?
"Paul G. Tobey [eMVP]" wrote:
And a thought arises. What libraries are you linking with? Did
you
change
anything from the default generated by the VS2005 new project
wizard
to
target Smart Devices?
Paul T.
"Long" <Long@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:491D9629-7A31-4251-AA3F-DCF47D434F4A@xxxxxxxxxxxxxxxx
Thanks Paul,
Here is the code without problems.
#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>
int _tmain(int argc, _TCHAR* argv[])
{
wprintf(L"Starting...\n");
HKEY m_hKey;
int m_Index;
LPBYTE m_lpbValue; // last value read, if any
//TCHAR szValue[MAX_PATH];
DWORD ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Comm", 0,
KEY_READ,
&m_hKey);
DWORD dwValue = 1;
DWORD dwLen = sizeof(DWORD);
ret = RegQueryValueEx(m_hKey, L"BootCount", NULL, NULL,
(LPBYTE)&dwValue,
&dwLen);
ret = RegSetValueEx(m_hKey, L"Test", 0, REG_DWORD,
(LPBYTE)&dwValue,
sizeof(DWORD));
ret = RegCloseKey(m_hKey);
ret = RegFlushKey(HKEY_LOCAL_MACHINE);
Sleep(1000);
wprintf(L"Exiting...\n");
return 0;
}
Here is the code that can be compliled successfully, but not
run.
//CReg class RegHelper.h
#pragma once
/////////////////////////////////////////////////////////////////////////////
// CReg: Registry helper class
/////////////////////////////////////////////////////////////////////////////
#define MyFree(p) { if(p) LocalFree(p); }
class CReg
{
private:
HKEY m_hKey;
int m_Index;
LPBYTE m_lpbValue; // last value read, if any
public:
BOOL Create(HKEY hkRoot, LPCTSTR pszKey) {
DWORD dwDisp;
return ERROR_SUCCESS==RegCreateKeyEx(hkRoot, pszKey, 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &m_hKey,
&dwDisp);
}
BOOL Open(HKEY hkRoot, LPCTSTR pszKey, REGSAM sam=KEY_READ) {
return ERROR_SUCCESS==RegOpenKeyEx(hkRoot, pszKey, 0, sam,
&m_hKey);
}
CReg(HKEY hkRoot, LPCTSTR pszKey) {
m_hKey = NULL;
m_Index = 0;
m_lpbValue = NULL;
Open(hkRoot, pszKey);
}
CReg() {
m_hKey = NULL;
m_Index = 0;
m_lpbValue = NULL;
}
~CReg() {
if(m_hKey) RegCloseKey(m_hKey);
MyFree(m_lpbValue);
}
void Reset() {
if(m_hKey) RegCloseKey(m_hKey);
MyFree(m_lpbValue);
m_hKey = NULL;
m_Index = 0;
m_lpbValue = NULL;
}
operator HKEY() { return m_hKey; }
BOOL IsOK(void) { return m_hKey!=NULL; }
BOOL EnumKey(LPTSTR psz, DWORD dwLen) {
if(!m_hKey) return FALSE;
return ERROR_SUCCESS==RegEnumKeyEx(m_hKey, m_Index++, psz,
&dwLen,
NULL,
NULL, NULL, NULL);
}
BOOL EnumValue(LPTSTR pszName, DWORD dwLenName, LPTSTR
pszValue,
DWORD
dwLenValue) {
DWORD dwType;
if(!m_hKey) return FALSE;
dwLenValue *= sizeof(TCHAR); // convert length in chars to
bytes
return ERROR_SUCCESS==RegEnumValue(m_hKey, m_Index++, pszName,
&dwLenName,
NULL, &dwType, (LPBYTE)pszValue, &dwLenValue);
}
BOOL ValueSZ(LPCTSTR szName, LPTSTR szValue, DWORD dwLen) {
if(!m_hKey) return FALSE;
dwLen *= sizeof(TCHAR); // convert length in chars to bytes
return ERROR_SUCCESS==RegQueryValueEx(m_hKey, szName, NULL,
NULL,
(LPBYTE)szValue, &dwLen);
}
DWORD ValueBinary(LPCTSTR szName, LPBYTE lpbValue, DWORD dwLen)
{
if(!m_hKey) return FALSE;
DWORD dwLenWant = dwLen;
if(ERROR_SUCCESS==RegQueryValueEx(m_hKey, szName, NULL, NULL,
lpbValue,
&dwLen))
return dwLen;
else
return 0;
}
LPCTSTR ValueSZ(LPCTSTR szName);
LPBYTE ValueBinary(LPCTSTR szName) {
return (LPBYTE)ValueSZ(szName);
}
DWORD ValueDW(LPCTSTR szName, DWORD dwDefault=0) {
if(!m_hKey) return FALSE;
DWORD dwValue = dwDefault;
DWORD dwLen = sizeof(DWORD);
RegQueryValueEx(m_hKey, szName, NULL, NULL, (LPBYTE)&dwValue,
&dwLen);
return dwValue;
}
BOOL SetSZ(LPCTSTR szName, LPCTSTR szValue, DWORD dwLen) {
//Prefix
if(!m_hKey) return FALSE;
//
return ERROR_SUCCESS==RegSetValueEx(m_hKey, szName, 0, REG_SZ,
(LPBYTE)szValue, sizeof(TCHAR)*dwLen);
}
BOOL SetSZ(LPCTSTR szName, LPCTSTR szValue) {
return SetSZ(szName, szValue, 1+lstrlen(szValue));
}
BOOL SetDW(LPCTSTR szName, DWORD dwValue) {
//Prefix
if(!m_hKey) return FALSE;
//
return ERROR_SUCCESS==RegSetValueEx(m_hKey, szName, 0,
REG_DWORD,
(LPBYTE)&dwValue, sizeof(DWORD));
}
BOOL SetBinary(LPCTSTR szName, LPBYTE lpbValue, DWORD dwLen) {
//Prefix
if(!m_hKey) return FALSE;
//
return ERROR_SUCCESS==RegSetValueEx(m_hKey, szName, 0,
REG_BINARY,
lpbValue, dwLen);
}
BOOL SetMultiSZ(LPCTSTR szName, LPCTSTR lpszValue, DWORD dwLen)
{
return ERROR_SUCCESS==RegSetValueEx(m_hKey, szName, 0,
REG_MULTI_SZ,
(LPBYTE)lpszValue, sizeof(TCHAR)*dwLen);
}
BOOL DeleteValue(LPCTSTR szName) {
//Prefix
if(!m_hKey) return FALSE;
//
return ERROR_SUCCESS==RegDeleteValue(m_hKey, szName);
}
BOOL DeleteKey(LPCTSTR szName) {
if(!m_hKey) return FALSE;
return ERROR_SUCCESS==RegDeleteKey(m_hKey, szName);
}
};
.
- Follow-Ups:
- Re: VS2005 compatibility
- From: Paul G. Tobey [eMVP]
- Re: VS2005 compatibility
- References:
- Re: VS2005 compatibility
- From: r_z_aret
- Re: VS2005 compatibility
- From: Long
- Re: VS2005 compatibility
- From: r_z_aret
- Re: VS2005 compatibility
- From: Long
- Re: VS2005 compatibility
- From: Paul G. Tobey [eMVP]
- Re: VS2005 compatibility
- From: Long
- Re: VS2005 compatibility
- From: Paul G. Tobey [eMVP]
- Re: VS2005 compatibility
- From: Long
- Re: VS2005 compatibility
- From: Paul G. Tobey [eMVP]
- Re: VS2005 compatibility
- From: Long
- Re: VS2005 compatibility
- From: Paul G. Tobey [eMVP]
- Re: VS2005 compatibility
- From: Long
- Re: VS2005 compatibility
- From: Paul G. Tobey [eMVP]
- Re: VS2005 compatibility
- From: Paul G. Tobey [eMVP]
- Re: VS2005 compatibility
- From: Long
- Re: VS2005 compatibility
- Prev by Date: Re: VS2005 compatibility
- Next by Date: Re: GetAdaptersInfo() during ActiveSync session
- Previous by thread: Re: VS2005 compatibility
- Next by thread: Re: VS2005 compatibility
- Index(es):
Relevant Pages
|
Loading