#85371 - 2002-03-21 12:20 AM
Need some help with COM
|
Redback
Getting the hang of it
Registered: 2002-03-20
Posts: 71
Loc: Albury Wodonga, Australia
|
Hi
I am trying to add a progress indicator to my login scripts.
What i want to do is display a GUI window centre screen with a logo on it, with a bit of text that says what the script is doing at that point in time beneath, a progress bar would be nice too
I have got KiXGUI, and i had a look at the sample files, in particular logonscr.k2k, but i couldent figure out enough about how the COM stuff works to adapt it to do what i want.
Does anyone know of any good guides to this stuff?
|
|
Top
|
|
|
|
#85372 - 2002-03-21 12:51 AM
Re: Need some help with COM
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
I believe I poseted one in the UDFs... if not, I have it at work somewhere
|
|
Top
|
|
|
|
#85373 - 2002-03-20 05:44 PM
Re: Need some help with COM
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
here it is...
code:
break on $=setconsole("hide")
;*************** Initiallize the form and it's Properties **************** $root = createobject("KiXGUI.Desktop") if $root=0 copy "\\a06\logon\kixgui.dll" "%windir%" shell "regsvr32 %windir%\kixgui.dll /s" $root = createobject("KiXGUI.Desktop") endif $form = $root.createform("form","") $text = $form.addtextbox("text","Logon Script processing",10,15,270,20,,1) $form.TitleBar =0 $form.ShowInTaskbar =0 $form.layered =99 $form.width =300 $form.height =90 $form.left =200 $form.top =200 $form.TopMost =1 $Progressbar=$form.Addprogressbar("progress",10,50,270,20) $Progressbar.ProgressBarStyle=2 $Progressbar.maxprogress=30
; ************** Show the form now that it is built ********************** $form.visible=1 sleep 2
; ************** Increment the bar and refresh it ************************ for $loop = 1 to 30 $Progressbar.currentprogress=$loop $text.caption="progress point $loop" $form.visible=1 sleep 1 next $text.caption="Logon Script Complete" $form.visible=1 sleep 2
; ************** fade away and clean up ********************** for $loop =99 to 1 step -1 $form.layered =$loop next $form.visible=0 $root=0
|
|
Top
|
|
|
|
#85374 - 2002-03-21 04:08 AM
Re: Need some help with COM
|
Redback
Getting the hang of it
Registered: 2002-03-20
Posts: 71
Loc: Albury Wodonga, Australia
|
Thanks
I grabbed the one from Here
I see it uses fixed screen coordinates, 200,200 in the example, is there any way to make it centered on the screen?
I guess you could some how obtain the screen resolution and do some maths to calculate the coordinates, but a fixed centre option would be nicer
Thanks Redback [ 21 March 2002, 04:09: Message edited by: Redback ]
|
|
Top
|
|
|
|
#85375 - 2002-03-21 09:36 AM
Re: Need some help with COM
|
Alex.H
Seasoned Scripter
Registered: 2001-04-10
Posts: 406
Loc: France
|
Get a look to KiXGUI manual, especially the object tree. You'll see that the desktop object have the width and height properties. They are your current desktop size. In Radimus's script, Desktop is : $root $form.parent
Edit : here's a sample to center your form on the screen : $root = createobject("KiXGUI.Desktop") $frmSample=$root.createform("frmMain","Centered Form sample") $frmSample.height=300 $frmSample.width=400 $frmSample.Left=($frmSample.parent.width-$frmSample.width) / 2 $frmSample.top=($frmSample.parent.height-$frmSample.height) / 2
What ever the current desktop resolution, your form will always be centered [ 21 March 2002, 14:07: Message edited by: Alex.H ]
_________________________
? getobject(Kixtart.org.Signature)
|
|
Top
|
|
|
|
#85376 - 2002-03-21 04:32 PM
Re: Need some help with COM
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Here's a solution I came up with to dynamically position a form on your screen regardless of what resolution you are using:
$frmSample.top=($root.height-((($root.height)/100)*75))-($frmSample.height/2)
The "75" represents the percentage up from the bottom of the screen you want your form. Works whether you're running at 640x480 or 1260x1024.
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 2312 anonymous users online.
|
|
|