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. C / C++ / MFC
  4. Making VC++ 6 DLL to work on VB6 App with no UNICODE issue

Making VC++ 6 DLL to work on VB6 App with no UNICODE issue

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++winformsannouncement
4 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.
  • W Offline
    W Offline
    whiteboat
    wrote on last edited by
    #1

    Currently I am working on an old VB6 app to be compatible with UNICODE.

    This app has SSTab and within this tab, there are user control q1, q2, q3 and so on. For q1, it has the following code:

    Private WithEvents q1 As VBControlExtender
    Private progID As String

    procId = “ALCTX10.CTX10.1”
    Set q1 = Controls.Add(procId, “q1”)
    myTab.tab = 1
    q1.Move borderSize, topMargin, myTab.Width - borderSize * 2, _
    myTab.Height - borderSize - topMargin
    q1.Visible = True

    The procId is referring to VC++ 6 DLL. All user controls are using this DLL.
    For VC++ 6 DLL, I added ",_UNICODE, UNICODE" into the preprocessor definitions under the project setting of VC++ 6.
    And compiled the DLL again and then brought it back to VB6.

    The problem is I am still getting the same UNICODE issue from VB6 app.
    I am using a foreign version of Windows XP so it is not the font problem.
    I can’t just replace this DLL with UNICODE supported TextBox or RichTextBox since there are too many things going underneath the DLL.

    I would appreciate very much if anyone sheds a light on this problem. Thanks.

    V J 2 Replies Last reply
    0
    • W whiteboat

      Currently I am working on an old VB6 app to be compatible with UNICODE.

      This app has SSTab and within this tab, there are user control q1, q2, q3 and so on. For q1, it has the following code:

      Private WithEvents q1 As VBControlExtender
      Private progID As String

      procId = “ALCTX10.CTX10.1”
      Set q1 = Controls.Add(procId, “q1”)
      myTab.tab = 1
      q1.Move borderSize, topMargin, myTab.Width - borderSize * 2, _
      myTab.Height - borderSize - topMargin
      q1.Visible = True

      The procId is referring to VC++ 6 DLL. All user controls are using this DLL.
      For VC++ 6 DLL, I added ",_UNICODE, UNICODE" into the preprocessor definitions under the project setting of VC++ 6.
      And compiled the DLL again and then brought it back to VB6.

      The problem is I am still getting the same UNICODE issue from VB6 app.
      I am using a foreign version of Windows XP so it is not the font problem.
      I can’t just replace this DLL with UNICODE supported TextBox or RichTextBox since there are too many things going underneath the DLL.

      I would appreciate very much if anyone sheds a light on this problem. Thanks.

      V Offline
      V Offline
      Victor Nijegorodov
      wrote on last edited by
      #2

      Did you test this DLL with some VC++ code (both sides must be built with _UNICODE, UNICODE)? Did you text every exported function of this DLL if it works without any problem?

      W 1 Reply Last reply
      0
      • V Victor Nijegorodov

        Did you test this DLL with some VC++ code (both sides must be built with _UNICODE, UNICODE)? Did you text every exported function of this DLL if it works without any problem?

        W Offline
        W Offline
        whiteboat
        wrote on last edited by
        #3

        Yes. The DLL is not a problem since it is compiled with _UNICODE, UNICODE with no problem. The problem is VB6 translates all DLL calls to ANSI even though it is UNICODE.

        1 Reply Last reply
        0
        • W whiteboat

          Currently I am working on an old VB6 app to be compatible with UNICODE.

          This app has SSTab and within this tab, there are user control q1, q2, q3 and so on. For q1, it has the following code:

          Private WithEvents q1 As VBControlExtender
          Private progID As String

          procId = “ALCTX10.CTX10.1”
          Set q1 = Controls.Add(procId, “q1”)
          myTab.tab = 1
          q1.Move borderSize, topMargin, myTab.Width - borderSize * 2, _
          myTab.Height - borderSize - topMargin
          q1.Visible = True

          The procId is referring to VC++ 6 DLL. All user controls are using this DLL.
          For VC++ 6 DLL, I added ",_UNICODE, UNICODE" into the preprocessor definitions under the project setting of VC++ 6.
          And compiled the DLL again and then brought it back to VB6.

          The problem is I am still getting the same UNICODE issue from VB6 app.
          I am using a foreign version of Windows XP so it is not the font problem.
          I can’t just replace this DLL with UNICODE supported TextBox or RichTextBox since there are too many things going underneath the DLL.

          I would appreciate very much if anyone sheds a light on this problem. Thanks.

          J Offline
          J Offline
          Jeremy Falcon
          wrote on last edited by
          #4

          For the VC++ side, make sure you have more than just the pre-processor definition. Check out the Project Properties -> General -> Project Defaults -> Character Set setting too. For the VB6 side, I'm pretty sure VB6 uses Unicode to store strings internally (going off of memory). But, that doesn't mean the app is Unicode enabled. The VB runtime will most likely convert the string into whatever code page the system is running. Now, for lower end chars in something like UTF-8 this isn't an issue... BUT... when VC++ says Unicode they mean UTF-16. So there will be a byte alignment issue where the Unicode DLL is treating every two characters as one for your prodId, for instance. I'm not sure of the error you're getting, but if you're looking to interface VB6 with a DLL, you may be better off using Multibyte Character Set (MBCS)[^]. I haven't verified it, but MBCS is probably closer to what VB6 is doing anyway.

          Jeremy Falcon

          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