Jump to content
Sign in to follow this  
Raik

_LoadString($Filehwnd,$StringId)

Recommended Posts

Raik

#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)
    DllCall("Kernel32.dll","long","FreeLibrary","long",$Dll[0])
    If $String[0] > 0 Then Return $String[3]
EndFunc

Edited by Raik

AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1)

Share this post


Link to post
Share on other sites
SmOke_N

Shouldn't you free the library?


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
weaponx

My library is already free, I just show them my card and off I go with my books.

Share this post


Link to post
Share on other sites
BrettF
GaryFrost

done.

Liked your idea, so I went ahead and added the _WinAPI_LoadString($hInstance, $iStringId) function which was not in the WinAPI library

This is the function header in 3.2.9.13 beta

; #FUNCTION# ====================================================================================================

================

; Name...........: _WinAPI_LoadString

; Description ...: loads a string resource from the executable file associated with a specified module

; Syntax.........: _WinAPI_LoadString($hInstance, $iStringId)

; Parameters ....: $hInstance - Handle to an instance of the module whose executable file contains the string resource

; $iStringId - Specifies the integer identifier of the string to be loaded

; Return values .: Success - The string requested, @extended is the number of TCHARS copied

; Failure - Empty string and @error is set

; Author ........: Gary Frost used correct syntax, Original concept Raik

; Modified.......:

; Remarks .......:

; Related .......: _WinAPI_LoadLibraryEx, _WinAPI_FreeLibrary

; Link ..........; @@MsdnLink@@ LoadString

; Example .......; Yes

; ====================================================================================================

===========================


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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  

×