- Код: Выделить всё
hDCPreview = GetDC(hWndPreview)
BitBlt hDCPreview, 1, 1, 100, 100, hDCpicMain, 1, 1, vbSrcCopy
hDCPreview = GetDC(hWndPreview)
BitBlt hDCPreview, 1, 1, 100, 100, hDCpicMain, 1, 1, vbSrcCopy
Private Type Rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Const WS_CHILD = &H40000000
Private Const GWL_Hwndparent = (-8)
Private Const GWL_STYLE = (-16)
Private Const HWND_TOP = 0&
Private Const SWP_NOZODER = &H4
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As Rect) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWondowLongA" (ByVal hwnd As Long, nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWondowLongA" (ByVal hwnd As Long, nIndex As Long, dwNewLong 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 SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Public gblnShow As Boolean
Private mlngDisplayHwnd As Long
Private recDisplay As Rect
Public Sub Main()
Dim strCmd As String
Dim strTwo As String, lngStyle As Long, lngPreviewHandle As Long, lngParam As Long
strCmd = UCase(Trim(Command))
strTwo = Left(strCmd, 2)
Select Case strTwo
Case "/P"
mlngDisplayHwnd = Val(Mid(strCmd, 4))
GetClientRect mlngDisplayHwnd, recDisplay
gblnShow = False
Load Form1
lngPreviewHandle = Form1.hwnd
lngStyle = lngstylw Or WS_CHILD
SetWindowLong lngPreviewHandle, GWL_STYLE, lngStyle
SetParent lngPreviewHandle, mlngDisplayHwnd
SetWindowLong lngPreviewHandle, GWL_Hwndparent, mlngDisplayHwnd
SetWindowPos lngpreviewhanlde, HWND_TOP, 0&, 0&, recDisplay.Right, recDisplay.Bottom, SWP_NOZODER Or SWP_NOACTIVATE Or SWP_SHOWWINDOW
Exit Sub
Case "/C", "/A"
Load Form1
Exit Sub
Case "/S"
gblnShow = True
Load Form1
Form1.Show
Exit Sub
End Select
End Sub
Сейчас этот форум просматривают: AhrefsBot и гости: 50