KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

How to logoff user...

 
Post new topic   Reply to topic    KiXforms Forum Index -> Advanced Scripting
View previous topic :: View next topic  
Author Message
kikieh
KiXforms Follower
KiXforms Follower


Joined: 05 Jun 2006
Posts: 21
Location: Brazil - Sao Paulo

PostPosted: Mon Jun 05, 2006 2:02 pm    Post subject: How to logoff user... Reply with quote

Hi there,

I'm searching how to push the user to logoff if he tries to close the form via any key.

Thanks.
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Mon Jun 05, 2006 2:15 pm    Post subject: Reply with quote

Hi kikieh,
and welcome to KiXforms.

if you would post the script you are working with it would be much easier for us to help you out.

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
kikieh
KiXforms Follower
KiXforms Follower


Joined: 05 Jun 2006
Posts: 21
Location: Brazil - Sao Paulo

PostPosted: Mon Jun 05, 2006 2:18 pm    Post subject: Reply with quote

Thanks a lot for welcoming me.

Here you are.

Debug OFF
Break ON
SetConsole("Hide")

; Form Basics
$Form = CreateObject("Kixtart.Form")
$Form.Caption = "Net Conn"
$Form.ScaleHeight = 638
$Form.ScaleWidth = 804
$Form.FontName = "Arial"
$Form.FontSize = 9
$Form.Center
$Form.SysMenu = 0
$Form.Resizable = 0
$Form.backcolor = White
$Form.SetFocus

; Frame Details
$FrameDetails = $Form.Frame("")
$FrameDetails.Height = 520
$FrameDetails.Left = 8
$FrameDetails.Top = 105
$FrameDetails.Width = 790

$LabelInfo = $FrameDetails.Label("Info:")
$LabelInfo.Width = 90
$LabelInfo.Left = $TextInfo.Left - $LabelInfo.Width
$LabelInfo.Top = $TextInfo.Top
$LabelInfo.FontSize = 10
$LabelInfo.FontBold = 1


; Banner Details
$FrameBanner = $Form.PictureBox
$FrameBanner.BackColor = $Form.RGB(255,255,255)
$FrameBanner.Height = 80
$FrameBanner.Left = 10
$FrameBanner.Top = 10
$FrameBanner.Width = 785

; Banner Picture
$PictureBanner = $FrameBanner.Image
$PictureBanner.Picture = "%WINDIR%\System32\shell32.dll;18"
$PictureBanner.Height = 60
$PictureBanner.Left = 5
$PictureBanner.Top = 5
$PictureBanner.Width = 60

$FrameBanner.FontSize = 24
$FrameBanner.ForeColor = $Form.RGB(0,100,100)
$FrameBanner.PrintXY(70,0,"Welcome @FULLNAME")
$FrameBanner.FontSize = 20
$FrameBanner.FontName = "lucida"
$FrameBanner.ForeColor = 0
$FrameBanner.FontBold = 1
$FrameBanner.FontBold = 0
$FrameBanner.FontSize = 10
$FrameBanner.ForeColor = $Form.RGB(0,50,200)
$FrameBanner.PrintXY(70,40,"Logon Date: @MdayNo/@Month/@Year")
$FrameBanner.PrintXY(70,56,"Logon Time: @Time")

; Exit Button
$CmdConcordo = $FrameDetails.CommandButton("I Agree")
$CmdConcordo.FontName = "Arial"
$CmdConcordo.FontSize = 10
$CmdConcordo.FontBold = 1
$CmdConcordo.Top = 495
$CmdConcordo.Width = 100
$CmdConcordo.Height = 19
$CmdConcordo.Left = 685
$CmdConcordo.OnClick = "quit()"

; Execute Form
$Form.Show
$TextBoxUsername.SetFocus

While $Form.Visible
$=Execute($Form.DoEvents)
Loop
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Mon Jun 05, 2006 3:41 pm    Post subject: Reply with quote

you should put your code between code tags, it makes it easier to read.

I have modified your code a little, is this what you are looking for?

Code:

;if you use wkix32.exe rather than kix32.exe you will not have a command box pop up and you won't have to hide the console
;Debug OFF
;SetConsole("Hide")

Break On
$System = CreateObject("Kixtart.System")
;This is an error check to see if KiXforms is installed on the machine that is running the script
If Not $System
   $= MessageBox("KiXforms Not Initiated. This Script Will Now Close.","Error",16)
   Quit()
EndIf


; Form Basics
$Form = $System.Form()
$Form.Caption = "Net Conn"
$Form.ScaleHeight = 638
$Form.ScaleWidth = 804
$Form.FontName = "Arial"
$Form.FontSize = 9
$Form.Center
$Form.SysMenu = 0
$Form.Resizable = 0
$Form.backcolor = White
$Form.SetFocus
$Form.OnClosing = "CloseWarning()"

; Frame Details

;should use a groupbox rather than a frame (the frame control is an old control and replaced with the groupbox)
;$FrameDetails = $Form.Frame("")
$FrameDetails = $Form.Controls.GroupBox("Info:")
$FrameDetails.Height = 520
$FrameDetails.Left = 8
$FrameDetails.Top = 105
$FrameDetails.Width = 790

;if you use the groupbox you will not need this label
;$LabelInfo = $FrameDetails.Controls.Label("Info:")
;$LabelInfo.Width = 90
;$LabelInfo.Left = $TextInfo.Left - $LabelInfo.Width
;$LabelInfo.Top = $TextInfo.Top
;$LabelInfo.FontSize = 10
;$LabelInfo.FontBold = 1

; Banner Details
$FrameBanner = $Form.Controls.PictureBox()
$FrameBanner.BackColor = $Form.RGB(255,255,255)
$FrameBanner.Height = 80
$FrameBanner.Left = 10
$FrameBanner.Top = 10
$FrameBanner.Width = 785

; Banner Picture
$PictureBanner = $FrameBanner.Image()
$PictureBanner.Picture = "%WINDIR%\System32\shell32.dll;18"
$PictureBanner.Height = 60
$PictureBanner.Left = 5
$PictureBanner.Top = 5
$PictureBanner.Width = 60

$FrameBanner.FontSize = 24
$FrameBanner.ForeColor = $Form.RGB(0,100,100)
$FrameBanner.PrintXY(70,0,"Welcome @FULLNAME")
$FrameBanner.FontSize = 20
$FrameBanner.FontName = "lucida"
$FrameBanner.ForeColor = 0
$FrameBanner.FontBold = 1
$FrameBanner.FontBold = 0
$FrameBanner.FontSize = 10
$FrameBanner.ForeColor = $Form.RGB(0,50,200)
$FrameBanner.PrintXY(70,40,"Logon Date: @MdayNo/@Month/@Year")
$FrameBanner.PrintXY(70,56,"Logon Time: @Time")

; Exit Button
$CmdConcordo = $FrameDetails.Controls.CommandButton("I Agree")
$CmdConcordo.FontName = "Arial"
$CmdConcordo.FontSize = 10
$CmdConcordo.FontBold = 1
$CmdConcordo.Top = 495
$CmdConcordo.Width = 100
$CmdConcordo.Height = 19
$CmdConcordo.Left = 685
$CmdConcordo.OnClick = "CloseForm()"

; Execute Form
$TextBoxUsername.SetFocus
$Form.Show

While $Form.Visible
   $= Execute($Form.DoEvents())
Loop

Function CloseForm()
   Quit()
EndFunction

Function CloseWarning()
   $Return = MessageBox("You must click the 'I Agree' button in order to proceed."+@CRLF+"You may click 'Yes' to logoff or click 'No' To return to the form","Error",262164)
   If $Return = 6
      $WMIService = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\" + @WKSTA + "\root\cimv2")
      $OperatingSystems = $WMIService.ExecQuery("Select * from Win32_OperatingSystem")
      For Each $OperatingSystem in $OperatingSystems
         $OperatingSystem.Win32Shutdown(4)
      Next
   Else
      Return
   EndIf
EndFunction

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
kikieh
KiXforms Follower
KiXforms Follower


Joined: 05 Jun 2006
Posts: 21
Location: Brazil - Sao Paulo

PostPosted: Mon Jun 05, 2006 3:56 pm    Post subject: Reply with quote

Cool! Thank works fine for me.
Sorry for asking this, but I'm really new to Kix stuff, so... what should I do to just log off and don't ask for a user interaction?
Back to top
View user's profile Send private message
kikieh
KiXforms Follower
KiXforms Follower


Joined: 05 Jun 2006
Posts: 21
Location: Brazil - Sao Paulo

PostPosted: Mon Jun 05, 2006 4:02 pm    Post subject: Reply with quote

[quote="kikieh"]Cool! Thank works fine for me.
Sorry for asking this, but I'm really new to Kix stuff, so... what should I do to just log off and don't ask for a user interaction?[/quote]

Forget about it, just found out, thanks a lot Smile
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Mon Jun 05, 2006 4:06 pm    Post subject: Reply with quote

glad i could help.
_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
kikieh
KiXforms Follower
KiXforms Follower


Joined: 05 Jun 2006
Posts: 21
Location: Brazil - Sao Paulo

PostPosted: Mon Jun 05, 2006 4:21 pm    Post subject: Reply with quote

Friend, if the user closes via Task Manager this function does not take effect... any idea?
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Mon Jun 05, 2006 4:25 pm    Post subject: Reply with quote

take away the task manager, sorry that is not ment to sound rude, but afaik, you can not control anything that is outside the form or not preconfigured for the user profile. but you could ask over here at KiXtart.org
_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
kikieh
KiXforms Follower
KiXforms Follower


Joined: 05 Jun 2006
Posts: 21
Location: Brazil - Sao Paulo

PostPosted: Mon Jun 05, 2006 4:32 pm    Post subject: Reply with quote

I don't take that as rude, don't worry. I understood that I was asking in the wrong forum, will do the right thing now that I was directed correctly.

Thanks a lot.
Back to top
View user's profile Send private message
tnrednack
KiXforms Dabbler
KiXforms Dabbler


Joined: 05 Sep 2006
Posts: 5

PostPosted: Fri Dec 01, 2006 8:25 pm    Post subject: user log off Reply with quote

Hey guys i am doing something very similar to this and i was just curious.. is there a way to add a time limit to this. So say if the user doesnt respond in a said amount of time, it simply excutes anyway.
Thanks
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Fri Dec 01, 2006 10:35 pm    Post subject: Reply with quote

You should not hijack some else's post, its best for you to create your own and reference this post with a link.

I think we can help you out, create a new post, reference this one and post your code so we can better help you.

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
kikieh
KiXforms Follower
KiXforms Follower


Joined: 05 Jun 2006
Posts: 21
Location: Brazil - Sao Paulo

PostPosted: Tue Dec 19, 2006 1:55 pm    Post subject: Re: user log off Reply with quote

tnrednack wrote:
Hey guys i am doing something very similar to this and i was just curious.. is there a way to add a time limit to this. So say if the user doesnt respond in a said amount of time, it simply excutes anyway.
Thanks


Hi tnrednack, yes, there is a way, let me know when you create your new post and then I can try to help.

Regards.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Advanced Scripting All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group