Documente Academic
Documente Profesional
Documente Cultură
1.Integer types
Data type Size Signed?
BYTE 8 bits Unsigned
DWORD 32 bits Unsigned
INT32 32 bits Signed
INT64 64 bits Signed
LONG 32 bits Signed
LONGLONG 64 bits Signed
UINT32 32 bits Unsigned
UINT64 64 bits Unsigned
ULONG 32 bits Unsigned
ULONGLONG 64 bits Unsigned
WORD 16 bits Unsigned
2. Boolean Type
#define FALSE 0
#define TRUE 1
int main()
{
int a = TRUE;
if (a==TRUE) {
std::cout << TRUE;
}
else {
std::cout << FALSE;
}
return 0;
}
Output: 1
3. Pointer Types
RECT* rect; // Pointer to a RECT structure.
int main() {
RECT mystruct;
mystruct.bottom = 200;
mystruct.left = 100;
mystruct.right = 100;
mystruct.top = 200;
LPRECT newstruct = &mystruct;
std::cout << "bottom: " << newstruct->bottom << '\n';
std::cout << "left: " << newstruct->left << '\n';
std::cout << "right: " << newstruct->right << '\n';
std::cout << "top: " << newstruct->top;
return 0;
}
-structura RECT este o structura care defineste lungimile unui
dreptunghi
-LPRECT, PRECT și RECT* sunt pointeri structurii RECT
4. Pointer Precision Types
DWORD_PTR
INT_PTR
LONG_PTR
ULONG_PTR
UINT_PTR
-sunt folosite mai ales cand ar trebui sa definesti un pointer
Ex:
#include <windows.h>
#include <iostream>
int main() {
LONG_PTR b=5;
LONG* a = &b;
std::cout << *a;
return 0;
}
int main() {
wchar_t abc[] = L"Hi";
std::cout << *abc;
return 0;
}
-așa declari un string cu wchar_t
-când trebuie să-i citești valoarea sau să-i pasezi valoarea la altă
variabilă/la alt pointer trebuie să-l folosești ca pointer adică să-i scri
numele iar în fața lui să-i pui o steluță(*)
Typedef Definition
CHAR char
PSTR or LPSTR char*
PCSTR or LPCSTR const char*
PWSTR or LPWSTR wchar_t*
PCWSTR or LPCWSTR const wchar_t*
#else
#endif
-în acest cod verificăm dacă UNICODE este definit, iar dacă e definim
SetWindowText ca SetWindowsW,care este versiunea cu wide
characters a funcției SetWindowText
-dar dacă UNICODE nu este definit atunci SetWindowsText va fi
definit ca SetWindowsA, care este versiunea cu caractere ANSI a
funcției SetWindowText
-endif închide condiția când se termină definirea
Obs: SetWindowsText poate avea alt nume deoarece numele lui nu
este fixat
7. TCHARs