http://bugs.winehq.org/show_bug.cgi?id=4253
Summary: Bad behaviour with hook functions in file dialog Product: Wine Version: 20050725 Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wine-binary AssignedTo: wine-bugs@winehq.org ReportedBy: lurch@gmx.li
If an hook function has been installed for the "OK" button, wine shows the following behaviour:
1. It sends a WM_NOTIFY message with CDN_FILEOK 2. The hook function gets executed 3. The hook function sets either a zero or nonzero DWL_MSGRESULT via SetWindowLong 4. The hook function returns with either an zero or nonzero value
Unfortunately, wines behaviour with respect to the two return values differs from Windows behaviour. Wine ignores the normal return value of the hook procedure and only checks for the DWL_MSGRESULT.
I have found at least one application (Ragtime Solo, http://appdb.winehq.org/appview.php?versionId=2637 ) which shows wrong behaviour cause of that. According to the application developers, they use a nonzero DWL_MSGRESULT to hinder Windows from sending an FILEOKSTRING message ("These WM_NOTIFY messages supersede the FILEOKSTRING, LBSELCHSTRING, SHAREVISTRING, and HELPMSGSTRING registered messages used by previous versions of the Open and Save As dialog boxes. However, the hook procedure also receives the superseded message after the WM_NOTIFY message if the WM_NOTIFY processing does not use SetWindowLong to set a nonzero DWL_MSGRESULT value." [1]).
In [2], MSDN states for the hook procedure: "Return Value If the hook procedure returns zero, the dialog box accepts the specified file name and closes. To reject the specified file name and force the dialog box to remain open, return a nonzero value from the hook procedure and call the SetWindowLong function to set a nonzero DWL_MSGRESULT value."
So IMHO wine should take the DWL_MSGRESULT in account _only_, if the return value is nonzero.
[1] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui... [2] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui...