B: This 2nd day after reading 3 chapters, it is easy to have some functions of some function calls, such as int MessageBox (hwnd hwnd, // handle @ // address of text in Message Box LPCTSTR LPCAPTION , // address uType // style of message box); HWnd HWndint A = MessageBox (HWnd, "Text", "CAPTION", MB_ABORTRETRYIGNORE) Question: The LPCTSTR type is a (LP is not a pointer) pointer, But how can I give the pointer type when I use? Did not take the address of the address? And the return is how Idabort returns INT shaping? Obviously not shaping! ! ! ? ? ?
A: In the C language development program, the general function returns a value, typically INT and DWORD. But a number is not good for the source code, so the macro definition is defined as easier to read. Idabort, IDCANCEL, IDOK are all commonly defined. You can see countless definitions in Windows.h.
B: Is it a defined macro?
A: Yes
B: What is the macro IDOK and INT potential relationship that returned? INT is plastic, is that IDOK is a convenience of understanding?
A: The return is an int value, such as IDOK is #define IDok 1
Just for the use of source level
B: Actually, they have defined a gain, we are equivalent to returning this "variable"?
A: Yes "constant"
B: Oh, I know, constant
A: Answer another question: First, we must understand that the essence of the array is a relatively low language. The array is not a class object, in fact, it is a continuous storage area in memory. The name of the array represents the starting address of the storage area. So, if we define a string array char szstring [] = "this is a string"; then, szstring is actually a pointer to a char *. So, this is legal: MessageBox (null, szstring, ...); Dead horse (15:53:01): Ok, let's further, now we omitted the step of defining szstring, it is not what you see. Yet? Messagebox (NULL, "Hello", ...); actually compiled, there is an anonymous string variable.
B: Ah, I understand
That "test" is char, that is, array.
Is there a string type in C?
A: Standard C / C is not, there is an expansion library, but since it is not a standard, once the use is relying on that library.
"TEST" is not char, it is a CHAR type array.
B: 'Test' is char [], this time is this? Haha
Is it that the parameter is the head of the LP is a pointer?
A: This is a convention, not a standard, if it is a Microsoft document code, you can think so. LP is a long Pointer, a long pointer, a historical legacy product, and now Win32 is programmed without a short pointer.
B: What is LPCTSTR?
A: LPCTSTR is LP C T Strlp: Long Pointerc: Const: Tcharstr: String
B: How did you run together?
A: LP shows that it is a pointer, which does not modify in a function, T is used as ANSI and Unicode source level (this will then study), STR indicates a string. We generally do not compile into a Unicode version, then the last definition is unfolded for const char *, is it scared?
B: Is it a character to give him a character as long as you see LPCTSTR?
Can I define LPCTSTR A; Is it?
A: When you see LPCTSTR, you can give the character array, you can of course define it yourself. Similarly, if lptstr is a string pointer that can be modified in the function, currently expanding as char *