Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Start/Stop default screensaver from VB Code 2

Status
Not open for further replies.

JRVoyager

Programmer
Jun 18, 2003
15
SE
Hi
I'm writing a small application that will be used to welcome visitors to our company. The thought is to mount a TFT Screen on a wall and present our visitors on that screen.
But when no visitors are "available" is it not so nice to show a blank screen. So my intention is to find a nice screensaver that will be visible during times with no visitors and when visitors will be present is the "Welcome" page visible.

I have been able to get the screensaver to start if there is no visitors available, but how to i disabel the same without need to move the mouse or tap a key ?

Code used:
Code:
    Private Declare Function GetDesktopWindow Lib "user32" () As Integer
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByRef lParam As Integer) As Integer

    Const WM_SYSCOMMAND As Integer = &H112
    Const SC_SCREENSAVE As Integer = &HF140

    Protected Sub StartScreenSaver(ByVal blnTrigger As Boolean)
        ' Calls for screensaver
        Dim hWnd As Integer
        hWnd = GetDesktopWindow()
        SendMessage(hWnd, WM_SYSCOMMAND, SC_SCREENSAVE, blnTrigger)
    End Sub
And this code to call the screensaver sub:
Code:
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
        ' Determins if screensaver or datagrid shall be presented
        ' Gerth Ericsson 2006-09-14
        '
        ' ***********************************************************************
        ' *
        ' ***********************************************************************

        If Repeater2.Items.Count = 0 Then
            Call StartScreenSaver(False)    ' Turns off screensaver as visitors exist to show.

        Else
            Call StartScreenSaver(True)    ' Starts screensaver as there is no visitors to show.
        End If
    End Sub

Whats happening is that i refresh the "Welcome" page with an intervall of 5 minutes, and looks on the "Repeater.item.count" value to determine wich parameter to send and even if there is items to show so will not the screensaver stop - and i can't figure out why

The code is VB and i use ASP.NET 2.0 for the application

 
hi,

where exactly must this screensaver activate? because using ASP.NET you cannot access the end users's system directly (you may have to use ActiveX controls and the sort)...

Known is handfull, Unknown is worldfull
 
Hi Vbkris

Here comes a bit more "wordfull" explanation.

The idea with this application is to use an asp.net 2.0 website, why? just because the neat functions for database use, as the application also handles registration/deletion of visitors in a database.
My intention is to use a thin client with Xpe operation system installed. This client will have the only option to start a predefined webb page that's showing a screen with "Welcome to...." and the names on our visitors for that day.
By using the webpage:s unload event can I find out if the recordset (Repeater2 in above code) contains any records, if so will the page show, if not shall the screensaver come on.
I will then use a refresh on the "Welcome page" to reload the page and by that also populate the recordset again to see if any visitors has been added.
Now comes the point where the the screensaver might be taken out/killed depending on if the recordset contains any records or not.

Hope this clears your question out.

Regards

Gerth
 
Is the machine that displays the web page also the same machine that runs the web server?

Also, why use a screensaver at all? Wouldn't a simple gif suffice? You can then show the page if any visitors are due, or show the gif if they are not.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
hi,

my understanding is this:

-> User comes to a terminal where this web page will open.
-> The "Welcome To" page opens.
-> Based on the repeater info on the web page some action need to be done.
-> If there are no records then a screen saver must open in the terminal where the user browses the page from.

correct?

if i that is right, then what i say stands.

however it MAY be overcome using JavaScript (ActivX Access Methods). I really dont know what the ActiveX Command is to invoke a screensaveer(If you know how to do the same in VB using ActiveX then i guess the same will apply).

I am suggesting this as a solution because I am assuming that you get to CONTROL the dumb terminal's IE settings (Allow execution of such JavaScripts)...

Known is handfull, Unknown is worldfull
 
Hi ca8msm & vbcris
I'll give my response in the same reply, hope it's ok-

ca8msm
No the Thin client can't contain any web server, it just a "dumb" terminal, it will just browse a page on our internal web server. The idea about using a screensaver comes from that i'm very attracted to this screensaver and i would use it if i get this to work as it would give a nice atmosphere to the reception area.

vbcris
You are partly correct, sorry for my english and tries to explain with easy words.
The terminal and welcome screen will be online 24x7 and is placed in our reception area. The visitor will have no interaction to the screen/terminal.
As other users inside the our orginisation will be reponsible to fill in there visitors into a database, has i created a web form for them to fill in. By doing this can they add visitors for in advance for day or week/weekks.
The refresh of the welcome screen/datarepeater will then query the database (date and time as key fields) and depending on if visitors are due or not switch between the welcome page and the screensaver.

So if we will have a visitor this day will the welcome screen be on, if no visitors "available" will the screensaver in form of the Aquarium be visible.

Good ambition, hard to get working ;-(

/Gerth
 
>>So if we will have a visitor this day will the welcome screen be on, if no visitors "available" will the screensaver in form of the Aquarium be visible.

so, the screen saver must be activated from the browser right?

there is a fullscreen mode popup mode available in javascript (forgot that) for IE browsers.

if there are no records, open a fullscreen mode popup that will have a HTML file with a flash file (good for effects).

it will look like a screen saver. and you can write code in the popup to close itself if any entries are found in the parent window (using opener command).

i guess that is as close that i can come to this...

Known is handfull, Unknown is worldfull
 
If the actual terminal doesn't contain the web server then your screensaver code won't work. The code will be executed on the web server and will cause the scrrensaver to launch on that machine, not the client.

You can either write an ActiveX component to launch the client's screensaver (but you will have to use Internet Explorer as the browser and give the browser permissions to launch that component) or you could simply use the gif solution I mentioned (which is a much easier option and very simply to acheive).


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Hi again.

Oopps, here comes a couple of arguments i can't question, actually never thought about where the code is executed as i tested on my own developement computer with a webserver on , runat="server" -> why have i not reflected on this, it stand i cleartype on the screen [ponder]

It seems like it time to drop this screensaver approach and rethink my second choice on this matter, using the asp.net add rotator to show a "slideshow" of pictures instead, as i have no knowledge about ActiveX or javascript

Thanks for you time and help folks

/Gerth
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top