haijie1223 Posted May 1, 2013 Share Posted May 1, 2013 c++:http://www.zezula.net/en/mpq/stormlib.html How to write by AU3? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 1, 2013 Moderators Share Posted May 1, 2013 haijie1223, Welcome to the Autoit forum. We do not write code to order - rather we help you get your own code working. What is the C++ code you to which you have (unsuccessfully) linked supposed to do? Perhaps there is something useful already coded in AutoIt. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
haijie1223 Posted May 1, 2013 Author Share Posted May 1, 2013 haijie1223,Welcome to the Autoit forum. We do not write code to order - rather we help you get your own code working. What is the C++ code you to which you have (unsuccessfully) linked supposed to do? Perhaps there is something useful already coded in AutoIt. M23Thank youBecause my English is very poor, the problem description is not very accurate.I tried to rewrite by AU3 for a long time, but did not succeed, Can I provide my AU3 code to BBSer help me find where the problem. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 1, 2013 Moderators Share Posted May 1, 2013 haijie1223,Describe the problem in yrou own language and use Google Translate or an equivalent to get it into English. If you have some AutoIt code that illustrates the problem then post it here - but please put [autoit] before and [/autoit] after your posted code so that you get a scrolling box and syntax colouring. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
haijie1223 Posted May 1, 2013 Author Share Posted May 1, 2013 haijie1223, Describe the problem in yrou own language and use Google Translate or an equivalent to get it into English. If you have some AutoIt code that illustrates the problem then post it here - but please put before and after your posted code so that you get a scrolling box and syntax colouring. M23 I would like to call the functions in SFmpq.dll file, so go to the official website to find information.Found for some C + + code, and then into the AU3 code, but rewritten for a long time without success. The C + + source code and I wrote it myself AU3 code made up.Please help us to look my code where there are problems. mpq001.7z 原型.txt expandcollapse popup#include <WinAPI.au3> #include <Array.au3> ; [url]http://zezula.net/en/mpq/stormlib.html[/url] ;~ Global $dll="Storm.dll" Global $dll = "SFmpq.dll" ;~ Global $dll = DllOpen(@ScriptDir & "\SFmpq.dll") ;~ Local $handle = DllStructCreate("handle") Func _WinAPI_SFileOpenArchive($sMpqName, $iPriority, $iFlags, ByRef $hMPQ) Local $handle = DllStructCreate("handle") ;~ Local $dll = DllOpen(@ScriptDir & "\SFmpq.dll") ;~ Local $aResult = DllCall($dll, "bool", "SFileOpenArchive", "str", $sMpqName, "dword", $iPriority, "dword", $iFlags, "handle*", 0) Local $aResult = DllCall($dll, "bool", "SFileOpenArchive", "str", $sMpqName, "dword", $iPriority, "dword", $iFlags, "handle*", DllStructGetPtr($handle)) If @error Then Return SetError(@error, @extended, False) $hMPQ = $aResult[4] Return $aResult[0] EndFunc ;==>_WinAPI_SFileOpenArchive Func _WinAPI_SFileOpenFileEx($hMPQ, $sFileName, $iSearchScope, ByRef $hFile) ;~ Local $aResult = DllCall($dll, "bool", "SFileOpenFileEx", "handle", $hMPQ, "str", $sFileName, "dword", $iSearchScope, "handle*", DllStructGetPtr($handle)) Local $aResult = DllCall($dll, "bool", "SFileOpenFileEx", "handle", $hMPQ, "str", $sFileName, "dword", $iSearchScope, "handle*", 0) ;~ _ArrayDisplay($aResult) If @error Then Return SetError(@error, @extended, False) $hFile = $aResult[4] Return $aResult[0] EndFunc ;==>_WinAPI_SFileOpenFileEx Func _WinAPI_SFileReadFile($hFile, $pBuffer, $iToRead, ByRef $iRead, $pOverlapped = 0) Local $aResult = DllCall($dll, "bool", "SFileReadFile", "handle", $hFile, "ptr", $pBuffer, "dword", $iToRead, "dword*", 0, "ptr", $pOverlapped) If @error Then Return SetError(@error, @extended, False) $iRead = $aResult[4] Return $aResult[0] EndFunc ;==>_WinAPI_SFileReadFile Func _WinAPI_SFileCloseFile($hFile) Local $aResult = DllCall($dll, "bool", "SFileCloseFile", "handle", $hFile) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] EndFunc ;==>_WinAPI_SFileCloseFile Func _WinAPI_SFileCloseArchive($hMPQ) Local $aResult = DllCall($dll, "bool", "SFileCloseArchive", "handle", $hMPQ) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] EndFunc ;==>_WinAPI_SFileCloseArchive Func ExtractFile($sArchiveName, $sArchivedFile, $sFileName) Local $hMPQ, $hFile, $handle, $nError = 0 If $nError = 0 Then If Not _WinAPI_SFileOpenArchive($sArchiveName, 0, 0, $hMPQ) Then $nError = _WinAPI_GetLastError() EndIf EndIf If $nError = 0 Then If Not _WinAPI_SFileOpenFileEx($hMPQ, $sArchivedFile, 0, $hFile) Then $nError = _WinAPI_GetLastError() EndIf EndIf If $nError = 0 Then $handle = _WinAPI_CreateFile($sFileName, 4) If $handle = $INVALID_HANDLE_VALUE Then $nError = _WinAPI_GetLastError() EndIf EndIf ;~ MsgBox(0,"",$nError) If $nError = 0 Then ;~ $tBuffer = DllStructCreate("byte[0x10000]") ;~ Dim $tBuffer = 'dword[65536];' $tBuffer = DllStructCreate("byte[" & 0x10000 & "]") Local $iBytes = 1 While $iBytes > 0 _WinAPI_SFileReadFile($hFile, DllStructGetPtr($tBuffer), DllStructGetSize($tBuffer), $iBytes, 0) If $iBytes > 0 Then _WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), DllStructGetSize($tBuffer), $iBytes, 0) EndIf WEnd EndIf If $handle <> 0 Then _WinAPI_CloseHandle($handle) EndIf If $hFile <> 0 Then _WinAPI_SFileCloseFile($hFile) EndIf If $hMPQ <> 0 Then _WinAPI_SFileCloseArchive($hMPQ) EndIf Return $nError EndFunc ;==>ExtractFile ExtractFile("kk.mpq", "key.txt", "key.txt") Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now