|
Not sure you have seen this article but just in case:
Pocket PC
|
|
|
|
|
Wow! This is fantastic. Truth be told. I spoke with the company that deployed my handheld PC and they told me to use EVC++ 4.0 using the STANDARDSDK_420 platform to develop Windows CE devices (Particularyly...theirs!).
Since I already develop PPC apps with EVC++ 3.0, after installing EVC++ 4.0 on a seperate PC I had already installed the PocketPC_2003 SDK and had selected it under my platform manager thus rendering all compilations invalid even though they were written for the ARM processor. (I know..run on sentence and all.)
I have a saying for moments like this: "Slap Self!"
{{Like2Byte slaps self}}
Again, thanks.
|
|
|
|
|
PocketPC2002 doesn't appear to support the ini file api. Is there a class floating around that handles this?
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
"You won't like me when I'm angry..." - Dr. Bruce Banner
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
Use the registry perhaps?
VORegistry[^]
The kindest thing you can do for a stupid person, and for the gene pool, is to let him expire of his own dumb choices.
[Roger Wright on stupid people]
We're like private member functions
[John Theal on R&D]
|
|
|
|
|
Read my message again.
I said I need to be able to read/write INI files. Nowhere in that message did I say that using the registry was either acceptable or the desired solution. I don't ask just questions out of the fuckin' blue, so don't treat me like a brain-dead noob.
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
"You won't like me when I'm angry..." - Dr. Bruce Banner
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
John Simmons / outlaw programmer wrote:
Nowhere in that message did I say that using the registry was either acceptable or the desired solution
Neither did you say that it wasn't.
I am certainly aware that you are not a brain-dead noob.
I suggested the registry because PocketPCs don't seem to use ini files.
Can I safely assume that since you have tried WritePrivateProfileString that you have also tried WriteProfileString ?
If this isn't possible, then I'll just go away and waste someone else's time.
The kindest thing you can do for a stupid person, and for the gene pool, is to let him expire of his own dumb choices.
[Roger Wright on stupid people]
We're like private member functions
[John Theal on R&D]
|
|
|
|
|
Atlantys wrote:
I suggested the registry because PocketPCs don't seem to use ini files.
Hence my question.
Atlantys wrote:
Can I safely assume that since you have tried WritePrivateProfileString that you have also tried WriteProfileString?
WriteProfileString *only* writes to the registry in CE. I need to write to INI files on a storage card.
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
"You won't like me when I'm angry..." - Dr. Bruce Banner
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
When using eVC 3.0, whenever I ask for a new project, the IDE crashes out with a page fault. Is there a workaround for this?
|
|
|
|
|
Hi!
I am trying to use the STL with eVC4... and I have the following linking error:
error LNK2001: unresolved external symbol "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ)
Any idea anyone? Thanks!
|
|
|
|
|
If you put objects derived from CObject into a map, there is a mechanism to make sure they do not get damaged by multi-threading...
Good idea but it does not seem to work and I have not found anything anywhere...
So I tried to put this in my code :
<br />
_Lockit::_Lockit()<br />
{}<br />
_Lockit::~_Lockit()<br />
{}<br />
and it did link... not sure the whole thing is thread-safe but I'll worry about this later!
|
|
|
|
|
i am quite new to strings in c++.
i wonder if after the following function all memory is freed.
Or does anybody see any memory-leaks?
void CSTHtmlDialog::DoSomething(const CString strFilePath)
{
HANDLE hFile;
DWORD dwBytesRead;
hFile = CreateFile (strFilePath,
GENERIC_READ, // Open for reading
0, // Do not share
NULL, // No security
OPEN_EXISTING, // Existing file only
FILE_ATTRIBUTE_NORMAL, // Normal file
NULL); // No template file
DWORD dwFileLength = GetFileSize(hFile, NULL)
char* pBuffer = new char[dwFileLength];
if (ReadFile (hFile, pBuffer, dwFileLength, &dwBytesRead, NULL))
{
pBuffer[dwFileLength - 1] = '\0';
SetString(pBuffer);//calls this function:
//void SetString(const CString &strHtml){...}
}
CloseHandle (hFile);
delete[] pBuffer;
pBuffer = 0;
return;
}
thx, Daniel
|
|
|
|
|
If you're doing this on a PocketPC device, then you can't use char , you have to use wchar_t (or even TCHAR ), because PocketPC devices all use UNICODE.
If you're already using MFC, why not just use CFile and CString to read the file in? That way you don't have to worry about new memory leaks.
The kindest thing you can do for a stupid person, and for the gene pool, is to let him expire of his own dumb choices.
[Roger Wright on stupid people]
We're like private member functions
[John Theal on R&D]
|
|
|
|
|
Why use a char*/wchar_t* at all?
I'd do it this way (error handling removed):
std::vector< char > data;
HANDLE h = CreateFile(filename , GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
DWORD fs = GetFileSize(h, 0);
data.resize(fs / sizeof(char) );
DWORD read = 0;
ReadFile(h, data.begin(), fs, &read, 0);
CloseHandle(h);
ASSERT(read == fs);
data.push_back(0);
slomoman wrote:
does anybody see any memory-leaks?
I see no memoryleaks in the code you posted.
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|
my reason to use chars was that ReadFile seems to need a char* parameter.
the suggestion using vector<char> sounds good, but i am not sure how to use it in the functions that handle the file's input:
//first I pass the buffer to this function:
setString(pBuffer);
//and this functions uses it to send a message like this:
void SetString(const CString &strHtml){
::SendMessage(m_hwndHtml, DTM_ADDTEXTW, FALSE, (LPARAM)(LPCTSTR)strHtml);
}
Probably, my code is quite chaotic and I should rewrite both functions.but i'm not sure how to do it with wchar_t or vector<char>
??
thx, Daniel
|
|
|
|
|
slomoman wrote:
my reason to use chars was that ReadFile seems to need a char* parameter
Nod, I understand. Im just trying to show a way to do it without dynamic memory allocations, which is (IMHO) good to avoid whenever possible.
slomoman wrote:
the suggestion using vector sounds good, but i am not sure how to use it in the functions that handle the file's input:
You can substitue the std::vector with a std::string or a std::wstring (possibly even a CString with GetBufferSetLength/ReleaseBuffer) depending on the format of your infile. Then, all you'd need to do is call SetString(str.c_str())
Now, back to your problem.
If the file you're reading contains ASCII characters, you will need to convert them to unicode characters to able to show them in the GUI. All GUI components in WinCE uses unicode strings.
Here's an example using the USES_CONVERSION macro. (Look it up in MSDN).
Its pretty usefull sometimes, but can also cause problems.
if (ReadFile (hFile, pBuffer, dwFileLength, &dwBytesRead, NULL))
{
pBuffer[dwFileLength - 1] = '\0';
USES_CONVERSION;
SetString(A2W(pBuffer));
}
Another way to convert the ASCII characters to unicode is to use the function that the macro A2W uses, MultiByteToWideChar , but that requires some extra work.
Here's an example of how to use that:
bool a2w(std::wstring& w, const std::string& a)
{
w.resize(a.length());
w[0] = L'\0';
if ( MultiByteToWideChar(CP_ACP, 0, a.begin(), -1, w.begin(), a.length()) == 0)
return false;
return true;
}
If the file you are reading is in UNICODE, you're better of reading into a wchar_t array/std::wstring/std::vector<wchar_t>.
Here's a way to do that, using your old code (untested):
void CSTHtmlDialog::DoSomething(const CString strFilePath)
{
HANDLE hFile;
DWORD dwBytesRead;
hFile = CreateFile (strFilePath,
GENERIC_READ,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
DWORD dwFileLength = GetFileSize(hFile, NULL)
wchar_t* pBuffer = new char[dwFileLength/sizeof(wchar_t)];
if (ReadFile (hFile, reinterpret_cast<char*>(pBuffer), dwFileLength, &dwBytesRead, NULL))
{
pBuffer[dwFileLength - 1] = L'\0';
SetString(pBuffer);
}
CloseHandle (hFile);
delete[] pBuffer;
pBuffer = 0;
return;
}
or you could try to cast your char* to a wchar_t* when you pass it to SetString, but that might give you alignment problems
HTH
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|
2 errors in my wchar_t verison of your code.
Jonas Larsson wrote:
wchar_t* pBuffer = new char[dwFileLength/sizeof(wchar_t)];
wchar_t* pBuffer = new wchar_t[dwFileLength/sizeof(wchar_t)];
Jonas Larsson wrote:
pBuffer[dwFileLength - 1] = L'\0';
pBuffer[(dwFileLength/sizeof(wchar_t)) - 1] = L'\0';
Sorry about that.
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|
Hey João (since I know you'll be the first to answer this (and answer it correctly too ))
Is it possible to detect when the user has pushed the power-off button and do perform some actions (like pausing an MP3 or saving data) before the device is turned off? The device does most of this itself, but in the case of the MP3, there are some..."issues" that I think I can fix, if I just knew when the device was going off.
I have some nifty CE_USER_NOTIFICATION-based functionality to determine when the device is turned back on, but there is no notification flag for power off (NOTIFICATION_EVENT_WAKEUP is for power on).
Thanks in advance.
The kindest thing you can do for a stupid person, and for the gene pool, is to let him expire of his own dumb choices.
[Roger Wright on stupid people]
We're like private member functions
[John Theal on R&D]
|
|
|
|
|
Hi!
I think that the correct answer is that there is no way to do it. Take my answer with a grain of salt because I'm not sure about this. I thought about intercepting the power button, but this will leave out the power off timer. I tried using Spy to check if the system does send a message to the top-level active window (or desktop), but got nothing.
If I come up with a better answer, I'll post it here.
Regards,
João Paulo
|
|
|
|
|
Well, that sucks, but thanks anyways.
The ideas I had were trying to handle VK_OFF in a OnKeyDown or similar. Or hoping that a WM_POWERBROADCAST-type message is sent.
When I was playing around, it didn't seem like either of this methods worked, but when it comes to CE, I'm never sure.
The kindest thing you can do for a stupid person, and for the gene pool, is to let him expire of his own dumb choices.
[Roger Wright on stupid people]
We're like private member functions
[John Theal on R&D]
|
|
|
|
|
Hello All,
How to get the redirected URL or Curent URL from the HTML Viwer/Container ?
Suggestions are most welcome!!!
Thanks & Regards
AKS
//------------------------------------------//
Note: FYI : Sample Code
//------------------------------------------//
void CSTHtmlDialog::CreateHtmlWindow()
{
if (m_HtmlViewInstance == 0) {
m_HtmlViewInstance = ::LoadLibrary(L"htmlview.dll");
}
VERIFY(InitHTMLControl(AfxGetInstanceHandle()));
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS;
RECT rect;
GetClientRect(&rect);
m_hwndHtml = ::CreateWindow (DISPLAYCLASS,
NULL,
dwStyle,
rect.left,
rect.top,
rect.right,
rect.bottom,
m_hWnd,
0,
m_HtmlViewInstance,
NULL);
CString url = "http://www.vision.com";
BSTR bstrURL = SysAllocString(url);
::SendMessage(m_hwndHtml, DTM_NAVIGATE, 0, (LPARAM)bstrURL);
SysFreeString(bstrURL);
}
|
|
|
|
|
Handle the NM_NAVIGATECOMPLETE notification and check if the pnmHTMLView->szTarget contains the URL you want (check help for more info).
Regards,
João Paulo
|
|
|
|
|
i want to re-use my dialog-resource that i created in evc3 in another evc3-project.
is there any way i can do that? export and import only seems to work for icons...
thx, Daniel
|
|
|
|
|
|
i tried to open some images in my app, but they don't like the way they should. I opened them with pocketIE, but they still look the same. (this all happened on the emulator, because my ipaq is broken, but i think it will be the same on the device)
i think it is because pocketIE tries to resize them but this doesn't work.
it is a grey and white jpg sized 393 x 202 Pixels. PocketIE kind of shrinks it to square-size and then duplicates the image. very strange. what can i do?
thx, Daniel
|
|
|
|
|
I am trying to close a MFC-EVC++-Application from a modeless Dialog that was created as a child window of the MainFrame. I tried it with:
::SendMessage(this->GetParent()->m_hWnd, WM_CLOSE, 0, 0);
but this does not exactly do what I want.
Most of the time, it closes all open windows (i.e. the modeless dialog and the MainFrame), but the Aplication with the modeless dialog still remains in the "running programs"-list (settings->memory).
In some occasions however, it completely closes the application.
I think, something is not working correctly in my code....
thx, Daniel
|
|
|
|
|