| View previous topic :: View next topic |
| Author |
Message |
dangt Newbie
Joined: 19 May 2009 Posts: 20
|
Posted: Fri Jun 12, 2009 3:25 pm Post subject: ASCII to UNICODE |
|
|
| How can I convert string of text from ASCII to UNICODE and store it in a variable to pass to a WIN32 API function? |
|
| Back to top |
|
 |
dangt Newbie
Joined: 19 May 2009 Posts: 20
|
Posted: Fri Jun 12, 2009 9:57 pm Post subject: |
|
|
| I'm trying to pass a VDS string to a WIN32 API function that takes a LPWSTR. |
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Sat Jun 13, 2009 4:18 am Post subject: |
|
|
string.dll? Hmm, maybe not. I noticed you mentioned Win32 API. Have a look at the built-in @binary() function. Hopefully someone who know more about Win32 API stuff will answer soon. _________________ cheers
Dave |
|
| Back to top |
|
 |
Aslan Valued Contributor


Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Sat Jun 13, 2009 3:48 pm Post subject: |
|
|
Maybe this function will help.
| Code: | #DEFINE FUNCTION,mkWideCharStr
#Usage @mkWideCharStr(<string>)
:mkWideCharStr
LoadLib kernel32.dll
%W = @fill(@prod(@sum(@len(%1),1),2))
%X = @lib(kernel32,MultiByteToWideChar,INT:,0,0,STR:%1,-1,@addr("%W"),@prod(@sum(@len(%1),1),2))
FreeLib kernel32
exit %W |
|
|
| Back to top |
|
 |
dangt Newbie
Joined: 19 May 2009 Posts: 20
|
Posted: Mon Jun 15, 2009 3:34 pm Post subject: |
|
|
| Thanks Aslan. With your function I got it working. |
|
| Back to top |
|
 |
dangt Newbie
Joined: 19 May 2009 Posts: 20
|
Posted: Mon Jun 15, 2009 3:43 pm Post subject: |
|
|
I found that this would work too
H@CHR(0)e@CHR(0)l@CHR(0)l@CHR(0)o@CHR(0) |
|
| Back to top |
|
 |
|