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. LPCOLESTR?

LPCOLESTR?

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
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.
  • A Offline
    A Offline
    Alain Royer
    wrote on last edited by
    #1

    I would like to use the function IDataInitialize::LoadStringFromStorage that takes LPCOLESTR as parameters. The first parameters is a udl file and I have that file in a char*. How to past from my char* to the LPCOLESTR? The second parameter is a LPCOLESTR* how can I get that back to char*? Thanks.

    A D 2 Replies Last reply
    0
    • A Alain Royer

      I would like to use the function IDataInitialize::LoadStringFromStorage that takes LPCOLESTR as parameters. The first parameters is a udl file and I have that file in a char*. How to past from my char* to the LPCOLESTR? The second parameter is a LPCOLESTR* how can I get that back to char*? Thanks.

      A Offline
      A Offline
      Alex Gorev
      wrote on last edited by
      #2

      Hi! You can use the A2OLE macro to convert the char* string to LPCOLESTR. To get the string back you have to specify the valid pointer to LPCOLESTR and then you can convert the result Unicode string to char*. I don't know who is responsible for allocating memory for the result, so if you have to do that you can create an array of WCHARs. You can find more information about the "String Conversion Macro" in the MSDN. Regards, Alex Gorev, Dundas Software.

      1 Reply Last reply
      0
      • A Alain Royer

        I would like to use the function IDataInitialize::LoadStringFromStorage that takes LPCOLESTR as parameters. The first parameters is a udl file and I have that file in a char*. How to past from my char* to the LPCOLESTR? The second parameter is a LPCOLESTR* how can I get that back to char*? Thanks.

        D Offline
        D Offline
        Dundas TCP IP Support
        wrote on last edited by
        #3

        Hi, Use AnsiToUnicode( ) & UnicodeToAnsi() here are two examples OPENFILENAME ofn; LPOLESTR pszFileNameW; LPMONIKER pmk; .. ...... // Get file name from OpenFile Common Dialog. The ANSI file name will // be placed in ofn.lpstrFile GetOpenFileName(&ofn); .. ...... AnsiToUnicode(ofn.lpstrFile, &pszFileNameW); CreateFileMoniker(pszFileNameW, &pmk); CoTaskMemFree(pszFileNameW); .. ...... COleInPlaceFrame::SetStatusText(LPCOLESTR pszStatusTextW) { LPSTR pszStatusTextA; UnicodeToAnsi(pszStatusTextW, &pszStatusTextA); SetWindowText(m_hwndStatus, pszStatusTextA); CoTaskMemFree(pszStatusTextA); } See Also OLE2CT() Hope That will help Ghazi

        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