I made a example that calling IDL objects in C# by IDLDrawWidget,codes as follows:
axIDLDrawWidget1.IdlPath = @"E:\Program Files\ITT\IDL64\bin\bin.x86\idl.dll";
axIDLDrawWidget1.InitIDL((int)this.Handle);
axIDLDrawWidget1.ExecuteStr("cd,'" + Application.StartupPath+"'");
axIDLDrawWidget1.ExecuteStr("test");
*****************test*********************
test.pro
pro test
envi,/restore_base_save_files
envi_batch_init
envi_open_file,'e:\TERRA_200810091439_XJ_MOD021KM.tif',r_fid=fid
envi_file_query, fid, dims=dims,nb=nb
ENVI_OUTPUT_TO_EXTERNAL_FORMAT,dims=dims,fid=fid,$
out_name='e:\d_SYNC.tif',pos=[0],/tiff
envi_batch_exit
end
***********************************
why it failed to run and had no action?
I think that the routine "envi,/restore_base_save_files" haven't be compiled in test.pro . So I excute it in individual calling as follow:
axIDLDrawWidget1.ExecuteStr("envi,/restore_base_save_files");
But it leads to error:Attempt to call undefined produre/function:'ENVI_IOW'. Why?
..........
I refer to help documents and know that IDL 6.4 have aborted IDLDrawWidget but it was also available. The new nodraw objects COM is COM_IDL_CONNECT. I have a try with this new COM. But it is still unable to call ENVI routines in my code(error information:returning error of HRESULT E_FAIL from calling COM component).
Why? please help me........thank you!
|