home *** CD-ROM | disk | FTP | other *** search
/ C/C++ User's Journal & Wi…eveloper's Journal Tools / C-C__Users_Journal_and_Windows_Developers_Journal_Tools_1997.iso / sbdemo / p20.sb < prev    next >
Encoding:
Text File  |  1996-10-24  |  956 b   |  30 lines

  1. declare function SendMessage lib "User" (hwnd as integer, w as integer,\
  2.                                          wParam as integer, lp as any) as integer
  3. declare function IsWindow       lib "User" (hwnd as integer) as integer
  4.  
  5. DIM sI As SYSTEMINFO
  6. DIM rc As Rect
  7.  
  8. WinInfoSystem(sI)
  9.  
  10. Run("notepad.exe", NOWAIT)
  11. wNotepad% = WinActivate("", "Notepad",5)
  12. RectSet(rc, sI.si_wXScreen/2-200, sI.si_wYScreen/2-60,\
  13.             sI.si_wXScreen/2+200, sI.si_wYScreen/2+60)
  14. WinSetPosSizeState(wNotepad%, rc, SBC_WINPOSSIZE or SBC_WINTOPMOST)
  15.  
  16. SBV_PLAYTICK = 0
  17. Simulate("Close Notepad to stop this madness.")
  18. While IsWindow(wNotepad%)
  19.     SendMessage(wNotepad%, WM_SETTEXT, 0, "Hello,")
  20.     sleep 1
  21.     If IsWindow(wNotepad%) then
  22.         SendMessage(wNotepad%, WM_SETTEXT, 0, "World!")
  23.         sleep 1
  24.     EndIf
  25.     If IsWindow(wNotepad%) then
  26.         SendMessage(wNotepad%, WM_SETTEXT, 0, "Hello, World!")
  27.         sleep 1
  28.     EndIf
  29. Wend
  30.