From: Joseph M. Newcomer on
See below...
On Wed, 24 Feb 2010 18:00:16 -0500, "RB" <NoMail(a)NoSpam> wrote:

>> tchar.h has these automatic, that is, if you want to check a character for alphabetic,
>> you would call _istalpha(...)
>> which will work if the build is either Unicode or 8-bit, whereas
>> isalpha(...)
>> works correctly only if the character is 8-bit, and
>> iswalpha(...)
>> works correctly only if the character is Unicode (but if you call setlocale correctly,
>> will handle alphabetic characters in other languages.
>
>Ok this sounds good, some of the work can be done for me if I learn enough.
>Before I was individually writing separate code sections called from alternating
>areas in my code like:
>#ifdef UNICODE
> iswalpha(...)
>#ifndef UNICODE
> isalpha(...)
>and the all the code I wrote in each depending section upon returns was getting
>to be too much for me. But from what you are saying it would appear if I
>educate myself some more on Text Routine Mappings of the TCHAR type,
>I could just call the _istalpha(...) [ which on my system maps to _ismbcalpha(...) ]
>and then only write the "one and only" return code routine. This sounds very good.
>Heck yes it does.
****
Yes, this is what the tchar.h file. Go read it, you will see that you didn't need to do
all those conditionals; they are done for you.
****
>
> So if I code all my character Variables in TCHAR a lot of my mapping will be
>done for me depending on whether the UNICODE is defined or not.
>
> And for string literals does it matter if I use TEXT, _TEXT, or _T ?
>Some bibliographies say for C++ I should be using TEXT
>while others say I can use either _TEXT or _T either one seems to expand to the
>same result.
****
TEXT, _TEXT and _T are all the same. _T takes fewer characters to type and is less
intrusive in the code. So I use it.
****
>
> And does it matter where I define (or not define) UNICODE in my source files ?
****
You would not define it in your source files. You would set the properties of your
project to contain the preprocessor symbols UNICODE and _UNICODE. Go look at the
properties, C/C++, Preprocessor and add the symbols. This way, you can have different
configurations that build either Unicode or 8-bit apps from the same sources. It would be
inappropriate to define it in the source file.
****
>
>> both 8-bit and Unicode as determined on-the-fly during runtime. It is trivial
>> in VS > 6 because you can read the data in as 8-bit, immediately convert it to
>> Unicode, and continue on, not having to do anything special except use CStringA
>> for the 8-bit input)
>
>Yea I am going to have to talk my wife into the cost of a new VS it would appear.
>I don't think I qualify for the upgrade pricing since I bought my first one under
>Academic discount pricing as a student in college (taking courses at night).
****
Also, check out resellers. Since 2010 is coming out, there are people unloading their
2008 inventories.
****
>
>> If you expect to get through your entire career never writing code for anyone other
>> than yourself, it won't matter. But if you write anything that goes out the door,
>> you should probably expect that Unicode support will be required. Even simple
>> things like people's surnames in another language can be an issue, For example,
>> suppose you want to get the correct spelling of the composer Antonin Dvorak.
>> The "r" has a little accent mark over it, and you can only represent that in Unicode.
>
>Yea that is a good premise example. Sounds like he might be Swedish
****
Czech.

I actually worked for several years on such a project in the late 1980s, before Unicode. I
just think of how cool it would be today to have reproduced the names of the Japanese and
Chinese authors in the original characters. Which is what they wanted to do. I was the
technical guru behind the "Recent Publications in Natural History" publication done by the
American Museum of Natural History (my payment was a free subscription to Natural History
Magazine). But we could give the names of the Czech, Slovak, Lituanian, Roumanian, and
other European authors with near-Roman alphabets. Couldn't handle Greek, Cyrillic, or
Pacific Rim languages. Today we could, but the editor is now retired.
*****
>
>> When VS2005 came along and by default created Unicode apps, I never noticed.
>> I kept programming in exactly the same way I had been programming for a decade.
>
>I have an option to buy a VS pro 2005 at a good price but I heard that 2005 did
>not have a class wizard etc, what is your input on that?
****
VS.NET > 6 and < 2010 had a poor imitation of the ClassWizard. Usable, mostly, but
inconveninet. But if you get VS pro 2005 at a good price, it may be the right choice for
you. Just be aware that you won't be able to use the Feature Pack, Ribbon Bar, and other
interesting new features. I used 2005 for many years and still have clients for whom I
must do 2005-based (even 2003-based) development. It isn't bad, if the price is right. I
don't know what your budget is, so I'm not really qualified to urge you to break the bank.
joe

****
>
>> It's 2010. As far as writing code, 8-bit characters are almost completely dead.
>> Note that many *files* are still kept in Unicode, but that's not the same as
>> programming, because you can always use an 8-bit encoding like UTF-8 to keep your
>> text in 8-bit files.
>
>Yes I am aware of the different prefixed codes for files
>
>> But you should always "think Unicode" inside a program. It's worth the time.
>
>Ok I will start trying immediately. Thanks again. (for everything)
> Later.........RB
>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: RB on
Joe thanks so much for everything, I wish you lived near I would buy you a case
of whatever beer you like. Actually that would not be enough payment for the
amount of help you have given me. I have one more question on the strsafe.lib .
I have gone thru the first 5 cab files of the 2003 SDK and found & extracted both
the library and the header files. But the lib file has this strange extension on the
name. I tried viewing it with a lib viewer that works on VS ver 6.x files but
it cannot see inside the lib ? I am wondering what is the deal with it or if I
should rename it etc ? I wanted to be able to view the inside of the lib just
to check names with the header file. This is the name.
strsafe_lib.B266796E_C6D3_11D2_9CB0_00C04FA36BAA


From: Joseph M. Newcomer on
Thanks for the offer, but I do this because it is what I do: teach.

(Besides, I don't touch alcohol. It triggers severe migraine headaches. Just one was
enough to convince me that I never wanted to chance it again. That was 35 years ago...)

The issue with cab files is that they are typically processed by something that handles
them. Years ago the extracted .cab contents had to be expanded using the MS-DOS 'expand'
program. So what you see there is a GUID that identifies the unique version; what that
means to the installer, I have no idea. I'd be inclined to install the SDK and copy the
files rather than just extract them from the raw .cab file. That's what I did to copy the
version to VS6.
joe
On Wed, 24 Feb 2010 23:11:59 -0500, "RB" <NoMail(a)NoSpam> wrote:

>Joe thanks so much for everything, I wish you lived near I would buy you a case
>of whatever beer you like. Actually that would not be enough payment for the
>amount of help you have given me. I have one more question on the strsafe.lib .
>I have gone thru the first 5 cab files of the 2003 SDK and found & extracted both
>the library and the header files. But the lib file has this strange extension on the
>name. I tried viewing it with a lib viewer that works on VS ver 6.x files but
>it cannot see inside the lib ? I am wondering what is the deal with it or if I
>should rename it etc ? I wanted to be able to view the inside of the lib just
>to check names with the header file. This is the name.
>strsafe_lib.B266796E_C6D3_11D2_9CB0_00C04FA36BAA
>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Mihai N. on

> And for string literals does it matter if I use TEXT, _TEXT, or _T ?
> Some bibliographies say for C++ I should be using TEXT
> while others say I can use either _TEXT or _T either one seems to expand
> to the same result.

UNICODE affectw Win32 API and TEXT
_UNICODE the C runtime (CRT), _TEXT and _T

Since you will always want to define UNICODE and _UNICODE
(asking for trouble otherwise), it does not really matter if
you use TEXT, _TEXT or _T.

I tend to prefer _T (shorer to type).

But GUI applications often include just "windows.h" and few Win SDK
headers, so _T (and _TEXT) are not defined (you need "tchar.h" for that).
So if I am not the owner of the code, and don't want to add new header
files to reduce unexpected side-effects, I go with TEXT.
Although if the application uses a lot of CRT strings operations
(like strcat, sprintf, & Co.) then tchar.h becomes mandatory.


--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

From: RB on
> Thanks for the offer, but I do this because it is what I do: teach.

Well you are one the best at it I have seen in my time.

> (Besides, I don't touch alcohol. It triggers severe migraine headaches. Just one was
> enough to convince me that I never wanted to chance it again. That was 35 years ago...)

Oh ok, some people don't set well with it. I enjoy 2 or 3 while grilling. It also helps relax
the tension I have from a broken neck injury yeas ago. I was lucky, no permanet paralysis
but some arthritis settled into the injury.

> I'd be inclined to install the SDK and copy the files rather than just extract them from the
> raw .cab file. That's what I did to copy the version to VS6.

Ok, I was kind of leary of installing it for fear it might find my VS 6.x folders and overwrite
them. But I guess it gives me an install location option ? I guess worse case scenario I
could do an image backup first and then install the SDK.