Results 1 to 22 of 22

Thread: Making windows shake.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    240

    Question

    I was messing wit the GetActiveWindow api...and it is prtty cool what it does..but i was curios as to know if it is possible to actually make the whole window shake??

    Cause i know code that can make the form in visual basic shake...

    I am thinking it is possible....anyone have a say on this?

    Thanks.




  2. #2
    Guest

    Question

    Do you mean shake like move it a bit every time?
    Well, you can use the GetActiveWindow API in order to get the hWnd, and then use the MoveWindow API to move it a bit.

    Code:
    Public Declare Function MoveWindow Lib "user32" Alias "MoveWindow" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
    Hope this helps.

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Or you can use the SetWindowPos function.

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    If anyone has used the Acorn RISC OS machines, then they'll know about the !Madness program, which bounced all the windows around the screen. It would be good if we could write a replacement for Windows.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5
    Guest
    Actually you CAN write one for windows.
    You can enumerate the windows using EnumWindows and then looping through the hWnds
    in order to move them.
    But in VB it's gonna be extremely slow.
    Maybe you can do it in C++ or ASM.

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    You kidding??? BASIC on a 60MHz computer with 10 windows open went in real-time...at least mine does (I started it up again this morning for the first time in a few years).
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  7. #7
    New Member
    Join Date
    May 2000
    Posts
    5
    Yo Sophy!

    Why don't you just grab the person's head and start to shake it vigorously then the window will look shaken. Or you can just shake the monitor and you will get the same thing too.
    Joker me!

  8. #8
    Guest
    Actually, that MoveWindow function works great. Here's a little of what you can do with another window. This is an example using the calculator.

    Code:
    Public Declare Function MoveWindow Lib "user32" _
    (ByVal hwnd As Long, ByVal x As Long, ByVal y As _
    Long, ByVal nWidth As Long, ByVal nHeight As Long, _
    ByVal bRepaint As Long) As Long
    
    Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" _
    (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
    
    Private Sub Command1_Click()
    Shell "Calc", vbNormalFocus
    DoEvents
    Dim h
    h = FindWindow(vbNullString, "Calculator")
    If h = 0 Then
    MsgBox "Window was not found!", 16
    Else
    MoveWindow h, 50, 200, 350, 250, hwnd
    Exit Sub
    End If
    End Sub
    That's just a bit of what can be done, but you can randomize the coordinates and the window will shake anywhere.

  9. #9
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I think the !Madness program just bounced the windows around the screen rather than moving them randomly.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  10. #10
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    Note: GetActiveWindow only works with windows withing your thread. GetForegroundWindow is for all Windows. My Favorite is changing the text of the current window to a little joke and then changing back after several seconds. If you use GetDesktopWindow and GetDC you can invert the colors of the desktop, flip it upside down, etc. I love these api's

    Just my $0.02
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  11. #11
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I think there was a Bill Plympton program (with the two guys off the old Nik Naks ad), which had an animated desktop image. I think they must have used that.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  12. #12
    Guest
    Originally posted by gwdash
    Note: GetActiveWindow only works with windows withing your thread. GetForegroundWindow is for all Windows. My Favorite is changing the text of the current window to a little joke and then changing back after several seconds. If you use GetDesktopWindow and GetDC you can invert the colors of the desktop, flip it upside down, etc. I love these api's

    how do you do this?

  13. #13
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Use GetDesktopWindow to get the desktop's hWnd, then use GetDC to obtain the DC for the desktop. Then BitBlt away!
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    240

    Talking haha good one joker..

    Or i could just drink beer till i get near passing out and it will spin that way..
    but i dont think the people that use my program will want to do it that way!!! hahaha


    This is cool..you can actually turn the desktop upside down?
    haha awesome!

  15. #15
    New Member
    Join Date
    May 2000
    Posts
    5
    I like a person who can take a joke, hahahaha, because I am the JE-ZOKER!!!!
    Joker me!

  16. #16
    Hyperactive Member
    Join Date
    Jul 2000
    Posts
    352

    Talking

    You could use the windows API call shake windows vigourously:
    Private Shakewindows "kernel 35.3" (shakefactor as shakability)

  17. #17
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169

    Cool Hmm

    Interesting addition...what else do people think that M$ should add to the API?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  18. #18
    Guest
    after you use BitBlt on the desktop
    how do you get it back to normal?

  19. #19
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    What about InvalidateRect?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  20. #20
    Guest

    Talking Check this one

    Look what I just dug up:

    Code:
    Public Declare Function FixAllWindowsBugs Lib "imagination.dll" Alias "MSAsIf" (SuccessFactor As Zero) As Long
    I tried it.
    Unfortunately (but not surprisingly) it didn't work.
    Hehe...

    Any other APIs?

  21. #21
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Code:
    Private Declare Function DojCompliance "ms_guff.dll" Alias "WhenHellFreezesOver" (RemoveIE As Boolean) As False
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  22. #22
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    You hoodlums should really request the feautures at microsoft!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width