szAppName

Pages: 123
bits are the smallest thinkable information entities, which means binary digits (0 or 1) in this case (binary digit).

With using just 8 bits, you could define 256 different characters at most
( 0000 0000 (decimal value: 0) would be the lowest number,
1111 1111 (decimal value: 255) would be the highest number, so you would have the numbers from 0-255 available) -
that's obviously not enough to hold all characters human use (in fact, in many languages it wouldn't even be enough to hold just the characters of that one language), that's why Unicode (and a number of other things) were invented to do just that.

UTF-8 and UTF-16 are Unicode encodings that use 8/16 bit units to encode Unicode characters, if you want to know how that's done then please visit the wikipedia entries and the many articles in the web that have been written about this topic already before asking further questions.
Ohhhhh, and with a 16bit character the highest binary digits would be 1111 1111 1111 1111 and the lowest would be 0000 0000 0000 0000.

Right? Thanks very much for the help.
Last edited on
So does the keyword static make a function/variable not callable outside the file it is defined in, which means that if i #included it into another file i would not be able to use the static functions/variables.

The use of file static declarations to limit variables and functions to file scope is deprecated in C++. The preferred method is to use unnamed namespaces.

1
2
3
4
5
6
7
namespace
{
   int k;
   .
   .
   .
}


Entities declared within the namespace are visible only withing the file containing the namespace.
Thanks :) was i right though with what i previously said?
Yes, deprecated, but it still works - sort of. He was only asking what it does in this context, and as the Win32 API is a C API it's obviously the C meaning he should know.
:D
For static TCHAR ClsName[] = TEXT("Skeleton");

I could just put...

static TCHAR ClsName[] = "Skeleton";

...and it still works and compiles, so what is the purpose of putting TEXT(), how does it benefit me?
Oreilly... we already explained that 2 pages earlier... it marks the string as a wide string if UNICODE is defined, and does nothing if UNICODE is not defined. Alright, I'll tell you once more, if you have any more questions please just try to use google / the search option before you ask:

These macros/typedefs are just there so you don't have to worry about whether you are working with chars or wchar_t 's here, consider the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

void makeMessageBoxWithChar()
{
     char* ctext = "Output";
     char* ccaption = "Caption";
     MessageBoxA(NULL,
                            ctext, ccaption,
                            MB_OK);
     return;
}

void makeMessageBoxWithWChar()
{
     wchar_t* wtext = L"Output";
     wchar_t* wcaption = L"Caption";
     MessageBoxW(NULL,
                            wtext, wcaption,
                            MB_OK);
     return;
}

void makeMessageBox()
{
     LPTSTR text = TEXT("Output");
     LPTSTR caption = TEXT("Caption");
     MessageBox(NULL,
                          text, caption,
                          MB_OK);
    return;
}


Here, depending on whether UNICODE is defined or not, makeMessageBox will either behave like makeMessageBoxWithChar or makeMessageBoxWithWChar.
Ok, I understand what you saying. I have looked on the internet for an answer to my next question but havnt found help.

From this...

static TCHAR ClsName[] = TEXT("Skeleton");

What if i DID #define UNICODE but put this instead:

static TCHAR ClsName[] = "Skeleton";

Would the string be a wide string or an ordinary string?
It would be an error. You can't assign a normal string to a wide string.
Thanks, i understand now.
Topic archived. No new replies allowed.
Pages: 123