[Visual Basic 6.0] Convert string to unicode for command line
-
I'm using vb6 to invoke a function in a dll with the following argurments (int argc, _TCHAR* argv[]) in vb6: this is how i call the function in the dll.. String command = "TEST 123 456" module(3, command) As you can see, command is of String type.. the parameter needed is _TCHAR* _TCHAR* is in unicode. How do I convert my String to _TCHAR*??
-
I'm using vb6 to invoke a function in a dll with the following argurments (int argc, _TCHAR* argv[]) in vb6: this is how i call the function in the dll.. String command = "TEST 123 456" module(3, command) As you can see, command is of String type.. the parameter needed is _TCHAR* _TCHAR* is in unicode. How do I convert my String to _TCHAR*??
All strings in V6 are already stored Unicode encoded. They are, in the C++ world, of type BSTR. In VB6, or any VB for that matter, you cannot pass in a point to a TCHAR array, since VB has no idea what a pointer it, nor a TCHAR. IIRC, I think you had to declare that parameter as ByRef String in your VB6 Declare statement.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
I'm using vb6 to invoke a function in a dll with the following argurments (int argc, _TCHAR* argv[]) in vb6: this is how i call the function in the dll.. String command = "TEST 123 456" module(3, command) As you can see, command is of String type.. the parameter needed is _TCHAR* _TCHAR* is in unicode. How do I convert my String to _TCHAR*??
Could you change your
DLL
function signature? If you can't I think it will be very difficult... :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]