|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to Use a Screen Saver app within My Application?Hey All,
I was wondering if anyone has done or knows how to use a screen saver within a VB app (i.e. display a running screen saver on a form or child window like the 'Preview' functionality in the Control Panel)? Thanks & Regards, TC On Wed, 24 May 2006 06:26:52 -0400, "TCook" <getmyemai***@yahoo.com> Try starting the screensaver app with ' /p nnnn' as command tail,wrote: > >I was wondering if anyone has done or knows how to use a screen saver within >a VB app (i.e. display a running screen saver on a form or child window like >the 'Preview' functionality in the Control Panel)? where nnnn is the hwnd of the "preview" window, i.e. Shell "MySaver.scr /p " & Me.hwnd -Tom MVP - Visual Basic (please post replies to the newsgroup) Once launched, how can the screensaver be terminated programmatically?
Show quoteHide quote "Tom Esh" <tjeshGibber***@suscom.net> wrote in message news:520972t9iq47aqstalm891m2dhfcdn97ho@4ax.com... > On Wed, 24 May 2006 06:26:52 -0400, "TCook" <getmyemai***@yahoo.com> > wrote: > >> >>I was wondering if anyone has done or knows how to use a screen saver >>within >>a VB app (i.e. display a running screen saver on a form or child window >>like >>the 'Preview' functionality in the Control Panel)? > > Try starting the screensaver app with ' /p nnnn' as command tail, > where nnnn is the hwnd of the "preview" window, i.e. > Shell "MySaver.scr /p " & Me.hwnd > > > > -Tom > MVP - Visual Basic > (please post replies to the newsgroup) Interesting, can we do the same for an application? Kind of make like a
container for our executed application? Show quoteHide quote "Tom Esh" <tjeshGibber***@suscom.net> wrote in message news:520972t9iq47aqstalm891m2dhfcdn97ho@4ax.com... > On Wed, 24 May 2006 06:26:52 -0400, "TCook" <getmyemai***@yahoo.com> > wrote: > >> >>I was wondering if anyone has done or knows how to use a screen saver >>within >>a VB app (i.e. display a running screen saver on a form or child window >>like >>the 'Preview' functionality in the Control Panel)? > > Try starting the screensaver app with ' /p nnnn' as command tail, > where nnnn is the hwnd of the "preview" window, i.e. > Shell "MySaver.scr /p " & Me.hwnd > > > > -Tom > MVP - Visual Basic > (please post replies to the newsgroup) +Vice wrote:
>>> I was wondering if anyone has done or knows how to use a screen Depends. It's in the screensaver spec, that if they're passed /p and an>>> saver within >>> a VB app (i.e. display a running screen saver on a form or child >>> window like >>> the 'Preview' functionality in the Control Panel)? >> >> Try starting the screensaver app with ' /p nnnn' as command tail, >> where nnnn is the hwnd of the "preview" window, i.e. >> Shell "MySaver.scr /p " & Me.hwnd > > Interesting, can we do the same for an application? Kind of make > like a container for our executed application? hWnd, they are supposed to show a "preview" of their handicraft there. If other apps are written to do similar, then sure. (Since I'm not aware of any other application category that behaves similarly, though, I'm sure the answer is most likely "probably not.") TCook wrote:
> I was wondering if anyone has done or knows how to use a screen saver Here ya go:> within a VB app (i.e. display a running screen saver on a form or > child window like the 'Preview' functionality in the Control Panel)? Shell "sspipes.scr /p " & CStr(Picture1.hWnd) Thanks a bunch guys!
Show quoteHide quote "Karl E. Peterson" <k***@mvps.org> wrote in message news:OQJafw0fGHA.4172@TK2MSFTNGP04.phx.gbl... > TCook wrote: >> I was wondering if anyone has done or knows how to use a screen saver >> within a VB app (i.e. display a running screen saver on a form or >> child window like the 'Preview' functionality in the Control Panel)? > > Here ya go: > > Shell "sspipes.scr /p " & CStr(Picture1.hWnd) > > -- > Working without a .NET? > http://classicvb.org/ > > Once launched, how can the screensaver be terminated programmatically?
Show quoteHide quote "Karl E. Peterson" <k***@mvps.org> wrote in message news:OQJafw0fGHA.4172@TK2MSFTNGP04.phx.gbl... > TCook wrote: >> I was wondering if anyone has done or knows how to use a screen saver >> within a VB app (i.e. display a running screen saver on a form or >> child window like the 'Preview' functionality in the Control Panel)? > > Here ya go: > > Shell "sspipes.scr /p " & CStr(Picture1.hWnd) > > -- > Working without a .NET? > http://classicvb.org/ > > TCook wrote:
> Once launched, how can the screensaver be terminated programmatically? Easiest way: Close the window to which it's attached.Another likely way: Many screensavers will create their own window to draw upon, and make this a child of the window passed on the command line when invoked in preview mode. You could try enumerating the children of the passed window, and sending WM_CLOSE. Hey Karl,
I actually need the window to stay open so closing the form wouldn't work. I tried sending WM_CLOSE but to the PictureBox and it closed the form and closed my application with it ;-) What I was hoping to do was simply end the process similar to ending the process from the task manager but APIs I tried didn't stop it. Any ideas there? Thanks, TC Show quoteHide quote "Karl E. Peterson" <k***@mvps.org> wrote in message news:e0W85uBgGHA.4172@TK2MSFTNGP04.phx.gbl... > TCook wrote: >> Once launched, how can the screensaver be terminated programmatically? > > Easiest way: Close the window to which it's attached. > > Another likely way: Many screensavers will create their own window to draw > upon, and make this a child of the window passed on the command line when > invoked in preview mode. You could try enumerating the children of the > passed window, and sending WM_CLOSE. > -- > Working without a .NET? > http://classicvb.org/ > > TCook wrote:
>>> Once launched, how can the screensaver be terminated Don't send it to the picture box! Send it to the *child* of the picture>>> programmatically? >> >> Easiest way: Close the window to which it's attached. >> >> Another likely way: Many screensavers will create their own window >> to draw upon, and make this a child of the window passed on the >> command line when invoked in preview mode. You could try >> enumerating the children of the passed window, and sending WM_CLOSE. > > I actually need the window to stay open so closing the form wouldn't > work. I tried sending WM_CLOSE but to the PictureBox and it closed > the form and closed my application with it ;-) box. You'll need to use EnumChildWindows to find this. Or, probably just as easily, GetWindow -- *assuming* you're not dealing with a VB-authored screensaver. It's certainly possible that multiple windows may be parented to your picturebox, although this is unlikely unless you're totally not paying attention. (Not sure why I felt the need to say that. <g>) At any rate, this works here: Option Explicit Private Declare Function GetWindow Lib "user32" (ByVal hWnd As Long, ByVal wCmd As Long) As Long Private Const GW_CHILD As Long = 5 Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Const WM_CLOSE As Long = &H10 Private Sub cmdStart_Click() Shell "sspipes.scr /p " & CStr(Picture1.hWnd) End Sub Private Sub cmdStop_Click() Dim hWndPreview As Long hWndPreview = GetWindow(Picture1.hWnd, GW_CHILD) SendMessage hWndPreview, WM_CLOSE, 0&, ByVal 0& End Sub > What I was hoping to do was simply end the process similar to ending DON'T DO THAT! Huge Hammer; Petty Problem.> the process from the task manager but APIs I tried didn't stop it. > Any ideas there? Later... Karl Hey Karl,
Go it! Thanks for the help ;-) Regards, TC Show quoteHide quote "Karl E. Peterson" <k***@mvps.org> wrote in message news:%23lMU7CDgGHA.4276@TK2MSFTNGP03.phx.gbl... > TCook wrote: >>>> Once launched, how can the screensaver be terminated >>>> programmatically? >>> >>> Easiest way: Close the window to which it's attached. >>> >>> Another likely way: Many screensavers will create their own window >>> to draw upon, and make this a child of the window passed on the >>> command line when invoked in preview mode. You could try >>> enumerating the children of the passed window, and sending WM_CLOSE. >> >> I actually need the window to stay open so closing the form wouldn't >> work. I tried sending WM_CLOSE but to the PictureBox and it closed >> the form and closed my application with it ;-) > > Don't send it to the picture box! Send it to the *child* of the picture > box. You'll need to use EnumChildWindows to find this. Or, probably just > as easily, GetWindow -- *assuming* you're not dealing with a VB-authored > screensaver. It's certainly possible that multiple windows may be > parented > to your picturebox, although this is unlikely unless you're totally not > paying attention. (Not sure why I felt the need to say that. <g>) At any > rate, this works here: > > Option Explicit > > Private Declare Function GetWindow Lib "user32" (ByVal hWnd As Long, > ByVal wCmd As Long) As Long > Private Const GW_CHILD As Long = 5 > > Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" > (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As > Any) As Long > Private Const WM_CLOSE As Long = &H10 > > Private Sub cmdStart_Click() > Shell "sspipes.scr /p " & CStr(Picture1.hWnd) > End Sub > > Private Sub cmdStop_Click() > Dim hWndPreview As Long > hWndPreview = GetWindow(Picture1.hWnd, GW_CHILD) > SendMessage hWndPreview, WM_CLOSE, 0&, ByVal 0& > End Sub > >> What I was hoping to do was simply end the process similar to ending >> the process from the task manager but APIs I tried didn't stop it. >> Any ideas there? > > DON'T DO THAT! Huge Hammer; Petty Problem. > > Later... Karl > -- > Working without a .NET? > http://classicvb.org/ > >
Xcopy Install of VB Classic Application
DataRelation vs DataView.RowFilter property Creating a "Back" button in VB.Net/ASP.Net Project won't run from network drive. Wierd .NET Debugging behavior... Referencing Images... application.exit( ) Applying word styles using VB .Net using up too much memory and is slow Comparing Two DataTables How to find all CD/DVD & CD/DVD-RW drives? |
|||||||||||||||||||||||