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. ATL / WTL / STL
  4. ATL's auto IDL generating is adding A/W to my methods!

ATL's auto IDL generating is adding A/W to my methods!

Scheduled Pinned Locked Moved ATL / WTL / STL
csharpc++helptutorialquestion
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.
  • T Offline
    T Offline
    Todd Jeffreys
    wrote on last edited by
    #1

    It's common to see FunctionA and FunctionW for ANSI/UNICODE versions, however my ATL functions are being created like this which is not good. For example, I made a method called OpenService which returns an IService object (of my creation) and takes as a parameter a BSTR. So the declaration is as follows: __interface IConfigurer : IDispatch { [id(1), helpstring("method Open")] HRESULT Open([in] BSTR machineName); [id(2), helpstring("method Close")] HRESULT Close(void); [id(3), helpstring("method OpenService")] HRESULT OpenService([in] BSTR serviceName, [out,retval] IDispatch** ppService); }; I havn't done ATL since VC 6.0 and I'm using 2003 .NET now. It auto creates the IDL file and outputs the OpenService function as OpenServiceA. Aren't BSTR's not supposed to require A/W or distinctions since they are always wide? I'm an ATL 7.0 noob so help me out ;-)

    J 1 Reply Last reply
    0
    • T Todd Jeffreys

      It's common to see FunctionA and FunctionW for ANSI/UNICODE versions, however my ATL functions are being created like this which is not good. For example, I made a method called OpenService which returns an IService object (of my creation) and takes as a parameter a BSTR. So the declaration is as follows: __interface IConfigurer : IDispatch { [id(1), helpstring("method Open")] HRESULT Open([in] BSTR machineName); [id(2), helpstring("method Close")] HRESULT Close(void); [id(3), helpstring("method OpenService")] HRESULT OpenService([in] BSTR serviceName, [out,retval] IDispatch** ppService); }; I havn't done ATL since VC 6.0 and I'm using 2003 .NET now. It auto creates the IDL file and outputs the OpenService function as OpenServiceA. Aren't BSTR's not supposed to require A/W or distinctions since they are always wide? I'm an ATL 7.0 noob so help me out ;-)

      J Offline
      J Offline
      Jorgen Sigvardsson
      wrote on last edited by
      #2

      I saw the EXACT same thing today! I have not yet fully investigated the matter further - I was on my way home when I spotted a method of mine, OpenService, having the name OpenServiceW. I am not 100% sure of what's going on, but it wouldn't surprise me that there's some function in the system headers that looks something like this:

      #ifdef _UNICODE
      #define OpenService OpenServiceW
      #else
      #define OpenService OpenServiceA
      #endif

      If you want to, you can investigate this and post what you find - that ought to be good reading tomorrow morning :) -- I am perpetual, I keep the country clean.

      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