Monday, February 24, 2003

Today I'm working on a native app to run on a Pocket PC device. This means using the eVC3 dev environment, the Pocket PC SDK, and doing something called "windows programming." Now, I thought I was doing windows programming all along, but it turns out I was wrong. All that stuff I was doing (TextBox1.Text etc) just sits on top of windows with probably more levels than I need to know.

So, windows programming. I have a resorce from "the forger" (www.winprog.org) that gives the following code as its hello world:

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
{
    MessageBox(NULL, "Goodbye, cruel world!", "Note", MB_OK);
    return 0;
}

In order to get it to work, I had to do two things: 1) Change LPSTR to LPWSTR, who knows why, just parroting the examples from the dev environment's hello world. 2) Change the string handling of the message box to use _T. This is a magic thing that makes it compile. It has something to do with unicode. So my code, which compiles, looks like this:

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{

 TCHAR *pszString;
 pszString = _T("Goodbye");

    MessageBox(NULL, pszString, TEXT("OK"), MB_OK);
    return 0;
}

Now on to bigger and better things. Is it an exercise to go through the tutorial and then come up with a new version for my dev environment, or will it be an exercise in frustration? It's worth at least half a day to find out.


comment []10:08:27 AM