After moving a Delphi 2009 application from a Windows 2003 / Citrix environment to a 64 bit Windows 2008 R2 environment (users now use RDP instead of Citrix), there are now runtime errors saying "Cannot make a visible Window modal".
The user opens a modal form. Then somehow an event handler which is assigned to a menu item in the main form is triggered. Based on the call stacks, it looks like the user is able to invoke the menu item by pressing its shortcut.
The madExcept stack trace looks like this:
main thread ($2dc):
004ffa88 +06c Ladelist.exe Forms TCustomForm.ShowModal
0052f4ff +0bb Ladelist.exe DB TDataSet.SetActive
008fc9a1 +089 Ladelist.exe u_ladeli 928 +16 TForm1.EditLoadingList
008fadec +070 Ladelist.exe u_ladeli 504 +5 TForm1.OpenLoadingListClick <- second
004d6e27 +0a7 Ladelist.exe Menus TMenuItem.Click
004d857f +0ef Ladelist.exe Menus DoClick
004d866b +087 Ladelist.exe Menus TMenu.IsShortCut
005001c1 +04d Ladelist.exe Forms TCustomForm.IsShortCut
004e8dc0 +068 Ladelist.exe Controls TWinControl.IsMenuKey
004e8f89 +011 Ladelist.exe Controls TWinControl.CNSysKeyDown
004e247e +2d2 Ladelist.exe Controls TControl.WndProc
004e6983 +513 Ladelist.exe Controls TWinControl.WndProc
004fb5e8 +594 Ladelist.exe Forms TCustomForm.WndProc
004e20a4 +024 Ladelist.exe Controls TControl.Perform
004856e0 +014 Ladelist.exe Classes StdWndProc
004e609c +02c Ladelist.exe Controls TWinControl.MainWndProc
004856e0 +014 Ladelist.exe Classes StdWndProc
775b00e3 +02b ntdll.dll KiUserCallbackDispatcher
008fc9a1 +089 Ladelist.exe u_ladeli 928 +16 TForm1.EditLoadingList
008fadec +070 Ladelist.exe u_ladeli 504 +5 TForm1.OpenLoadingListClick <- first
004d6e27 +0a7 Ladelist.exe Menus TMenuItem.Click
004d857f +0ef Ladelist.exe Menus DoClick
004d866b +087 Ladelist.exe Menus TMenu.IsShortCut
005001c1 +04d Ladelist.exe Forms TCustomForm.IsShortCut
004e8dc0 +068 Ladelist.exe Controls TWinControl.IsMenuKey
004e8e0d +01d Ladelist.exe Controls TWinControl.CNKeyDown
004e247e +2d2 Ladelist.exe Controls TControl.WndProc
004e6983 +513 Ladelist.exe Controls TWinControl.WndProc
004fb5e8 +594 Ladelist.exe Forms TCustomForm.WndProc
004e20a4 +024 Ladelist.exe Controls TControl.Perform
004e609c +02c Ladelist.exe Controls TWinControl.MainWndProc
004856e0 +014 Ladelist.exe Classes StdWndProc
775b00e3 +02b ntdll.dll KiUserCallbackDispatcher
753c3675 +010 kernel32.dll BaseThreadInitThunk
Second example:
main thread ($4c94):
004ffa88 +06c Ladelist.exe Forms TCustomForm.ShowModal
0052f4ff +0bb Ladelist.exe DB TDataSet.SetActive
008fc9a1 +089 Ladelist.exe u_ladeli 928 +16 TForm1.EditLoadingList
008fbacd +085 Ladelist.exe u_ladeli 765 +11 TForm1.SearchShipmentClick
004d6e27 +0a7 Ladelist.exe Menus TMenuItem.Click
004d857f +0ef Ladelist.exe Menus DoClick
004d866b +087 Ladelist.exe Menus TMenu.IsShortCut
005001c1 +04d Ladelist.exe Forms TCustomForm.IsShortCut
004e8dc0 +068 Ladelist.exe Controls TWinControl.IsMenuKey
004e8f89 +011 Ladelist.exe Controls TWinControl.CNSysKeyDown
004e247e +2d2 Ladelist.exe Controls TControl.WndProc
004e6983 +513 Ladelist.exe Controls TWinControl.WndProc
004fb5e8 +594 Ladelist.exe Forms TCustomForm.WndProc
004e20a4 +024 Ladelist.exe Controls TControl.Perform
004856e0 +014 Ladelist.exe Classes StdWndProc
004e609c +02c Ladelist.exe Controls TWinControl.MainWndProc
004856e0 +014 Ladelist.exe Classes StdWndProc
772b00e3 +02b ntdll.dll KiUserCallbackDispatcher
008fc9a1 +089 Ladelist.exe u_ladeli 928 +16 TForm1.EditLoadingList
008fadec +070 Ladelist.exe u_ladeli 504 +5 TForm1.OpenLoadingListClick
004d6e27 +0a7 Ladelist.exe Menus TMenuItem.Click
004d857f +0ef Ladelist.exe Menus DoClick
004d866b +087 Ladelist.exe Menus TMenu.IsShortCut
005001c1 +04d Ladelist.exe Forms TCustomForm.IsShortCut
004e8dc0 +068 Ladelist.exe Controls TWinControl.IsMenuKey
004e8e0d +01d Ladelist.exe Controls TWinControl.CNKeyDown
0067ead1 +03d Ladelist.exe cxControls TcxControl.CNKeyDown
007b2351 +019 Ladelist.exe cxGridCustomView TcxGridSite.CNKeyDown
004e247e +2d2 Ladelist.exe Controls TControl.WndProc
004e885c +01c Ladelist.exe Controls TWinControl.WMNCHitTest
004e247e +2d2 Ladelist.exe Controls TControl.WndProc
004e6983 +513 Ladelist.exe Controls TWinControl.WndProc
0067ef6c +11c Ladelist.exe cxControls TcxControl.WndProc
007b2b1f +01b Ladelist.exe cxGridCustomView TcxGridSite.WndProc
004e609c +02c Ladelist.exe Controls TWinControl.MainWndProc
004856e0 +014 Ladelist.exe Classes StdWndProc
772b00e3 +02b ntdll.dll KiUserCallbackDispatcher
76973675 +010 kernel32.dll BaseThreadInitThunk
Update:
Windows Server 2008 R2 Service Pack 1 is now installed. But the same strange errors occur. We also frequently have these errors:
exception class : EAccessViolation
exception message : Zugriffsverletzung bei Adresse 5E9E19ED in Modul 'audiodev.dll'. Schreiben von Adresse 5E9E19ED.
thread $3068:
5e9e19ed +00 audiodev.dll
0045146d +0d PDFView.exe madExcept CallThreadProcSafe
00451b77 +37 PDFView.exe madExcept UserWorkItemExceptFrame
75543398 +10 kernel32.dll BaseThreadInitThunk
and
exception class : EAccessViolation
exception message : Zugriffsverletzung bei Adresse 74DC1E3D in Modul 'wkscli.dll'. Schreiben von Adresse 74DC1E3D.
thread $1eb8:
74dc1e3d +000 wkscli.dll
758e0165 +160 RPCRT4.dll NdrClientCall2
74dc2dce +032 wkscli.dll NetWkstaGetInfo
6a142162 +007 ntlanman.dll NPOpenEnum
6a1a2f9a +094 MPR.dll WNetOpenEnumW
0045146d +00d PDFView.exe madExcept CallThreadProcSafe
00451b77 +037 PDFView.exe madExcept UserWorkItemExceptFrame
77193398 +010 kernel32.dll BaseThreadInitThunk
and
exception message : Zugriffsverletzung bei Adresse 70841F8E in Modul 'olmapi32.dll'. Schreiben von Adresse 70841F8E.
main thread ($5978):
70841f8e +000 ???
005cade0 +654 PDFView.exe JclMapi 65 +0 TJclEmail.InternalSendOrSave
005cb140 +004 PDFView.exe JclMapi 65 +0 TJclEmail.Send
and
exception class : EAccessViolation exception message : Zugriffsverletzung bei Adresse 565014FD in Modul 'wpdshext.dll'. Schreiben von Adresse 565014FD.
thread $3960: 565014fd +00 wpdshext.dll 76efc511 +4c SHLWAPI.dll QISearch 0045146d +0d PDFView.exe madExcept CallThreadProcSafe 00451b77 +37 PDFView.exe madExcept UserWorkItemExceptFrame 77193398 +10 kernel32.dll BaseThreadInitThunk
It looks like these are related to the usage of an Acrobat (version X) ActiveX control in this application so I'll investigate in this direction. The errors in the original problem report above however appears in an application which does not use Acrobat.
Application.ProcessMessages
? That could give the user the brake it needs to invoke the shortcut again! - Cosmin Prund