Skip to content

Fix: MESSAGEBOX() timeout issue and implement dynamic parameter handling#1897

Merged
RobertvanderHulst merged 2 commits into
devfrom
feature/vfp-messagebox-timeout
Apr 5, 2026
Merged

Fix: MESSAGEBOX() timeout issue and implement dynamic parameter handling#1897
RobertvanderHulst merged 2 commits into
devfrom
feature/vfp-messagebox-timeout

Conversation

@Irwin1985
Copy link
Copy Markdown
Contributor

This PR addresses the issue where the nTimeOut parameter in MESSAGEBOX() failed to close the dialog reliably (failing 9 out of 10 times).

Changes made

  • Native Win32 API: Replaced the FindWindow approach with the native MessageBoxTimeoutW for atomic and reliable timeouts.
  • Smart Parameters: Updated the MessageBox signature to accept USUAL types. This fully supports VFP's dynamic parameter ordering (ej: allowing MESSAGEBOX("Msg", "Title", 64) or MESSAGEBOX("Msg", 64, "Title")).
  • Timeout Fallback: Added a Stopwatch safety check in VfpUIProvider.prg. If modern Windows versions return a default button ID instead of 32000 upon timeout, the Stopwatch ensures -1 is strictly returned to match VFP specs.

Testing

  • All tests was made on XIDE in a separate environment.
  • Verified timeout functionality returns -1 consistently.

@RobertvanderHulst
Copy link
Copy Markdown
Member

Does this mean that you're no longer using AutoCloseMessagebox?
In that case, please remove that code, or mark it with the [Obsolete] attribute.

@Irwin1985
Copy link
Copy Markdown
Contributor Author

Hi Robert,

Yes, we (XSharp.VFP) won't need it anymore. I'll mark it as Obsolete because I'm not sure if it will be neccesary or required by someone else in the future.

@RobertvanderHulst RobertvanderHulst merged commit 4c899c1 into dev Apr 5, 2026
RobertvanderHulst added a commit that referenced this pull request Apr 6, 2026
* Update CI workflow to use latest action versions

* Upgrade upload-artifact action to version 6

* Update GitHub Actions clean workflow to version 7 (#1899)

* Fix #1857: Refined SET('DEFAULT') / SET('DIRECTORY') (#1892)

* [Compiler tests] Marked fixed tests

* [Runtime tests] Adjusted SetDefault tests

* [Compiler tests] Added C959 for #836

* [Compiler tests] Added C960 and C961 for #1286

* Fix: FCHSIZE and VFP compatible BINTOC() / CTOBIN() (#1893)

* Fix: FCHSIZE and VFP compatible BINTOC() / CTOBIN()

* Moved BINTOC, CTOBIN to StringFunctions.prg

* [Vsintegration] Fix issue #1802. This was caused by our project system responding wit "true" to the Project Dependency "PackageReferences".
I have also moved Logging and Most Event handlers for VS events to a new solution "Support". Both the project system and Language service call the initialization code in this Support DLL to make sure that this is loaded as early as possible.
Also fixed an issue in the IDE BuildLogger and updated a few nuget packages

* [Compiler tests] Added C962 for #1490 and #1491

* [Compiler tests] Added C963 for #1836

* [Compiler tests] Added C964 for #1860

* Fix: Sysmetric, SET MEMOWIDTH typo and SET DEFAULT / DIRECTORY issues at startup (#1894)

* [Runtime] Late bound code should give precedence to NEW method. Fixes #1286

* [Runtime] Late bound code should give precedence to NEW method. Fixes #1286

* [Tests] Fix error in test code.

* Fix: Convert MemoHelpers.MAX_WIDTH to dynamic property (#1895)

* GET* UI Dialogs implementation (GETDIR, GETFILE, GETPICT) (#1896)

* Fix: MESSAGEBOX() timeout issue and implement dynamic parameter handling (#1897)

* Fix: MESSAGEBOX() timeout issue and implement dynamic parameter handling

* Marked as Obsolete the AutoCloseMessageBox class

* Update GitHub Actions clean workflow to version 7 (#1898)

* Update CI workflow to use latest action versions

* Upgrade upload-artifact action to version 6

* Update GitHub Actions clean workflow to version 7

---------

Co-authored-by: Irwin <rodriguez.irwin@gmail.com>
Co-authored-by: cpyrgas <chris@xsharp.eu>
@RobertvanderHulst RobertvanderHulst deleted the feature/vfp-messagebox-timeout branch April 7, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants