forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


ASCII to UNICODE

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
dangt
Newbie


Joined: 19 May 2009
Posts: 20

PostPosted: Fri Jun 12, 2009 3:25 pm    Post subject: ASCII to UNICODE Reply with quote

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
View user's profile Send private message
dangt
Newbie


Joined: 19 May 2009
Posts: 20

PostPosted: Fri Jun 12, 2009 9:57 pm    Post subject: Reply with quote

I'm trying to pass a VDS string to a WIN32 API function that takes a LPWSTR.
Back to top
View user's profile Send private message
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Sat Jun 13, 2009 4:18 am    Post subject: Reply with quote

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
View user's profile Send private message
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Sat Jun 13, 2009 3:48 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
dangt
Newbie


Joined: 19 May 2009
Posts: 20

PostPosted: Mon Jun 15, 2009 3:34 pm    Post subject: Reply with quote

Thanks Aslan. With your function I got it working.
Back to top
View user's profile Send private message
dangt
Newbie


Joined: 19 May 2009
Posts: 20

PostPosted: Mon Jun 15, 2009 3:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group