SaveUserSettings Taking a Long Time

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

SaveUserSettings Taking a Long Time

Post by RMan »

Is there any case where you could think that would cause the SaveUserSettings call to take a long time?

It was taking 15 seconds on my machine and unfortunately I did not save the existing registry settings but once I deleted the existing registry key it went back to only taking about 0.4 seconds? Anything that you can think of that would severely slow down the SaveUserSettings call to the registry? I'm kicking myself for not thinking to save the existing data first to try to reproduce it.

Here's the basic code we were using.
Dim sngTimer As Single
sngTimer = Timer
Dim oString As PDFXEditCtl.IString
Set oString = AxPXV_Control1.Inst.CreateString("HKCU\Software\MySoftware")
Call AxPXV_Control1.Inst.SaveUserSettings(oString)
MsgBox Format((Timer - sngTimer), "0.0000")
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: SaveUserSettings Taking a Long Time

Post by Sasha - Tracker Dev Team »

Hello RMan,

Probably there was some interference (for example some antivirus or any other program that monitor the registry) before you removed that key.
Also, we don't recommend saving settings to registry - better save it to the file on disk - it's much easier to manage it.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

Re: SaveUserSettings Taking a Long Time

Post by RMan »

It might be the antivirus but since it doesn't happen once the key was deleted and written again I doubt that. I'll keep an eye out and see if it ever pops up again to reproduce it.

Agree the file would be easier but it's always been my experience that if a system admin wants to push out a setting to a user they usually prefer to do it through the registry.
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

Re: SaveUserSettings Taking a Long Time

Post by RMan »

Luckily it was doing it on my surface tablet although not as bad. I tracked it down to it's writing over 20,000 entries into the CmdLayouts\Classic\Bars values and adding to it every time I issue the SaveSettings call it looks like. I can't find any reference to CmdLayouts in our code so I'm guessing it's something you guys are doing in your code. I'll try to see if I can't make a sample to reproduce what it is doing but it looks like once you disable the Ribbon UI it starts causing it to happen.

AxPXV_Control1.Inst.EnableRibbonUI False

[HKEY_CURRENT_USER\Software\MyTest\CtrlSettings2\CmdLayouts\Classic\Bars\000000]
"l.SM"=hex(b):00,00,01,00,00,00,00,00

[HKEY_CURRENT_USER\Software\MyTest\CtrlSettings2\CmdLayouts\Classic\Bars\020705]
"l.S"=hex(b):00,10,0d,00,00,00,00,00
"t.ID"="cmdbar.quickFind"
"l.SM"=hex(b):00,00,01,00,00,00,00,00
"t.Title"="$$$.cmdbar.quickFind"
"t.LocTitle"="Quick Find"
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: SaveUserSettings Taking a Long Time

Post by Sasha - Tracker Dev Team »

Hello RMan,

Can you please also include the settings file?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

Re: SaveUserSettings Taking a Long Time

Post by RMan »

Here's a VB6 Sample App to prove it's not due to any legacy settings in the Registry. It looks like in Classic Mode when you hide commandbars it causes it.

If I run Test2 it runs 10 saves and if you run it once and check the registry then run it again you will see that it increased the count. On mine it goes from 32 the first run to 49 to 66, to 83. Now the strange thing is if I close the program and restart it then it clears out the values from HKEY_CURRENT_USER\Software\MySoftware\TestClassic\CmdLayouts\Classic\Bars and your back at 32 after it does the 10 save loop. But in our own program I'm not seeing that even.

So I'm not sure if it's not releasing some registry keys after writing them or if the count is off to remove the keys.
VBUserSaveSettings.zip
(7.6 KiB) Downloaded 63 times
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

Re: SaveUserSettings Taking a Long Time

Post by RMan »

Also I did some more testing and it looks like the values are cached since the LoadSettings most likely. It looks like there are 17 keys the first time I save it that get written without a t.ID string value in them, hence why it keeps incrementing up by 17 it seams.
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: SaveUserSettings Taking a Long Time

Post by Vasyl-Tracker Dev Team »

Hi RMan.

Thank you for detailed description and good sample app. We found one issue on our side and will fix it asap. Currently you will be able to try the fixed version from there:
http://docu-track.co.uk/devbuilds/lates ... se.x32.zip

The problem caused by using the ShowCmdBar2 in specific scenario - it may add the new invalid(not filled properly) records into CmdLayouts\Classic\Bars array.

Tip: if you want to toggle all toolbars you may try to use next way:

Code: Select all

PXV_Control1.Inst.ExecUICmd ("cmd.view.toggleAllCmdBars")
because your existing way to hide all bars is some incorrect:

Code: Select all

For i = (PXV_Control1.Inst.Str2ID("cmdbar.first", False) + 1) To (PXV_Control1.Inst.Str2ID("cmdbar.last", False) - 1)
        Call PXV_Control1.Inst.ShowCmdBar2(i, False)
Next
- problem is with that code:
- it cannot handle custom bars, made by user
- it adds many redundant records to Classic\Bars array that doesn't represent real bars. for example, following ids:
cmdbar.commenting.part1, cmdbar.commenting.part2, cmdbar.commenting.part3, cmdbar.commenting.part4, cmdbar.commenting.part5, cmdbar.commenting.part6 - aren't ids of regular bars but parts of bars, unfortunately, even each of them is from cmdbar.first - cmdbar.last range.
- this method doesn't work for bars inside ribbon tabs. IDs of standard bars inside ribbon tabs have "rbar." prefix.

HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

Re: SaveUserSettings Taking a Long Time

Post by RMan »

The downloads have not been updated and have the 322 build in them still.

As for cmd.view.toggleAllCmdBars that's great to toggle but what's the best way to tell if they are going to toggle on or off since some may be off already? I think you're missing functions like
cmd.view.showAllCmdBars
cmd.view.hideAllCmdBars

To match the functionality of the lock/unlock
cmd.view.lockUnlockAllCmdBars
cmd.view.lockAllCmdBars
cmd.view.unlockAllCmdBars

If I try to check the visibility of any cmdbar it always returns true even if it's been toggled off.
PXV_Control1.Inst.IsCmdBarVisible2(AxPXV_Control1.Inst.Str2ID("cmdbar.file", False)

So how do I check the value of if they are toggled on or off?

Also the cmd.view.toggleAllCmdBars does not toggle the cmdbar.menubar. You have to manually do that after calling the PXV_Control1.Inst.ExecUICmd ("cmd.view.toggleAllCmdBars")
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: SaveUserSettings Taking a Long Time

Post by Vasyl-Tracker Dev Team »

Hi RMan.
cmd.view.showAllCmdBars
cmd.view.hideAllCmdBars
Yes, and in the new build we will add new useful feature:

Code: Select all

PXV_Control1.VisibleCmdBars = 0; // to hide all toolbars
PXV_Control1.VisibleCmdBars = 3; // to show all toolbars (see new PXV_VisibleCmdBars flags)
About issue with IsCmdBarVisible2. That function returns True when toolbar doesn't contain 'UIX_CmdBarStyle_Hidden' flag in style. But often, even when bar hasn't that flag - it might be invisible according to the global special filter VisibleCmdBars. Problem is that currently the IsCmdBarVisible2 doesn't take into account that filter (the "cmd.toggleAllCmdBars" changes that filter internally). Also it doesn't take into account the VisibleCmdPanes filter. We will fix these problems in the near future.
As workaround - you may check actual visibility state of certain bar:

Code: Select all

bar = PXV_Control1.Frame.View.CmdBar["cmdbar.standard"];
bool bVis = false;
if (bar != Null)  bVis =  bar.Obj.Visible;
----
We already updated our tec. build to 324. And approx after 7am UTC the tec. build will be updated again to provide new 'VisibleCmdBars' feature and some other fixes.

HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

Re: SaveUserSettings Taking a Long Time

Post by RMan »

Thanks. I was unable to get the tec build to work with VB6. Maybe it needs the updated tlb files in it also? I tired registering the dll files but when I tried to bring up a form in VB6 that already had the control on it the VB6 IDE would crash.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: SaveUserSettings Taking a Long Time

Post by Sasha - Tracker Dev Team »

Hello RMan,

We are investigating this one and hopefully will find out the cause of this.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: SaveUserSettings Taking a Long Time

Post by Vasyl-Tracker Dev Team »

Hi RMan.

We fixed that issue. Try our new updated nightbuild - it will be ready soon, in couple hours from that moment.

HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Post Reply