ruyluis
asked on
Preview and Password Button
I made a Screen Saver and now, how can I put the Bitmap in the preview and anable the password button in the W95 properties dialog box?
ASKER
To veroland
I tried out with that. It works just fine like a screen saver. Actual problem is I also could not able to show the preview to be displayed.
I tried out with that. It works just fine like a screen saver. Actual problem is I also could not able to show the preview to be displayed.
ASKER
Thank you, Veroland. But I want to know how to make this by myself. I know That's possible using Bitblt function. The first parameter of this function is the destination of a Bitmap, or better, the preview. But I didn't discover what is this first parameter! And the password button, i just can't enable it.
ASKER
What is this? I just didn't write the comment added at june-04-98 3:19 pm!!! Who wrote?
xiii
ASKER
Here are the functions you would need to allow you to hit the Preview button and use the Password Option.
You must call CleanExit on a mousemove or keypress event.
Declare Function VerifyScreenSavePwd Lib "PASSWORD.CPL" () As Long
Declare Function PwdChangePassword Lib "MPR.DLL" Alias "PwdChangePasswordA" (ByVal lpProvider As String, ByVal hWnd As Long, ByVal dwFlags As Long) As Long
Sub Startup()
' This routine initializes the entire program.
' It is called once - at program start, after the main form is loaded
' and the check for other copies has been done
On Error GoTo Startup_err ' try to handle errors cleanly
Data_Dir$ = App.Path ' default data dir of where the .scr is, otherwise
' the open dialog box will have nothing.
CallingArguments$ = Command$ ' save the calling arguments to the program
' the calling arguments can be:
' /p = inside the preview window
' /c = options button selected
If Left(CallingArguments$, 2) = "/p" Then ' called from inside the preview window
Call PreviewDisplay
End If
' if it was not inside the preview display then either the program was called
' or the setup was called, either way we need to get the config info
Call GetINInfo ' Get the necessary info from the .INI file
If CallingArguments$ = "/c" Then ' options button pressed, show setup dialog
Setup.Text1.Text = Data_Dir$
Setup.Show 1
End If
' if got here then a normal program start
lx = ShowCursor(False) ' hide the cursor
Main_Form.Show ' show the maximized main screen
gMouseX = -1 ' set mouse value so mousemove routine will know what to do
gMouseY = -1
Exit Sub
Startup_err: ' an error occured, exit cleanly
CleanExit
End Sub
Public Sub PreviewDisplay()
' this routine displays a form in the little screen saver preview display
' note: code based on source by Jeff Hack
' the preview window handle will be in the right 3 chars of the calling arguments
Dim Temp%, PrevHWND As Long
' note we don't show the "Main_Form" here as it tries to maximize itself
' against the entire screen and besides a mouse move/key press could end the
' display instead of clicking on a button.
PrevHWND = CLng(Right$(Command$, Len(Command$) - 3))
Temp% = SetParent(PreviewForm.Pict ure1.hwnd, PrevHWND) 'set active window to the preview window
' show the graphic in the window, this is a static display but
' a active one could be done here
PreviewForm.Picture1.Left = 0
PreviewForm.Picture1.Top = 0
DoEvents 'allow Windows to check for other events
Do While IsWindowVisible(PrevHWND) <> 0 ' wait around until the window dissapears (ok or cancel)
DoEvents 'allow Windows to check for other events
Loop
End
End Sub
Sub CleanExit()
If InCleanExit = False Then
InCleanExit = True
If VerifyScreenSavePwd = 1 Then
' this routine exits the program cleanly
' turn the cursor back on
lx = ShowCursor(True)
' Turn back on Windows desire to start another screen saver
lx = SystemParametersInfo(SPI_S ETSCREENSA VEACTIVE, 1, ByVal 0&, 0)
InCleanExit = False
' note, optionally put in a error dialog box here.
End
End If
InCleanExit = False
End If
End Sub
You must call CleanExit on a mousemove or keypress event.
Declare Function VerifyScreenSavePwd Lib "PASSWORD.CPL" () As Long
Declare Function PwdChangePassword Lib "MPR.DLL" Alias "PwdChangePasswordA" (ByVal lpProvider As String, ByVal hWnd As Long, ByVal dwFlags As Long) As Long
Sub Startup()
' This routine initializes the entire program.
' It is called once - at program start, after the main form is loaded
' and the check for other copies has been done
On Error GoTo Startup_err ' try to handle errors cleanly
Data_Dir$ = App.Path ' default data dir of where the .scr is, otherwise
' the open dialog box will have nothing.
CallingArguments$ = Command$ ' save the calling arguments to the program
' the calling arguments can be:
' /p = inside the preview window
' /c = options button selected
If Left(CallingArguments$, 2) = "/p" Then ' called from inside the preview window
Call PreviewDisplay
End If
' if it was not inside the preview display then either the program was called
' or the setup was called, either way we need to get the config info
Call GetINInfo ' Get the necessary info from the .INI file
If CallingArguments$ = "/c" Then ' options button pressed, show setup dialog
Setup.Text1.Text = Data_Dir$
Setup.Show 1
End If
' if got here then a normal program start
lx = ShowCursor(False) ' hide the cursor
Main_Form.Show ' show the maximized main screen
gMouseX = -1 ' set mouse value so mousemove routine will know what to do
gMouseY = -1
Exit Sub
Startup_err: ' an error occured, exit cleanly
CleanExit
End Sub
Public Sub PreviewDisplay()
' this routine displays a form in the little screen saver preview display
' note: code based on source by Jeff Hack
' the preview window handle will be in the right 3 chars of the calling arguments
Dim Temp%, PrevHWND As Long
' note we don't show the "Main_Form" here as it tries to maximize itself
' against the entire screen and besides a mouse move/key press could end the
' display instead of clicking on a button.
PrevHWND = CLng(Right$(Command$, Len(Command$) - 3))
Temp% = SetParent(PreviewForm.Pict
' show the graphic in the window, this is a static display but
' a active one could be done here
PreviewForm.Picture1.Left = 0
PreviewForm.Picture1.Top = 0
DoEvents 'allow Windows to check for other events
Do While IsWindowVisible(PrevHWND) <> 0 ' wait around until the window dissapears (ok or cancel)
DoEvents 'allow Windows to check for other events
Loop
End
End Sub
Sub CleanExit()
If InCleanExit = False Then
InCleanExit = True
If VerifyScreenSavePwd = 1 Then
' this routine exits the program cleanly
' turn the cursor back on
lx = ShowCursor(True)
' Turn back on Windows desire to start another screen saver
lx = SystemParametersInfo(SPI_S
InCleanExit = False
' note, optionally put in a error dialog box here.
End
End If
InCleanExit = False
End If
End Sub
ASKER
n
ASKER
I'm sorry, Tward!! Did you see what happened? There some kind of hacker invading my space and i just couldn't see your answer( a perfect answer) and now I'm asking to Customer servicer how can I give the points to you. Thank you a lot!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hope this helps.