Date: 02-16-2022
Return to Index
created by gbSnippets
'--------------------------------------------------------------
MSDN:
http://msdn.microsoft.com/en-us/library/windows/desktop/hh298428%28v=vs.85%29.aspx
For versions 5.80 and later of comctl32.dll, common controls notifications support
both ANSI and Unicode formats on Windows 95 systems or later. The system determines
which format to use by sending your window a WM_NOTIFYFORMAT message. To specify a
format, return NFR_ANSI for ANSI notifications or NFR_UNICODE for Unicode notifications.
If you do not handle this message, the system calls IsWindowUnicode to determine the format.
Since Windows 95 and Windows 98 always return FALSE to this function call, they use ANSI
notifications by default.
'--------------------------------------------------------------
Both are declared:
DECLARE FUNCTION FindFirstFileA LIB "Kernel32.dll" ALIAS "FindFirstFileA" (lpFileName AS ASCIIZ, lpFindFileData AS WIN32_FIND_DATAA) AS DWORD
DECLARE FUNCTION FindFirstFileW LIB "Kernel32.dll" ALIAS "FindFirstFileW" (lpFileName AS WSTRINGZ, lpFindFileData AS WIN32_FIND_DATAW) AS DWORD
%Unicode determines which declaration to use for FindFirstFile
#IF %DEF(%UNICODE)
DECLARE FUNCTION FindFirstFile LIB "Kernel32.dll" ALIAS "FindFirstFileW"(lpFileName AS WSTRINGZ, lpFindFileData AS WIN32_FIND_DATAW) AS DWORD
#ELSE
DECLARE FUNCTION FindFirstFile LIB "Kernel32.dll" ALIAS "FindFirstFileA"(lpFileName AS ASCIIZ, lpFindFileData AS WIN32_FIND_DATAA) AS DWORD
#ENDIF
Does not apply to API which have no string arguments.
TYPE DirData
FileAttributes AS DWORD
CreationTime AS QUAD
LastAccessTime AS QUAD
LastWriteTime AS QUAD
FileSizeHigh AS DWORD
FileSizeLow AS DWORD
Reserved0 AS DWORD
Reserved1 AS DWORD
FileName AS WStringZ * 260
ShortName AS WStringZ * 14
END TYPE
WIN32_FIND_DATA
TYPE WIN32_FIND_DATAA
dwFileAttributes AS DWORD
ftCreationTime AS FILETIME
ftLastAccessTime AS FILETIME
ftLastWriteTime AS FILETIME
nFileSizeHigh AS DWORD
nFileSizeLow AS DWORD
dwReserved0 AS DWORD
dwReserved1 AS DWORD
cFileName AS ASCIIZ * %MAX_PATH
cAlternateFileName AS ASCIIZ * 14
END TYPE
TYPE WIN32_FIND_DATAW
dwFileAttributes AS DWORD
ftCreationTime AS FILETIME
ftLastAccessTime AS FILETIME
ftLastWriteTime AS FILETIME
nFileSizeHigh AS DWORD
nFileSizeLow AS DWORD
dwReserved0 AS DWORD
dwReserved1 AS DWORD
cFileName AS WSTRINGZ * %MAX_PATH
cAlternateFileName AS WSTRINGZ * 14
END TYPE
#IF %DEF(%UNICODE)
TYPE WIN32_FIND_DATA
WIN32_FIND_DATAW
END TYPE
#ELSE
TYPE WIN32_FIND_DATA
WIN32_FIND_DATAA
END TYPE
#ENDIF ' UNICODE
#Include "win32api.inc"
Function PBMain() As Long
Local i As Long
Local x As Win32_Find_DataA
Local y As Win32_Find_DataW
? Str$(SizeOf(x)) '<--- 381
? Str$(SizeOf(y)) '<--- 592
End Function
#Include "win32api.inc"
Function PBMain() As Long
Local i As Long
Local x As Win32_Find_DataA
Local y As Win32_Find_DataW
Local z As Win32_Find_Data
? Str$(SizeOf(x)) '<--- 318
? Str$(SizeOf(y)) '<--- 592
? Str$(SizeOf(z)) '<--- 318 because %Unicode is not defined
End Function
'gbs_01154
'Date: 03-14-2012
http://www.garybeene.com/sw/gbsnippets.htm