Advertisement
Ham62

cinch.bas

Sep 27th, 2017
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define fbc -s gui res\meme.rc
  2. #include "windows.bi"
  3. #include "win\mmsystem.bi"
  4.  
  5. Dim as HDC hdc = CreateDC("DISPLAY", NULL, NULL, NULL)
  6. Dim as HBITMAP hBitmap
  7.  
  8. 'Get screen width/height
  9. var iWidth = GetDeviceCaps(hdc, HORZRES)
  10. var iHeight = GetDeviceCaps(hdc, VERTRES)
  11.  
  12. 'load bitmap
  13. hBitmap = LoadBitmap(GetModuleHandle(NULL), @"MEME_BITMAP")
  14. If hBitmap = NULL Then
  15.     MessageBox(null, "Could not load MEME_BITMAP!", "Error", MB_ICONEXCLAMATION)
  16. End If
  17.  
  18. 'Create GDI bitmap object
  19. Dim as BITMAP bm
  20. Dim as HDC hdcMem = CreateCompatibleDC(hdc)
  21. Dim as HBITMAP hbmOld = SelectObject(hdcMem, hBitmap)
  22. GetObject(hBitmap, SizeOf(bm), @bm)
  23.  
  24. Dim as double AudioTimer
  25. Do
  26.     'Draw bitmap scaled fullscreen
  27.     StretchBlt(hdc, 0, 0, iWidth, iHeight, hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY)
  28.    
  29.     'play audio
  30.     if Abs(Timer-AudioTimer) >= 16 Then
  31.         AudioTimer = Timer
  32.         PlaySound("MEME_AUDIO", null, SND_RESOURCE OR SND_ASYNC)
  33.     end if
  34.    
  35.     'BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY)
  36.     Sleep 1,1
  37. Loop
  38.  
  39. 'Clear GDI objects
  40. SelectObject(hdcMem, hbmOld)
  41.  
  42. DeleteDC(hdcMem)
  43. DeleteDC(hdc)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement