Using COM autmation, building an OlePublic class in an out-of-process COM Server EXE.
To show an example:
1. create a new project you call "progress"
2. create a main.prg as main program of the project with this code:
Code:
Define Class GIF as Form Olepublic
Add Object Image1 as Image
Caption = ""
BorderStyle = 0
ShowWindow = 2
ShowInTaskBar = .F.
GIF = ""
Procedure GIF_assign()
Lparameters tcGIF
This.GIF = tcGIF
With Thisform
.Visible = .F.
.AutoCenter = .F.
.Image1.Picture = tcGIF
.Width = .Image1.Width
.Height = .Image1.Height
.AlwaysOnTop = .T.
.AutoCenter = .T.
.Visible = .T.
.TitleBar = 0
.Show()
EndWith
EndProc
Enddefine
3. Build an EXE from that
4. Use it with:
Code:
oGIF = CreateObject("Progress.GIF")
oGIF.GIF = ... image file name...
* do something, i.e. a MySQL query
* when done, quit by killing it:
oGIF = .null.
Testing with morphfox.gif I see a grey bar to the right. I think that's due to minimum width of top level forms (i.e. a Windows restriction?). It's not a problem with your sample GIF images, though. Just have large enough GIF images.
One more usage possibility: If you set GIF to another image, the other GIF shows, so you can switch animations, while this COM server runs.
And I tested it running while the main process simply does DO WHILE .T. ENDDO without a DOEVENTS, in comparison with a GIF attached to the _screen of the same main process. The GIF internal to the main process also still animates, just a little slower than the secondary process oGIF form, but still smoothly, so in my experience you wouldn't need this, I also can't think of anything that keeps a VFP process more busy than that endless WHILE loop, but who knows. I'm just not going into creating as much dummy data or a complex query to test your exact scenario.
For usage within an application: The setup has to include progress.exe built from this code and register the Progress.GIF COM server OLE class.
You can, of course, name the project as you like, that effects the OLE class name. Naming it progress.pjx->progress.exe allows to add further classes in the future, that show a progressbar, for example, or other ways of showing progress, you already have the roof EXE for all that.