If you use the compiler directive {$ H-} locally in the procedure, the rest of the code can not use long lines (the compiler will generate an error, such as "Incompatible type ... Got" ShortString ", expected" LongInt ").
I wasn't aware of there being an issue with using
{%H-} locally - if there is you should file a bug report. I note however you said
{$H-} instead, which is different. I don't like turning hints off for a range of code because that won't give me any hints if I might have a silly bug.
I used your code. Here's what happened:
I don't know why your project behaves differently. Mine displays the dialog similar to your
second image with or without the check box. When I click the check box it does the right thing (checked and unchecked) - see attachment. Originally I tested it with Typhon64 4.8 FPC 2.7.1 but I just recompiled my code with Lazarus32 1.0.12 FPC 2.6.2 and they work the same (properly). Since these are a version later than yours and prior to yours respectively I can only imagine you didn't copy my changes properly. For you I've attached my complete project (unfortunately I couldn't include the working EXE as that makes the attachment too big).
2. code change in function BrowseCallback not affect the call dialog
The changed code in
BrowseCallback is basically the same as yours but I just split it in 2, used 64-bit safe API calls and used
GWL_WNDPROC instead of
DWL_DLGPROC. When I used DWL_DLGPROC my dialogs didn't display properly. I must admit I didn't read the
MSDN documentation properly and the function returns the previous value, which is why your code originally worked in just one line.