mycopy / vcl-styles-utils

Automatically exported from code.google.com/p/vcl-styles-utils
0 stars 0 forks source link

Range check error in TSysPopupStyleHook.GetMenuFromHandle on Win64 #111

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add Vcl.Styles.Utils.Menus to a project.
2. Add a main menu to the project.
3. Compile for Win64.
4. Run the program.
5. Click on a menu item in the main menu.

What is the expected output? What do you see instead?
The menu item should open without errors.
Instead: Range check error in Vcl.Styles.Utils.Menus, line 774.

This cannot be reproduced consistently as it depends on the handle value 
returned by the MN_GETHMENU message.

What version of the product are you using? On what operating system?
Vcl Styles Utils revision 303. Windows 7 64 bit. Delphi XE7.

Please provide any additional information below.

The error occurs on the line:

  Result := SendMessage(AHandle, MN_GETHMENU, 0, 0);

HMENU is an UINT_PTR, but SendMessage returns a LRESULT which is an INT_PTR. A 
forced cast to a HMENU will prevent a range check error:

  Result := HMENU(SendMessage(AHandle, MN_GETHMENU, 0, 0));

Original issue reported on code.google.com by bogdan...@gmail.com on 23 Feb 2015 at 8:29

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r304.

Original comment by ismspi...@gmail.com on 28 Feb 2015 at 3:16