windows 7 - ShowMessage in Delphi XE3 DllMain -


dll below compiled xe3.

library mydll;  uses system.sysutils, system.classes, vcl.dialogs;  {$r *.res}  var   ii: integer;  function test: integer; begin   result := ii; end;  exports test;  begin   ii := 5;   showmessage('dll prolog'); end. 

when call function test() delphi xe3 or delphi 2007 program correct result (5) in both cases. message "dll prolog" displayed delphi 2007 program, not delphi xe3 program. why?

edit

and when "run" dll xe3 ide delphi 2007 host showmessage() not work.

the key in function:

function messagedlgposhelp(const msg: string; dlgtype: tmsgdlgtype;   buttons: tmsgdlgbuttons; helpctx: longint; x, y: integer;   const helpfilename: string): integer; begin   if tosversion.check(6) , uselatestcommondialogs ,      styleservices.enabled , styleservices.issystemstyle     result := dotaskmessagedlgposhelp('', msg, dlgtype, buttons,       helpctx, x, y, helpfilename)   else     result := domessagedlgposhelp(createmessagedialog(msg, dlgtype, buttons),       helpctx, x, y, helpfilename); end; 

in cases, depending on whether or not host application has comctl32 v6 manifest, different branches of if statement chosen.

if dotaskmessagedlgposhelp branch chosen, ensuing call taskdialogindirect fails hresult code $80070057. win32 error code, error_invalid_parameter.

if domessagedlgposhelp branch chosen, dialog shows.

i'm not sure why taskdialogindirect failing when called library initialization block, i'm not entirely surprised. severely restricted in can done dllmain , should not attempting show dialogs there.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -