|
-
Mar 26th, 2005, 12:28 PM
#1
Thread Starter
Junior Member
A programm that works in backgroud, has to open a screensaver, if I press a key
At our big eaveningshow there's one sequence where a matrixscreensaver has to apear. The screen is beamed onto a big wall, so there can't be something of windows, like the little thing, that aperas then you press alt+tab, and there can't be a mousepointer.
The easyest way for me, the manager of the computer and the beamer, is to code something that makes the screensaver apear if I press a key and makes it disapear when I press an other key.
I don't have an idea how to begin programming that thing.
Does someone have an idea how to do a programm like that?
(I don't want to programm a screensaver, just a programm to starts and ends the screensaver)
www.ironmodders.ch.vu
.
Last edited by Brainhacker12; Mar 26th, 2005 at 12:44 PM.
-
Mar 26th, 2005, 12:41 PM
#2
Lively Member
Re: A programm that works in backgroud, has to open a screensaver, if I press a key
just download a screensaver maker. I recommend 123 Screensaver Maker. It rockz
But if you just want to program it, then i cant help you about screensavers. =/
-
Mar 26th, 2005, 12:44 PM
#3
Re: A programm that works in backgroud, has to open a screensaver, if I press a key
Screen saver is just another program so if you want to launch it upon pressing some key combination then here is a sample:
VB Code:
Private Sub Form_Load()
Me.KeyPreview = True
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If Shift = vbAltMask And KeyCode = vbKeyTab Then
Shell "notepad" 'provide full path to your program instead
End If
End Sub
NOTE: making a screen saver is completely different issue.
-
Mar 27th, 2005, 04:44 PM
#4
Thread Starter
Junior Member
Re: A programm that works in backgroud, has to open a screensaver, if I press a key
If the application got the focus your solution works very good. But that's not the thing I wanted.
The application have to work in tha background. and so the application won't have the focus.
Any ideas how to do it, if the programm don't have the focus?
-
Mar 27th, 2005, 04:53 PM
#5
Fanatic Member
Re: A programm that works in backgroud, has to open a screensaver, if I press a key
You don't actually need focus, just have that program running invisibly (me.hide). Then, you could either have a timer or something checking for a certain keystroke (getasynckeystate API) or you could do this:
VB Code:
Private Declare Function SetCapture Lib "user32" ( _
ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32.dll" () As Long
Private Sub Form_Load()
SetCapture Me.hwnd
End Sub
With that method anywhere you click will be taken as a click to the form, just be sure to releasecapture when you're done. There are a whole ton of other methods you could use too, but those seem to be pretty good from my viewpoint.
-
Mar 28th, 2005, 07:50 AM
#6
Thread Starter
Junior Member
Re: A programm that works in backgroud, has to open a screensaver, if I press a key
I don't know if I'm to stupide or what's going on. But these codes don't work.
VB Code:
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32.dll" () As Long
Private Sub Form_Load()
SetCapture Me.hwnd
ReleaseCapture
Me.KeyPreview = True
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 69 Then '69 stands for the key "e"
Shell "notepad"
End If
End Sub
If the Form is in background or is minimized it doesn't work. www.ironmodders.ch.vu
-
Mar 28th, 2005, 09:05 AM
#7
Re: A programm that works in backgroud, has to open a screensaver, if I press a key
Use a keyboard hook. If you have a callback function, you can treat it like an event. API-Guide has a good example of how to do this, as does Codeguru.
http://www.codeguru.com/Cpp/W-P/syst...cle.php/c5699/
[EDIT]
The Codegure example is C, below is the VB example:
http://www.developer.com/net/vb/article.php/1502401
Last edited by Comintern; Mar 28th, 2005 at 09:08 AM.
Reason: Whoops!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|