#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_UseX64=n
#PRE_Res_requestedExecutionLevel=None
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <waterctrl.dll.au3>
$Form1 = GUICreate("DEMO", 397, 260, -1, -1)
$bgconfirm = GUICtrlCreatePic("", 0, 0, 397, 90)
_WaterCtrl_StartupFromRes('sys.dll', "BG", $Form1, '70,27');'这里想实现直接从DLL里引用图片,请问如何实现呢?
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _WaterCtrl_StartupFromRes($DllName, $BitMapName, $hWnd, $start = '', $WaterRadius = 3, $WaterHeight = 50, $Left = 0, $Top = 0)
If Not IsHWnd($hWnd) Then Return SetError(2, 0, '')
Local $code, $sDll_Filename, $hFileDllOut, $bmp_pic, $pos, $_pos[5]
$code = CtrlCode()
Do
$sDll_Filename = ''
While StringLen($sDll_Filename) < 7
$sDll_Filename = $sDll_Filename & Chr(Random(97, 122, 1))
WEnd
$sDll_Filename = @TempDir & '\~' & $sDll_Filename & '.tmp'
Until Not FileExists($sDll_Filename)
$hFileDllOut = FileOpen($sDll_Filename, 2)
FileWrite($hFileDllOut, $code)
FileClose($hFileDllOut)
FileSetTime($sDll_Filename, '20100725164800', 0)
$___sDll___Filename[0] = DllOpen($sDll_Filename)
If $___sDll___Filename[0] = -1 Then Return SetError(3, 0, '')
$___sDll___Filename[1] = $sDll_Filename
Local $LoadLibraryA = DllCall("Kernel32.dll", "hwnd", "LoadLibraryA", "str", $DllName)
If @error Then Return SetError(@error, 0, 0)
Local $LoadBitmap = DllCall("User32.dll", "hwnd", "LoadBitmap", "hwnd", $LoadLibraryA[0], "str", $BitMapName)
If @error Then Return SetError(@error, 0, -1)
$___sDll___Filename[2] = $LoadBitmap[0]
DllCall($___sDll___Filename[0], 'bool', 'enablewater', 'HWND', $hWnd, 'int', $Left, 'int', $Top, 'HWND', $___sDll___Filename[2], 'int', $WaterRadius, 'int', $WaterHeight)
$pos = StringSplit($start, ',;|')
If Not @error And $pos[0] >= 2 Then
$_pos[1] = $pos[1]
$_pos[2] = $pos[2]
If $pos[0] = 2 Then
$_pos[3] = 10
$_pos[4] = 500
ElseIf $pos[0] = 3 Then
$_pos[3] = $pos[3]
$_pos[4] = 500
ElseIf $pos[0] = 4 Then
$_pos[3] = $pos[3]
$_pos[4] = $pos[4]
EndIf
DllCall($___sDll___Filename[0], 'bool', 'waterblob', 'int', $_pos[1], 'int', $_pos[2], 'int', $_pos[3], 'int', $_pos[4])
EndIf
Local $csize = ControlGetPos($hWnd, '', '#327701')
Local $wsize = WinGetPos($hWnd)
$___sDll___Filename[3] = $csize[2]
If $wsize[2] < $csize[2] Then $___sDll___Filename[3] = $wsize[2]
$___sDll___Filename[4] = $csize[3]
If $wsize[3] < $csize[3] Then $___sDll___Filename[4] = $wsize[3]
Return $___sDll___Filename
EndFunc ;==>_WaterCtrl_StartupFromRes