Page 1 of 1

Unicode wowes

Posted: Mon Feb 01, 2010 12:46 am
by joakim

it appears that when creating a resourse only dll it's not unicode aware, although I have saved RC file as Unicode and then compile dll, only LoadLibraryA and FindResourceA works, LoadLibraryW and FindResourceW not.

I create a custom resourse FILE and add a unicode format file, but when reading the resource into application I only get unreadable garbage?

I have version

Posted: Thu Feb 04, 2010 3:55 am
by isiticov

All string resources in EXE/DLL are always in Unicode format. LoadLibraryW and FindResourceW are not related to DLL but to your main EXE. So it may be good idea to check it.

How do you link resources to application? Do you use Resource Builder to compile RC to RES or not?

There could be many places of proble, so could you please provide more details about this? Which IDE/Compiler do you use to create EXE, DLL and so on. How do you read resources and display...

Posted: Thu Feb 04, 2010 9:23 pm
by joakim
Hi Igor,

I create my resorce in Resource Builder, of course ;-) Been poking around a lot the last days so things has changed a bit. What I do is create a Resource only dll in RB, then in my VB6 project I use the dll, using Win32 API's.

Code: Select all

Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function FindResource Lib "kernel32" Alias "FindResourceA" (ByVal hInstance As Long, ByVal lpName As String, ByVal lpType As String) As Long
 'Load the dll in memory and get its handle
    m_lngResourceHandle = LoadLibrary(strResourceDLL)
hRsrc = FindResource(m_lngResourceHandle, ResName, ResType)

etc. I tried with W versions of API call's but already LoadLibraryW fail (return 0 aka no handle), only LoadLibraryA aka ANSI version works.

Now I have changed .RC file format to ANSI and currently limit to western languages. But even in Unicode format, as an example Czech language doesn't work because when saved all accents are removed, like č becomes c, also creating a custom resoulce type and store a full text files there seem to be problems when reading back the file.

Now I will leave for 1 week holiday on Saturday so don't have time explore further now, but when coming back I will try put together real exaples of anything that doesn't work.