Problem with FindFirstChangeNotificationW in JwaWinBase lazarus / 34-Windows ---------------------------------------------------------------------- JimC · 2018-08-01 11:17 I'm trying to write a directory monitor using FindFirstChangeNotificationW and have struck a problem I can't resolve. All the documentation states the definition as function FindFirstChangeNotificationW(lpPathName: LPCWSTR; bWatchSubtree: BOOL;  dwNotifyFilter: DWORD): HANDLE however in JwaWinBase the definition is function FindFirstChangeNotificationW(lpPathName: LPCWSTR; bWatchSubtree: Cardinal;  dwNotifyFilter: DWORD): HANDLE It may be something simple but I don't know how to use the Cardinal vice boolean for bWatchSubTree, any assistance would be appreciated.   Using Lazarus  1.8.4, FPC 3.0.4 Windows 10 1803 Build 17134.165. I know I'm re-inventing the wheel but I'm self taught and find learning via experimenting\doing suits me. Thanks JimC ---------------------------------------------------------------------- Bart · 2018-08-01 11:33 IIRC then on Windows BOOL = LongBool, which in essence is a DWORD? Bart ---------------------------------------------------------------------- engkin · 2018-08-01 15:31 Quote from: JimC on August 01, 2018, 01:17:59 pmI don't know how to use the Cardinal vice boolean for bWatchSubTree In C/C++ false is 0, which means true is any value that is *not* 0. If you want bWatchSubTree to be false, pass 0. If you want bWatchSubTree to be true, pass any number other than 0. ---------------------------------------------------------------------- ASerge · 2018-08-02 20:45 Quote from: JimC on August 01, 2018, 01:17:59 pmhowever in JwaWinBase the definition is function FindFirstChangeNotificationW(lpPathName: LPCWSTR; bWatchSubtree: Cardinal;  dwNotifyFilter: DWORD): HANDLE As far as I remember, in Windows 98, the bWatchSubtree parameter could only accept values 0 or 1, i.e. BOOL(0) or BOOL(1), i.e. it turns out that if you specify BOOL(-1), which is also True from the point of view of BOOL, then this led to an error. Therefore, was described a function where it is more difficult to make a mistake.