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. How correctly override WinAPI function OleUIPasteSpecial for Microsoft Layer for Unicode

How correctly override WinAPI function OleUIPasteSpecial for Microsoft Layer for Unicode

Scheduled Pinned Locked Moved C / C++ / MFC
comhelpc++tutorialquestion
2 Posts 2 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.
  • V Offline
    V Offline
    Valera241176
    wrote on last edited by
    #1

    With help of this forum (thanks to good peaople) I learned how to use MSLU with MFC apps (http://www.trigeminal.com/usenet/usenet.asp?1033) The only thing I need to do to complete my task is to override OleUIPasteSpecialW, changing properly some members of LPOLEUIPASTESPECIALW structure, making LPOLEUIPASTESPECIALA from it and then calling OleUIPasteSpecialA. The problem is in displayng FormatName(s) in listbox. How to get them to translate from Unicode to ANSI using WideCharToMultiByte? All this required to let the OLE stuff to work correctly in MFC apps in Edit menu->Paste Special.

    K 1 Reply Last reply
    0
    • V Valera241176

      With help of this forum (thanks to good peaople) I learned how to use MSLU with MFC apps (http://www.trigeminal.com/usenet/usenet.asp?1033) The only thing I need to do to complete my task is to override OleUIPasteSpecialW, changing properly some members of LPOLEUIPASTESPECIALW structure, making LPOLEUIPASTESPECIALA from it and then calling OleUIPasteSpecialA. The problem is in displayng FormatName(s) in listbox. How to get them to translate from Unicode to ANSI using WideCharToMultiByte? All this required to let the OLE stuff to work correctly in MFC apps in Edit menu->Paste Special.

      K Offline
      K Offline
      KaRl
      wrote on last edited by
      #2

      Valera241176 wrote: How to get them to translate from Unicode to ANSI using WideCharToMultiByte? You have to use WideCharToMultiByte twice, one to know the size needed and one to do the transformation. LPWSTR lpszMsg; [...] // First calculation of the size needed to store the converted string int iCharSize = WideCharToMultiByte(CODE_PAGE, 0, lpszMsg, -1, NULL, 0, NULL, NULL); // Alloc a ANSI string LPSTR formatANSI = (LPSTR) HeapAlloc(GetProcessHeap(), 0, sizeof(char) * iCharSize); // convert WideCharToMultiByte(CODE_PAGE, 0, lpszMsg, -1, formatANSI, iCharSize, NULL, NULL); //... // use FormatAnsi there //... // Free the ANSI string HeapFree(GetProcessHeap(), 0, formatANSI); HTH, K.


      Angels banished from heaven have no choice but to become demons Cowboy Bebop

      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