Page 1 of 1

Loading strings from system DLLs

Posted: Mon May 19, 2008 5:33 pm
by Hroudtwolf
Hi,

I made following little example for a member of the purebasic-lounge.com chat.
It shows, how to load strings from stringtable in a DLL file on windows.
To load strings from system DLLs is very advantageous.
'Cause so you can abstain from language files in many cases and the texts in shell32 and user32 DLLs are by default in the language of the current windows installation. (IMHO&AFAIK)

You can examine the IDs of stringtable strings very easy by using the legendary ressourcehacker tool.

Downloadable here: http://angusj.com/resourcehacker/

Code: Select all

; Http://www.purebasic-lounge.com
; Hroudtwolf
; PureBasic 4.x
; Windows


Define.l hLib        = LoadLibrary_( "shell32.dll" ) ; Loading library
Define.s sptrBuffer  = Space ( 255 )                 ; Buffer for receiving strings
Define.l lI

If Not hLib ; DLL not found ?
   End
EndIf

; Examining strings from lib
For lI = 60 To 63 ; IDs 60-62
   LoadString_( hLib ,lI , @ sptrBuffer , 255 )
   Debug sptrBuffer
Next lI

For lI = 4161 To 4175 ; IDs 4161-4175
   LoadString_( hLib ,lI , @ sptrBuffer , 255 )
   Debug sptrBuffer
Next lI

FreeLibrary_( hLib )
Regards

Wolf

Posted: Mon May 19, 2008 6:33 pm
by Fluid Byte
You can load and free the DLL via PB, so no need for API variants. Also you shouldn't use ResourceHacker since it's buggy and outdated.
Use XN ResourceEdior instead:

http://www.wilsonc.demon.co.uk/d10resourceeditor.htm

Posted: Mon May 19, 2008 7:20 pm
by Hroudtwolf
You can load and free the DLL via PB, so no need for API variants.
I don't think so. ;-)
PB functions are overhead in this case.
'Cause this example runs only on windows whatever I use instead of LoadLibrary/FreeLibrary.

Thanks for your commend of XN-Resource Editor.

Regards

Wolf