Tips   >   Unicode   >   Unicode (All Contents)
The isunicode() function was introduced in Omnis Studio version 4.1.
I was curious what would happen with a 4.0 version of Omnis Studio if it hit the isunicode() function in a library created in 4.1.
Here's what happens:
The isunicode() function becomes () and returns false.
; Unicode test in 4.1 or greater
If isunicode()
OK message {unicode}
Else
OK message {non-unicode}
End If
; Same function when opened in 4.0
; The result is false, so the test is okay in 4.0
If ()
OK message {unicode}
Else
OK message {non-unicode}
End If
If you use Register DLL to get file paths, you will need to modify your code for the unicode version of Omnis Studio.
With unicode version you will probably need to use the WIDE unicode calls.
SHGetFolderPathW instead of SHGetFolderPathA
The following is an example of what I had to do for the method which returns the path to the user preferences folder on the Windows platform.
If isunicode()
Register DLL ('shfolder.dll','SHGetFolderPathW','NJJJJC') Returns ErrCode
If not(ErrCode)
Call DLL ('shfolder.dll','SHGetFolderPathW',Handle,28,'#NULL#',0,Path) Returns ErrCode
End If
Else
Register DLL ('shfolder.dll','SHGetFolderPathA','NJJJJC') Returns ErrCode
If not(ErrCode)
Call DLL ('shfolder.dll','SHGetFolderPathA',Handle,28,'#NULL#',0,Path) Returns ErrCode
End If
End If
If sys(2)=2|sys(2)=2+4|sys(2)=2+16
OK message {Runtime version of Omnis Studio}
Else
OK message {Developer version of Omnis Studio}
End If
If mod(sys(2),2)
OK message {Developer version of Omnis Studio}
Else
OK message {Runtime version of Omnis Studio}
End If