thesnow Posted August 28, 2007 Share Posted August 28, 2007 how to load text resource from dll or exe? autoit crashed #AutoIt3Wrapper_useansi=y $Filehwnd=_API_LoadLibraryEx("shell32.dll",2) MsgBox(32,"",$Filehwnd) $te = _LoadString($Filehwnd,4184) MsgBox(32,"",$te) Func _API_LoadLibraryEx($sFileName, $iFlags=0) Local $aResult $aResult = DllCall("Kernel32.dll", "hwnd", "LoadLibraryExA", "str", $sFileName, "hwnd", 0, "int", $iFlags) Return $aResult[0] EndFunc Func _LoadString($File,$id) Local $aResult $aResult = DllCall("user32.dll","string","LoadStringA","hwnd",$File,"uint",$id,"int",100,"int",255) Return $aResult EndFunc Yes,it's me.thesnoW :idiot: .welcome to my au3 websiteit's a Chinese forum.http://www.AutoitX.com---------------------- Link to comment Share on other sites More sharing options...
jpm Posted August 28, 2007 Share Posted August 28, 2007 use the right parameters#csint LoadString( HINSTANCE hInstance, UINT uID, LPTSTR lpBuffer, int nBufferMax);#ce Link to comment Share on other sites More sharing options...
Raik Posted November 5, 2007 Share Posted November 5, 2007 (edited) this will be very useful to get system-lang-strings for buttons, etc. @jpm where do you got this code and how is it to understand and to transform to autoit? i think, this should be add into autoit, as for icons and bitmaps is already done. Edited November 7, 2007 by Raik AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1) Link to comment Share on other sites More sharing options...
Raik Posted November 7, 2007 Share Posted November 7, 2007 $Filehwnd=_API_LoadLibraryEx("shell32.dll",2) ;MsgBox(32,"",$Filehwnd) $te = _LoadString($Filehwnd,4184) MsgBox(32,"",$te) Func _API_LoadLibraryEx($sFileName, $iFlags=0) Local $aResult $aResult = DllCall("Kernel32.dll", "hwnd", "LoadLibraryExA", "str", $sFileName, "hwnd", 0, "int", $iFlags) Return $aResult[0] EndFunc Func _LoadString($File,$StringId) Local $aResult,$StringResult $aStrLen = DllCall("user32.dll","int","LoadString","ptr",$File,"int",$StringId,"str",$StringResult,"int",255) If $aStrLen > 0 Then Return $StringResult EndIf EndFunc this does not crash autoit, but it returns 0 only ??? who helps a beginner? AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1) Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted November 9, 2007 Moderators Share Posted November 9, 2007 I think this will do what you need.Resources.au3 Link to comment Share on other sites More sharing options...
Raik Posted November 11, 2007 Share Posted November 11, 2007 (edited) no, i don't want to load strings from resources but from system-dlls to get the local language of the current system and to save translation by hand. EDIT: i got it work! #AutoIt3Wrapper_useansi=y Func _LoadString($File,$StringId) Local $String,$StringResult $Dll = DllCall("Kernel32.dll","hwnd","LoadLibraryExA","str",$File,"hwnd",0,"int",2) $String = DllCall("user32.dll","int","LoadStringA","ptr",$Dll[0],"int",$StringId,"str",$StringResult,"int",255) If $String[0] > 0 Then Return $String[3] EndFunc Edited October 28, 2010 by Raik AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1) 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