Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change message WParam and LParam properties to IntPtr for x64 support #5

Closed
pziezio opened this issue Nov 21, 2018 · 1 comment
Closed
Assignees
Labels

Comments

@pziezio
Copy link
Contributor

pziezio commented Nov 21, 2018

Hello,
First, I'd like to thank you for your library. I've been using it for some time with great success.

Recently I changed all of my WinForms applications to 64-bit versions.
After that TaskDialogs stopped working.
Showing of a simple dialog still works, but you can't change any of the properties of a dialog that is already shown. Application is failing with System.OverflowException.

I tracked the problem to windows message loop procedure and message class itself.
Currently Message class has WParam and LParam properties defined as int (32bit) and that is causing problems.

Setting a new property value actually sends new windows message, so for example:
There is a Message class constructor that takes string as a parameter.
It uses Marshal runtime to get a pointer (IntPtr) to character data and it tries to assing that value to LParam - which is 32bit int. That results in an overflow exception.

It seems that the problem is easily solved by changing type of WParam and LParam properties to IntPtr - a type whose size is platform dependent, just like the underlying WPARAM and LPARAM types from WinAPI.

Please take a look at the following changes that I made:
https://github.com/pziezio/WindowsFormsAero/commit/0a4cef194d40760f58e10427e1bb8b41c5b0d854#diff-3d7d9b2fdd0df5be3ed6890538248201

I could submit a pull request for this change, but I don't have any experience with creating configuration for multi-platform NuGet packages and I don't know how a new package configuration should look.

Best regards
Piotr Zięzio

@pziezio pziezio changed the title Support for 64-bit compilation Change message WParam and LParam properties to IntPtr for x64 support Nov 21, 2018
@LorenzCK LorenzCK self-assigned this Feb 21, 2019
@LorenzCK LorenzCK added the bug label Feb 21, 2019
@LorenzCK
Copy link
Owner

Hello @pziezio,
sorry for the late reply, thank you for the heads up and for the detailed explanation: the issue should now be fixed. I included the suggested changes in this commit (which preserves the authorship of your suggestions).
I'll try to pack up the changes in a NuGet update as soon as possible.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants