Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. [Visual Basic 6.0] Convert string to unicode for command line

[Visual Basic 6.0] Convert string to unicode for command line

Scheduled Pinned Locked Moved Visual Basic
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    blurboy
    wrote on last edited by
    #1

    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*??

    D C 2 Replies Last reply
    0
    • B blurboy

      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*??

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • B blurboy

        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*??

        C Offline
        C Offline
        CPallini
        wrote on last edited by
        #3

        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]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups