GetDlgItemText(hWnd, IDC_FILENAME, szBitmapFilename, sizeof(szBitmapFilename)/sizeof(TCHAR));
I don't know what the last parameters means. (sizeof(szBitmapFilename)/sizeof(TCHAR))
what will be return after that operation ? (sizeof(szBitmapFilename)/sizeof(TCHAR))
I always meet this but I dont know understand.
All it is is the size fo the filename,
sizeof(szBitmapFilename) //length of filename in bytes
sizeof(TCHAR) //length of individual Letter
therefore when you divide the two you get the size of the filename in letters (TCHARs)
TCHAR is a typedef for "char" that is a standard under normal conditions, but if you compile for a Unicode platform it changes to WCHAR - wide char
A char is a single byte, but a WCHAR is 2 bytes......
Therefore.....a 10 charactor array for ASCII (ignoring the terminating NULL) is 10 bytes....but under unicode it will be 20 bytes...
Its just a safe way to write code so it can be compiled easily for different platforms.......
Actually dividing an array by the size of a single element is a very unsafe way of finding the text length. It works only for texts that were entered at compile time into an array that has the same size as the text. It seems to be used frequently, but you should use strlen, or for the T-type datatypes _tstrlen.