Private Declare Function GetDC Lib "user32" (ByVal hWND As Long) As Long
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hWND As Long, ByVal hWndInsertAfter_ As Long, ByVal X As Long, ByVal y_ As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags_ As Long) As Long
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
'Nilai konstan untuk parameter SetWindowPos.
Private Const conHwndTopmost = -1
Private Const conHwndNoTopmost = -2
Private Const conSwpNoActivate = &H10
Private Const conSwpShowWindow = &H40
Private Sub Form_Load()
Me.AutoRedraw = True 'memastikan Form bisa menampung hasil copy layar.
Me.WindowState = 2 'Maximize.
SelaluTeratas Me.hWND, Me.Left / Screen.TwipsPerPixelX, Me.Top / Screen.TwipsPerPixelY, Me.Height / Screen.TwipsPerPixelY, Me.Width / Screen.TwipsPerPixelX, True
App.TaskVisible = False 'menyembunyikan aplikasi pada task manager (tab Application) tetapi terlihat di tab Process
ShowCursor False 'Sembunyikan cursor.
End Sub
'Saat Form berubah ukuran (maximize).
Private Sub Form_Resize()
Dim W, H 'Tipe variant.
'Set ukuran rectangle screen.
W = Screen.Width / 15
H = Screen.Height / 15
'kopian layar diambil dan di tampilkan pada Form secara Flip
StretchBlt Me.hdc, 0, H, W, -H, GetDC(0&), 0, 0, W, H, vbSrcCopy
End Sub
'Fungsi buatan.
Private Function SelaluTeratas(ByVal hWND, FrmX As Long, FrmY As Long, Tinggi As Long, Lebar As Long, ApakahTeratas As Boolean)
If ApakahTeratas = True Then
SetWindowPos hWND, conHwndTopmost, FrmX, FrmY, Lebar, Tinggi, conSwpNoActivate
ElseIf ApakahTeratas = False Then
SetWindowPos hWND, conHwndNoTopmost, FrmX, FrmY, Lebar, Tinggi, conSwpShowWindow
End If
End Function
'Fungsi buatan untuk Normalisasi seperti keadaan semula.
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyN Then 'Jika tombol "N" keyboard ditekan.
ShowCursor True
End
End If
End Sub
NB : Jika ingin mengembalikan seperti semula silahkan tekan Tombol panah bawah..
Tested by Icc Ayub Rudini,