Wednesday, January 16, 2013

ssThrobber on Alpha 3.0


What's New:

a.  Changed look. It is now Snoopy sliding around instead of a simple throbber
b.  Bigger fonts WordWrapped
c.  Ability to change caption
d.  The ability to specify positions

Since the original ssThrobber can change caption and positions, I decided to do the same with this one.  But while I use the word "Caption" here, it is really not the Caption property I touched but "Comment".  Don't bother yourself much about that one though because ssThrobber will handle those things by itself.  Here is a sample usage:


LOCAL loThrobber
loThrobber = Createobject('ssthrobber.animate')
loThrobber.AutoCenter = .F.   && ssThrobber will position itself in the center and ignore .Top and .Left below if this is set to .T. (default)
loThrobber.Left = 400
loThrobber.Top = (Sysmetric(2)-120)/2
loThrobber.Show  && Make it appear

To change caption is like this:

loThrobber.Comment = 'Doing some crazy stuff now, please stare hard and don't ever blink!'

And to end it up, like this:

loThrobber.Hide


Looking at the above image though, you will see that it is showing progress and that is because I have placed that inside a SCAN...ENDSCAN where I am able to calculate progress like this:

Local lnCtr, lnTotal
lnCtr = 0 
lnTotal = _Tally && or Reccount()
SCAN
   loThrobber.Comment = 'Working: '+Alltrim(Transform((m.lnCtr/m.lnTotal)*100,"999"))+'%......'
   lnCtr = lnCtr+1
   * Do something
ENDSCAN

So it is giving me a progress now, great!


It took me a while to trace what exactly I have done why said ssThrobber is working properly on my laptop while on others I have to do some more tricks like adding registry entries plus executing ssThrobber /automation; as posted in the first blog about this.  However, lately those other units here on our end started to fail again so those steps are not the real answer to that peculiarity.

Now I realize that what has happened is since I "built" the project on my said laptop, it automatically registers itself (ssThrobber.exe) on said unit. However, for distribution to other units, then you have to manually register it (using an Administrator's account) on the unit it will be used on.

Gotcha!!!

Fullpath() should be included because that is where said unit will always refer to.  So if ssThrobber will be installed on a server, then better use the UNC path instead of a mapped drive because mapped drive may disconnect or may change letter based on the admins; which will cause ssThrobber to fail unless you have an ON ERROR or a TRY...CATCH routine.  To negate that possibility, use UNC path. Click Start button, Run and type something like:

\\myServer\myApp\ssthrobber.exe /regserver

That is a one time registration so I don't think that that small hassle will shy you away from ssThrobber.

Expect this to be part of the latest ssClasses I will upload hopefully this month.

4 comments:

  1. Jun, with a COM server you really should create a manifest file and include it so no registering needs to be done. I have posted heaps about manifests on foxite for your reference.

    ReplyDelete
  2. Thanks for the info Bernard. I have checked ProjectHook class by Craig Boyd which embeds those XML manifest inside the exe but per my initial testings made here, it fails on most unit. Using notepad to view ssThrobber.exe, I can see that the manifest is there. I will continue looking at this though as an alternate to manual registration of the COM server.

    Manually registering ssThrobber is only done once so in the meantime, I will leave it like that unless I found the proper way to do that before I upload the Alpha 3.0. Expect also an email from me today. Thanks!

    ReplyDelete
  3. I did as you suggested and used /regserver and the full path. This did get me past my initial issue of not being a registered class...but...now I am having the next issue. It is reporting "OLE error code 0x800702e4: The requested operation requires elevation". I get this error during trying to create the object. Any other ideas as to how I can get this to work properly on my machine?

    ReplyDelete
    Replies
    1. Unlike earlier Windows OS like XP, users need only to be logged in using an Administrator account. Later OS though added an additional layers of Security called UAC or User Access Control. So aside from being logged on as an Administrator, you can try to register it via CMD instead with an elevated privileges. Search CMD and then Right-click on it and choose "Run as Administrator". Then do the registration on that command prompt:

      \\myServer\myApp\ssthrobber.exe /regserver

      Delete