Re: Program entry point question!



On Sun, 11 Sep 2005 21:01:05 -0700, "Robby"
<Robby@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

>Hi I am trying my first VC++ program in VS7 and it works fine. However I have
>copied it to a new project in Embeded VCE and had to slightly modify the
>create window function, but thats OKAY.
>
>However what I don't understand is in the entry point function below:
>
>int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
> LPWSTR szCmdLine, int iCmdShow)
>
>I had to change the szCmdLine type from
>
>PSTR szCmdLine
>
>which was the way I had it for VC++
>
>to
>
>LPWSTR szCmdLine
>
>Why is Windows desktop type different from CE's type?

As Steve Maillet mentioned, Windows CE is heavily biased towards
UNICODE. He recommended switching completely to WCHAR, LPWSTR, etc.
and by always building for UNICODE. If you have no need to support
Windows 9x (95, 98, ME), this is a reasonable choice. Or you could
switch to TCHAR, LPTSTR, etc., which switch from char to WCHAR when
UNICODE is defined. But be _very_ careful about converting half way;
the compiler will catch almost, but not quite all, incompatibilities,
and run-time errors can be painful. I _strongly_ recommend taking some
time to learn about UNICODE. Using google to look up
UNICODE
in this newsgroup would be a good start. If you choose to use TCHAR
etc. (my preference), I strongly recommend reading the tchar.h header;
it is not meant for human readers (I sure needed several tries), but
defines TCHAR and is thus the authority.


>
>Any information is greatly appreciated!

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com
.



Relevant Pages

  • Re: Converting MBCS project to UNICODE compliant.. Pros and Cons
    ... using TCHAR or _T will only help to save code modification time when you ... My concern was should switch all ... Should i keep this in ASCII form or converting it to Unicode string wont eat ... use TCHAR compatible functions or WCHAR? ...
    (microsoft.public.vc.language)
  • Re: Window types
    ... typedef WCHAR TCHAR, * PTCHAR; ... typedef char TCHAR, * PTCHAR; ... Under a Unicode build, ... If the only text your app needs to deal with can be handled with ASCII ...
    (microsoft.public.vc.language)
  • Re: TCHAR and buffer overflows
    ... > This would be a problem if you hadn't defined UNICODE in your build. ... > Check your factory headers for TCHAR defs and such, ... checked whether the MSVCRT memcpyimplementation actually detects overlapping ... Or good tools, lousy user, lousy work. ...
    (comp.security.misc)
  • Re: TCHAR and buffer overflows
    ... > This would be a problem if you hadn't defined UNICODE in your build. ... > Check your factory headers for TCHAR defs and such, ... checked whether the MSVCRT memcpyimplementation actually detects overlapping ... Or good tools, lousy user, lousy work. ...
    (comp.os.ms-windows.nt.admin.security)
  • Re: VC2005 Pro: IDE (Compiler ?) cant find Stdafx.h
    ... For new code I would obviously use UNICODE but for existing stuff ... > Use Multi-Byte Character Set ... > If you use TCHAR etc., and want your code to run on another platform, then ... > typedef char TCHAR; ...
    (microsoft.public.vc.language)