2011-10-12 55 views
5

這是我最近發現的最有趣的問題之一。 我們有一個傳統的Delphi 5程序(Rave Reports 4參考文件阻止升級到D2007)。當清單被添加爲資源時,Delphi 5會導致EAccessViolation

當程序與我們的模板生成版本資源編譯時,它工作正常。當模板生成的清單資源添加到程序的dpr中時也會出現問題。

清單是一個 「通用」,ASCII文件:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 

    <assemblyIdentity 
    name="Name" 
    processorArchitecture="x86" 
    version="2.0.0.0" 
    type="win32"/> 

    <description>Desc</description> 

    <dependency> 
     <dependentAssembly> 
      <assemblyIdentity 
       type="win32" 
       name="Microsoft.Windows.Common-Controls" 
       version="6.0.0.0" 
       processorArchitecture="x86" 
       publicKeyToken="6595b64144ccf1df" 
       language="*" 
      /> 
     </dependentAssembly> 
    </dependency> 

    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> 
    <security> 
     <requestedPrivileges> 
     <requestedExecutionLevel level="asInvoker" uiAccess="false"/> 
     </requestedPrivileges> 
    </security> 
    </trustInfo> 

    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
    <application> 
     <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> 
     <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> 
    </application> 
    </compatibility> 

</assembly> 

在App.dpr有一個明顯的資源引用:

{$R 'manifest.res' 'manifest.rc'} 

貨單編譯調用:

C:\Program Files\Borland\Delphi5\Bin\brcc32.exe manifest.rc 

當程序啓動後,異常提出:

對於主線程
exception class : EAccessViolation 
exception message : Access violation at address 75A1A890 in module 'KERNELBASE.dll'. Read of address 00000001. 

調用堆棧:

main thread ($1144): 
75a1a890 +007 KERNELBASE.dll 
75a1a97c +069 KERNELBASE.dll   WideCharToMultiByte 
73f28764 +048 comctl32.dll   #342 
777741f4 +016 user32.dll    CallWindowProcA 
00092de2 +0ca app.exe  Controls TWinControl.DefaultHandler 
0009336c +01c app.exe  Controls TWinControl.WMNotify 
000c2454 +024 app.exe  ComCtrls TCustomListView.WMNotify 
00090249 +111 app.exe  Controls TControl.WndProc 
00092d0a +1d2 app.exe  Controls TWinControl.WndProc 
000c39ea +072 app.exe  ComCtrls TCustomListView.WndProc 
0009290c +02c app.exe  Controls TWinControl.MainWndProc 
000a5880 +014 app.exe  Forms StdWndProc 
77757690 +044 user32.dll    SendMessageW 
777741f4 +016 user32.dll    CallWindowProcA 
000c1e6f +0c7 app.exe  ComCtrls TCustomListView.HeaderWndProc 
000a5880 +014 app.exe  Forms StdWndProc 
7763642b +02b ntdll.dll    KiUserCallbackDispatcher 
77753573 +00a user32.dll    DispatchMessageA 
000ae8c7 +083 app.exe  Forms TApplication.ProcessMessage 
000ae8fe +00a app.exe  Forms TApplication.HandleMessage 
000aeb09 +081 app.exe  Forms TApplication.Run 
00186ecf +077 app.exe  mca  initialization 
75b61192 +010 kernel32.dll   BaseThreadInitThunk 

鏈接COMCTL32.DLL:

73f00000 comctl32.dll   6.10.7600.16385 C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7600.16385_none_421189da2b7fabfc 

從我所看到的問題,勢必有一些德爾福5個不兼容性COMCTL32.DLL控制。我更新了Delphi VCL到最新版本。除了遷移到D2007之外,還有其他解決方案嗎?

+1

遷移到Delphi 2007是個不錯的主意。那麼你只有4年過時而不是12年。 –

+0

對於現成的軟件,我完全同意。然而,這是一次「定製」的舊定製應用程序「刷新」,工作得到相應補償。只要不涉及Rave,Delphi 2007的升級是無懈可擊的。德爾福2009年不一定如此(我正在談論dailywtf合格代碼)。 – too

回答

5

如果我正確記得,你需要更多的只是清單。您還需要Mike Lischke's theme manager component。這段代碼最終在Delphi 7中找到了方法。

+0

是的,就是這樣。作爲副作用,應用程序現在看起來更好 - 謝謝。 – too

+1

只需添加一點這個答案,如果你有一個沒有主題(由於DC政治)的Windows 7(或2008服務器),至少在64位版本上,你也會得到這個錯誤...唯一的我發現的答案是完全刪除主題。 – Chiguireitor

相關問題