Foxpro Menu items, combo boxes not refreshing selected item under Aero in Vista

If you’re running a Foxpro application under Vista when using Aero , you might encounter a problem when scrolling through lists, such as intellisense dropdowns, comboboxes, menus.

As you move from one item in the list to the next, each item in turn appears to be selected (colors inverted), which means the prior selected item should be unselected.

However, on Vista Aero, sometimes the prior items do not get painted unselected, thus showing multiple selected items.

There’s a simple workaround (that works back to VFP7): call the GdiSetBatchLimit API.

The GdiSetBatchLimit function sets the maximum number of function calls that can be accumulated in the calling thread's current batch. The system flushes the current batch whenever this limit is exceeded.

This will be fixed in the next SP release of VFP

The workaround is to run these 2 lines of code somewhere in your application only once.

DECLARE integer GdiSetBatchLimit IN WIN32API integer

GdiSetBatchLimit(1)