Delay creating first block when dglGdiPlus used

I need to have GraphicLib := dglGdiPlus as I am using metafiles in my diagram. This works fine but when the first diagram block is added there is about a 4 sec delay while (presumably) the GdiPlus library is loaded. After the first block there are no more delays. 

Is there a way to force the library to load (or whatever the delay is about) at startup? I have tried creating an empty block during the form create but that does not seem to work, maybe the library is too smart to be fooled by an empty, invisible block that is then deleted? 

Hello David, that's really strange. I have never seen such delay occurring, how do you know that is about GDI Plus loading mechanism?

In any case, you can try to use unit DgrGdipObj, there you have procedures to initialize and finalize gdi plus:


unit DgrGdipObj;



procedure InitializeGdiPlus;
procedure FinalizeGdiPlus;

Hi Wagner,

I just comment out Survey.GraphicLib := dglGdiPlus; and it starts immediately. Put it back in and there is a 4 sec delay. I just presumed that was the cause.
I will try Initialize & Finalize procedures.
 

.... Tried the Initialize & Finalize but that did not make any difference. 

I'm sorry, but as I said I never saw it and I don't know what might be causing this. What happens if you use Direct2D lib?

Hi Wagner,

Sorry for the slow reply, busy weekend....

I have made a very small test app that shows the delay problem. I have tested it on a couple of PCs and they all exhibit the startup delay with dglGdiPlus. You can download the test app and the 2 compiled apps (with and without the atdiagram.GraphicLib := dglGdiPlus;) from here:

https://wetransfer.com/downloads/fb9327d4795f35e0631f03f052ce208920190923103645/9ac9c967e6451f041359be87593bb70120190923103645/6c2131

While creating the test set I did notice that the debug and release EXes run much faster than when debugging from within the IDE (<1 sec compared to about 4 secs) however the delay is still noticeable. 

Regards,
David.

Strange, but I simply don't see any delay here. And yes, when debugging from the IDE you might see a significant delay as it intercepts and shows dlls being loaded in the debug Window. A <1s delay is acceptable and mostly unnoticed, isn't it?

Hi Wagner,

The delay is down to about 2 sec in my full application when running the release EXE rather than debugging in the IDE. And I finally worked out how to make the delay occur during application startup rather than on the first block creation - I just added a block to the Diagram in the source and set it to NoShape & NoSelect so you can't see it. (I should have thought of that when I was working on the test app!)