casnet
asked on
WIA VB.net Issue
Below are two code chunks. The first is a VB6 program I wrote years ago that created multipage TIFs, the second is the VB.net program I am currently writing. They look similar and from all of the research I have done whould work the same. However I am getting the attached error. Please advise.
Thanks,
Dustin
Here is the exception dump from VS:
System.Runtime.InteropServ ices.COMEx ception was unhandled
ErrorCode=-2147467259
Message="Error HRESULT E_FAIL has been returned from a call to a COM component."
Source="Interop.WIA"
StackTrace:
at WIA.ImageProcessClass.Appl y(ImageFil e Source) at CDS_ImageEdit_vb.Form1.For m1_Load(Ob ject sender, EventArgs e) in \\casnas1\sales\Walls\Visu al Studio 2008\Projects\CDS ImageEdit_vb\CDS ImageEdit_vb\Form1.vb:line 25 at System.EventHandler.Invoke (Object sender, EventArgs e) at System.Windows.Forms.Form. OnLoad(Eve ntArgs e) at System.Windows.Forms.Form. OnCreateCo ntrol() at System.Windows.Forms.Contr ol.CreateC ontrol(Boo lean fIgnoreVisible) at System.Windows.Forms.Contr ol.CreateC ontrol() at System.Windows.Forms.Contr ol.WmShowW indow(Mess age& m) at System.Windows.Forms.Contr ol.WndProc (Message& m) at System.Windows.Forms.Scrol lableContr ol.WndProc (Message& m) at System.Windows.Forms.Conta inerContro l.WndProc( Message& m) at System.Windows.Forms.Form. WmShowWind ow(Message & m) at System.Windows.Forms.Form. WndProc(Me ssage& m) at System.Windows.Forms.Contr ol.Control NativeWind ow.OnMessa ge(Message & m) at System.Windows.Forms.Contr ol.Control NativeWind ow.WndProc (Message& m) at System.Windows.Forms.Nativ eWindow.De buggableCa llback(Int Ptr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.SafeN ativeMetho ds.ShowWin dow(Handle Ref hWnd, Int32 nCmdShow) at System.Windows.Forms.Contr ol.SetVisi bleCore(Bo olean value) at System.Windows.Forms.Form. SetVisible Core(Boole an value) at System.Windows.Forms.Contr ol.set_Vis ible(Boole an value) at System.Windows.Forms.Appli cation.Thr eadContext .RunMessag eLoopInner (Int32 reason, ApplicationContext context) at System.Windows.Forms.Appli cation.Thr eadContext .RunMessag eLoop(Int3 2 reason, ApplicationContext context) at System.Windows.Forms.Appli cation.Run (Applicati onContext context) at Microsoft.VisualBasic.Appl icationSer vices.Wind owsFormsAp plicationB ase.OnRun( ) at Microsoft.VisualBasic.Appl icationSer vices.Wind owsFormsAp plicationB ase.DoAppl icationMod el() at Microsoft.VisualBasic.Appl icationSer vices.Wind owsFormsAp plicationB ase.Run(St ring[] commandLine) at CDS_ImageEdit_vb.My.MyAppl ication.Ma in(String[ ] Args) in 17d14f5c-a337-4978-8281-53 493378c107 1.vb:line 81 at System.AppDomain._nExecute Assembly(A ssembly assembly, String[] args) at System.AppDomain.nExecuteA ssembly(As sembly assembly, String[] args) at System.Runtime.Hosting.Man ifestRunne r.Run(Bool ean checkAptModel) at System.Runtime.Hosting.Man ifestRunne r.ExecuteA sAssembly( ) at System.Runtime.Hosting.App licationAc tivator.Cr eateInstan ce(Activat ionContext activationContext, String[] activationCustomData) at System.Runtime.Hosting.App licationAc tivator.Cr eateInstan ce(Activat ionContext activationContext) at Microsoft.VisualStudio.Hos tingProces s.HostProc .RunUsersA ssemblyDeb ugInZone() at System.Threading.ThreadHel per.Thread Start_Cont ext(Object state) at System.Threading.Execution Context.Ru n(Executio nContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHel per.Thread Start()
InnerException:
Thanks,
Dustin
Here is the exception dump from VS:
System.Runtime.InteropServ
ErrorCode=-2147467259
Message="Error HRESULT E_FAIL has been returned from a call to a COM component."
Source="Interop.WIA"
StackTrace:
at WIA.ImageProcessClass.Appl
InnerException:
VB6 CODE
Page1.LoadFile ccdDataHold(intCounter).strCCDPath1
Page2.LoadFile ccdDataHold(intCounter).strCCDPath2
Page3.LoadFile ccdDataHold(intCounter).strCCDPath3
IP.Filters.Add IP.FilterInfos("Frame").FilterID
Set IP.Filters(IP.Filters.Count).Properties("ImageFile") = Page2
IP.Filters.Add IP.FilterInfos("Frame").FilterID
Set IP.Filters(IP.Filters.Count).Properties("ImageFile") = Page3
IP.Filters.Add IP.FilterInfos("Convert").FilterID
IP.Filters(IP.Filters.Count).Properties("FormatID") = wiaFormatTIFF
Set Page1 = IP.Apply(Page1)
Page1.SaveFile "J:\VOID\" & ccdDataHold(intCounter).strCCDNameHold & ".tif"
intCounter = intCounter + 1
IP.Filters.Remove (1)
IP.Filters.Remove (1)
IP.Filters.Remove (1)
NEW VB.NET CODE
Page1.LoadFile ccdDataHold(intCounter).strCCDPath1
Page2.LoadFile ccdDataHold(intCounter).strCCDPath2
Page3.LoadFile ccdDataHold(intCounter).strCCDPath3
IP.Filters.Add IP.FilterInfos("Frame").FilterID
Set IP.Filters(IP.Filters.Count).Properties("ImageFile") = Page2
IP.Filters.Add IP.FilterInfos("Frame").FilterID
Set IP.Filters(IP.Filters.Count).Properties("ImageFile") = Page3
IP.Filters.Add IP.FilterInfos("Convert").FilterID
IP.Filters(IP.Filters.Count).Properties("FormatID") = wiaFormatTIFF
Set Page1 = IP.Apply(Page1)
Page1.SaveFile "J:\VOID\" & ccdDataHold(intCounter).strCCDNameHold & ".tif"
intCounter = intCounter + 1
IP.Filters.Remove (1)
IP.Filters.Remove (1)
IP.Filters.Remove (1)
Error.JPG
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Dustin
Open in new window