c# - Using the activeX Control "AcroPDF.dll" my application works fine, but crashes on startup if adobe acrobat is not installed -
i have application adds text pdf files, , have axacropdf1 preview panel borrows acrobat show status of pdf file, not necessary function of program, so i'd have program still start when acrobat not installed albeit more limited functionality, , user wont have preview panel fine. how can this?
the thing think try adding catch/exception when this.axacropdf1 initializing when program starts, allows me put message popup adobe reader required, program still crashes after that, have program start regardless, , not call on when adobe not installed, or other suggestions guys have application still function or without adobe.
i know how check if adobe installed, don't know how apply result program.
the catch exception on initializing gives following error (i'm noob not giving information here):
system.runtime.interopservices.comexception (0x80040154): class not registered (exception hresult: 0x80040154 (regdb_e_classnotreg)) @ system.windows.forms.unsafenativemethods.cocreateinstance(guid& clsid, object punkouter, int32 context, guid& iid) @ system.windows.forms.axhost.createwithlicense(string license, guid clsid) @ system.windows.forms.axhost.createinstancecore(guid clsid) @ system.windows.forms.axhost.createinstance() @ system.windows.forms.axhost.getocxcreate() @ system.windows.forms.axhost.transitionupto(int32 state) @ system.windows.forms.axhost.createhandle() @ system.windows.forms.control.createcontrol(boolean fignorevisible) @ system.windows.forms.control.createcontrol(boolean fignorevisible) @ system.windows.forms.control.createcontrol() @ system.windows.forms.control.wmshowwindow(message& m) @ system.windows.forms.control.wndproc(message& m) @ system.windows.forms.scrollablecontrol.wndproc(message& m) @ system.windows.forms.containercontrol.wndproc(message& m) @ system.windows.forms.form.wmshowwindow(message& m) @ system.windows.forms.form.wndproc(message& m) @ system.windows.forms.control.controlnativewindow.onmessage(message& m) @ system.windows.forms.control.controlnativewindow.wndproc(message& m) @ system.windows.forms.nativewindow.callback(intptr hwnd, int32 msg, intptr wparam, intptr lparam)
solution: decided use inno installer since have dll files, , in installer script, adobe check, , if dont have adobe or right version prompt user download reader. here basic code check adobe:
[code] procedure exitprocess(exitcode:integer); external 'exitprocess@kernel32.dll stdcall'; function getacrobatreaderversion(): string; var sversion: string; begin sversion := ''; regquerystringvalue( hklm, 'software\microsoft\windows\currentversion\app paths\acrord32.exe', '', sversion ); getversionnumbersstring( sversion , sversion ); result := sversion; end; function getacrobatversion(): string; var sversion2: string; begin sversion2 := ''; regquerystringvalue( hklm, 'software\microsoft\windows\currentversion\app paths\acrobat.exe', '', sversion2 ); getversionnumbersstring( sversion2 , sversion2 ); result := sversion2; end; function nextbuttonclick(curpage: integer): boolean; begin // default go next page result := true; if curpage = wpwelcome begin if length( getacrobatreaderversion + getacrobatversion() ) = 0 begin msgbox( 'adobe not detected', mbinformation, mb_ok ); result := false; exitprocess(0);//adobe isn't installed, exit installer end else //msgbox( 'acrobat reader installed version ' + getacrobatreaderversion() , msgbox( 'adobe detected', mbinformation, mb_ok ); end; end;
Comments
Post a Comment