Jump to content
Sign in to follow this  

64bit Xeon

Recommended Posts


1) AutoIt3Wrapper is

2) AutoIt is

3) WinAPIEx.au3 is 2.2

4) Code:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_File_Add=c:\Temp\res_file.bla, RCDATA, res_f
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Include <WinAPIEx.au3>

Local $way = "C:\temp"
Local $a = "RES"
Local $b = "file"
Local $where = $way&"\"&StringLower($a)&"_"&StringLower(StringLeft($b, 1))&".bla"
Local $what = StringUpper($a)&"_"&StringUpper(StringLeft($b, 1))

MsgBox (64, "$where/what", "$where = "&$where&@CRLF&"$what = "&$what)

_ResSaveToFile($where, $what)
If @error <> 0 Then
   MsgBox (64, "error", "@error = "& @error)

Func _ResSaveToFile($sFile, $iRes)

    Local $hFile, $hInst, $hInfo, $hData, $pData, $tData, $iSize, $iByte

    $hInst = _WinAPI_GetModuleHandle('')
    $hInfo = _WinAPI_FindResource($hInst, $iRes, $RT_RCDATA)
    $hData = _WinAPI_LoadResource($hInst, $hInfo)
    $iSize = _WinAPI_SizeofResource($hInst, $hInfo)
    $pData = _WinAPI_LockResource($hData)
    If @error Then
        Return SetError(1, 0, 0)
    $tData = DllStructCreate('byte[' & $iSize & ']', $pData)
    $hFile = _WinAPI_CreateFile($sFile, 1)
    If Not $hFile Then
        Return SetError(2, 0, 0)
    _WinAPI_WriteFile($hFile, DllStructGetPtr($tData), $iSize, $iByte)
    If $iByte <> $iSize Then
        Return SetError(3, 0, 0)
    Return 1
EndFunc   ;==>_ResSaveToFile

According CFF.png I have this resource inside. But I have @error=1 - as result it don't write to the disk. Why? What I should do?



Edited by VitAl2013

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this