c# - Is there a way to know if there is a IWin32Window already created? -
i trying integrate application several others. in 1 case getting following exception:
system.invalidoperationexception unhandled user code message=setcompatibletextrenderingdefault must called before first iwin32window object created in application. this exception because trying do:
system.windows.forms.application.setcompatibletextrenderingdefault(false); and application trying integrate has created iwin32window.
i have searched around , should not try setcompatibletextrenderingdefault(false) if there iwin32window. since application going integrated in various others conditions in each case change.
for planning change application receive parameter depending on context run setcompatibletextrenderingdefault(false) or not.
but like, instead, know if there way verify if there iwin32window created before doing setcompatibletextrenderingdefault(false).
i sorry if dumb question haven't worked winforms before.
i appreciate can give me.
update
after reading first answer , of comments, want mention context having problem rather complex , can not explain here. appreciate feedback , understand saying.
i think spirit of question misunderstood context added, know why error happening , know ways solve , work around.
i know if there way know if there iwin32window created?
after all, exception happening because iwin32window created, wondering how can know that.
thanks again.
application.setcompatibletextrenderingdefault() one aspect of getting program configured display ui. there's far more important stuff needs setup correctly, kind of initialization dll can never take care of. super-duper important have main thread of such program sta thread, configured [stathread] attribute on main() entrypoint of exe. needs pump message loop, application.run() keep windows alive, call can made once on thread.
duties exe must perform, cannot reliably done dll. starting separate ui thread possibility, albeit way cause lots more trouble it's worth.
Comments
Post a Comment