Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Delay creating first block when dglGdiPlus used

 Post Reply Post Reply
Author
Wilbourn David View Drop Down
Member
Member
Avatar

Joined: 18 Aug 2010
Posts: 46
Post Options Post Options   Quote Wilbourn David Quote  Post ReplyReply Direct Link To This Post Topic: Delay creating first block when dglGdiPlus used
    Posted: 19 Sep 2019 at 1:54pm
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? 
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2566
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 19 Sep 2019 at 2:55pm
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;
Back to Top
Wilbourn David View Drop Down
Member
Member
Avatar

Joined: 18 Aug 2010
Posts: 46
Post Options Post Options   Quote Wilbourn David Quote  Post ReplyReply Direct Link To This Post Posted: 19 Sep 2019 at 3:57pm
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.
 
Back to Top
Wilbourn David View Drop Down
Member
Member
Avatar

Joined: 18 Aug 2010
Posts: 46
Post Options Post Options   Quote Wilbourn David Quote  Post ReplyReply Direct Link To This Post Posted: 19 Sep 2019 at 4:57pm
.... Tried the Initialize & Finalize but that did not make any difference. 
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2566
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 19 Sep 2019 at 7:11pm
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?
Back to Top
Wilbourn David View Drop Down
Member
Member
Avatar

Joined: 18 Aug 2010
Posts: 46
Post Options Post Options   Quote Wilbourn David Quote  Post ReplyReply Direct Link To This Post Posted: 23 Sep 2019 at 12:50pm
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.
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2566
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 23 Sep 2019 at 3:23pm
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?
Back to Top
Wilbourn David View Drop Down
Member
Member
Avatar

Joined: 18 Aug 2010
Posts: 46
Post Options Post Options   Quote Wilbourn David Quote  Post ReplyReply Direct Link To This Post Posted: 23 Sep 2019 at 3:46pm
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!)
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down