По идее вот эта функция должна подойти:
Код:
Func _ResourceGetAsRaw($iResType, $iResName, $iResLang, $sModule, $iMode = 0, $iSize = 0)
Local $iLoaded
Local $a_hCall = DllCall("kernel32.dll", "hwnd", "GetModuleHandleW", "wstr", $sModule)
If @error Then
Return SetError(1, 0, "")
EndIf
If Not $a_hCall[0] Then
$a_hCall = DllCall("kernel32.dll", "hwnd", "LoadLibraryExW", "wstr", $sModule, "hwnd", 0, "int", 34)
If @error Or Not $a_hCall[0] Then
Return SetError(2, 0, "")
EndIf
$iLoaded = 1
EndIf
Local $hModule = $a_hCall[0]
Switch IsNumber($iResType) + 2 * IsNumber($iResName)
Case 0
$a_hCall = DllCall("kernel32.dll", "hwnd", "FindResourceExW", _
"hwnd", $hModule, _
"wstr", $iResType, _
"wstr", $iResName, _
"int", $iResLang)
Case 1
$a_hCall = DllCall("kernel32.dll", "hwnd", "FindResourceExW", _
"hwnd", $hModule, _
"int", $iResType, _
"wstr", $iResName, _
"int", $iResLang)
Case 2
$a_hCall = DllCall("kernel32.dll", "hwnd", "FindResourceExW", _
"hwnd", $hModule, _
"wstr", $iResType, _
"int", $iResName, _
"int", $iResLang)
Case 3
$a_hCall = DllCall("kernel32.dll", "hwnd", "FindResourceExW", _
"hwnd", $hModule, _
"int", $iResType, _
"int", $iResName, _
"int", $iResLang)
EndSwitch
If @error Or Not $a_hCall[0] Then
If $iLoaded Then
Local $a_iCall = DllCall("kernel32.dll", "int", "FreeLibrary", "hwnd", $hModule)
If @error Or Not $a_iCall[0] Then
Return SetError(7, 0, "")
EndIf
EndIf
Return SetError(3, 0, "")
EndIf
Local $hResource = $a_hCall[0]
Local $a_iCall = DllCall("kernel32.dll", "int", "SizeofResource", "hwnd", $hModule, "hwnd", $hResource)
If @error Or Not $a_iCall[0] Then
If $iLoaded Then
Local $a_iCall = DllCall("kernel32.dll", "int", "FreeLibrary", "hwnd", $hModule)
If @error Or Not $a_iCall[0] Then
Return SetError(7, 0, "")
EndIf
EndIf
Return SetError(4, 0, "")
EndIf
Local $iSizeOfResource = $a_iCall[0]
$a_hCall = DllCall("kernel32.dll", "hwnd", "LoadResource", "hwnd", $hModule, "hwnd", $hResource)
If @error Or Not $a_hCall[0] Then
If $iLoaded Then
Local $a_iCall = DllCall("kernel32.dll", "int", "FreeLibrary", "hwnd", $hModule)
If @error Or Not $a_iCall[0] Then
Return SetError(7, 0, "")
EndIf
EndIf
Return SetError(5, 0, "")
EndIf
Local $a_pCall = DllCall("kernel32.dll", "ptr", "LockResource", "hwnd", $a_hCall[0])
If @error Or Not $a_pCall[0] Then
If $iLoaded Then
Local $a_iCall = DllCall("kernel32.dll", "int", "FreeLibrary", "hwnd", $hModule)
If @error Or Not $a_iCall[0] Then
Return SetError(7, 0, "")
EndIf
EndIf
Return SetError(6, 0, "")
EndIf
Local $tOut
Switch $iMode
Case 0
$tOut = DllStructCreate("char[" & $iSizeOfResource + 1 & "]", $a_pCall[0])
Case 1
$tOut = DllStructCreate("byte[" & $iSizeOfResource & "]", $a_pCall[0])
EndSwitch
Local $sReturnData = DllStructGetData($tOut, 1)
If $iLoaded Then
Local $a_iCall = DllCall("kernel32.dll", "int", "FreeLibrary", "hwnd", $hModule)
If @error Or Not $a_iCall[0] Then
Return SetError(7, 0, "")
EndIf
EndIf
Switch $iSize
Case 0
Return SetError(0, 0, $sReturnData)
Case Else
Switch $iMode
Case 0
Return SetError(0, 0, StringLeft($sReturnData, $iSize))
Case 1
Return SetError(0, 0, BinaryMid($sReturnData, 1, $iSize))
EndSwitch
EndSwitch
EndFunc
но у меня не получается её использовать, возможно я не тее параметры ввожу.
|