Could some kind soul please help me write a VBA function declaration for this undocumented mdl function: "mdlSystem_setBatchProcessingState (PROCESSSTATE_Processing, NULL) ". I keep getting a workspace alert dialog every time a new file is opened when running a VBA batch. My hope is that I can use this function to prevent that. My Micostation version is 10.14.02.01. Thanks.
First, define the possible values of PROCESSSTATE for VBA...
PROCESSSTATE
Public Enum PROCESSSTATE PROCESSSTATE_Inactive = 0 PROCESSSTATE_Processing = 1 PROCESSSTATE_Paused = 2 PROCESSSTATE_Done = 3 PROCESSSTATE_Cancelled = 4 PROCESSSTATE_OpeningFile = 5 PROCESSSTATE_AnalyzeFile = 6 PROCESSSTATE_ClosedFile = 7 End Enum
Next, declare the function prototype in VBA...
Declare PtrSafe Sub mdlSystem_setBatchProcessingState _ Lib "ustation.dll" _ (ByVal PROCESSSTATE, ByVal s As LongPtr)
Now write a VBA wrapper. I've stolen and adapted this one from Yongan.Fu's post...
Public Sub OpenFileWithoutWorkSetCheck(ByVal fileName As String) mdlSystem_setBatchProcessingState PROCESSSTATE_Processing, 0 OpenDesignFile fileName mdlSystem_setBatchProcessingState PROCESSSTATE_Inactive, 0 End Sub
The above is all guesswork — I haven't tested it.
Regards, Jon Summers LA Solutions
Thanks Jon, it's still not working, but you set me in the right direction. I get a runtime error stating "Can't find DLL entry point mdlSystem_setBatchProcessingState in stdmdlbltin.dll". My assumption is the function is not contained in that dll. I'll look around and see if I can figure out which one it is.
Also, just want to send out a big thanks to you and your website! I starting using Microstation about 8 or 9 years ago and virtually everything I know about Microstation VBA started with your website. You've made me a rockstar among my peers.
Hi Robert,
Robert Ness said:My assumption is the function is not contained in that dll. I'll look around and see if I can figure out which one it is.
I recommend to use tools like dllexp (very old, but still useful) or similar, that allow to see what functions are exported in particular dll.
Using the mentioned one, it was simple task to find the function is available in ustation.dll.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Jan Šlegr said:it was simple task to find the function is available in ustation.dll
Thanks for finding the right DLL!
Answer Verified By: Robert Ness
Hi Jan Šlegr,
Though I cannot directly assist on questions related to unpublished/private API methods; in General FWIW as a Productivity Tip...
For the simple task of "finding a method across one or more binary files" (definitions and/or consumers), findstr -sim "FuncName" *.dll is extremely quick and fairly accurate (I'd rate ~92% or better. Binary file types using compression are not good candidates) way to perform a "first pass" at finding consumers and definitions of a given search string.
This approach is used and available within a couple MicroStation Developer Shell "tools":
For example, in a matter of seconds (<15 seconds) sb from the MicroStation (ms) Root directory provides these results for the SearchString in question:
C:\PROGRA~1\Bentley\MICROS~2\MICROS~1>sb mdlSystem_setBatchProcessingState *.dll MdlSys\Asneeded\batchprocess.dll ustation.dll
HTH,Bob