Any suggestions on how to get the mdlSystem_setBatchProcessingState (ustation.dll) pinvoke declaration to work in vb.net? I keep getting the "Unable to load DLL 'ustation.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)" error, regardless of how I change the code.
Apparently this means that the DLL is found, but unable to load. I am unable to find the "mdlSystem_setBatchProcessingState" method in ustation.dll using dnSpy or ildasm. I thought perhaps there is a dependency problem, so I ran the dependency walker... however there 571 missing files (most look like "EXT-MS-WIN-*.DLL). I find it hard to believe that I would have to resolve all of these prior to using the .dll.
All of my projects are 64 bit. Everything compiles and works just fine prior to trying to use this method. Note that all other code is using the non-pinvoke .net methods.
If there is another way of entering batch processing using vb.net (no pinvoke) that would also work. That would actually be preferable.
Thanks for your time.
Here are some various ways that I've tried:
<DllImport("ustation.dll", EntryPoint:="mdlSystem_setBatchProcessingState")> Public Shared Sub mdlSystem_setBatchProcessingState( ByVal procState As Long, ByVal s As IntPtr) End Sub
Friend Declare Auto Sub mdlSystem_setBatchProcessingState Lib "ustation.dll" ( ByVal procState As Long, ByVal s As IntPtr)
I split my "code notes" to separate post:
Steven Faist said:Any suggestions on how to get the mdlSystem_setBatchProcessingState (ustation.dll) pinvoke declaration to work in vb.net?
I's not clear whether you VB.NET application is independent application, accessing MicroStation e.g. using Interop assembly, or it's MicroStation addin.
It's allowed to access MicroStation native C++ functions only from addins (because it's the same process). I think (but I never tried) it's not possible to use P/Invoke in external (Interop) process.
Steven Faist said:I am unable to find the "mdlSystem_setBatchProcessingState" method in ustation.dll using dnSpy or ildasm.
How it would be possible, when dnSpy and oldasm are NET tools, used to analyze NET assemblies, whereas DllImport access native C functions, exported in dll?
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Sorry. Yes, independent application using interop assemblies.