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)
Hi Steven,
at first, please be aware this is general Developer and Programming forum. Because your question is about MicroStation, I recommend to move it to MicroStation Programming forum. To move existing post (to do not duplicate the same questions), use More > Move tool, available under your original post.
Also, please modify your post to follow the best practices:
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Done. Thanks for the tip.
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,
Sorry. Yes, independent application using interop assemblies.
Is there any other way to enter "batch processing state"? Perhaps through .net assemblies which are easier to use?
Steven Faist said:Perhaps through .net assemblies which are easier to use?
MicroStation API (both native and NET) is designed to be used inside MicroStation process, not from outside from external processes.
The only "outside alternatives" are COM / Interop (which is limited VBA object model, supporting a bit Batch convert, but not Batch process) and i-model IPC connection (which is based on sending key-ins).
Steven Faist said:Is there any other way to enter "batch processing state"?
From external process? I guess there is nothing "pre-cooked" you can use without implementing own solution.
The right solution (and I guess the only possible), when you want to use MicroStation API (allowing tight integration), from external process, is to establish own (e.g. IPC) communication between MicroStation and your application.
Thanks for the direction, I appreciate it.