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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. Why Error ?

Why Error ?

Scheduled Pinned Locked Moved ATL / WTL / STL
c++helpquestion
4 Posts 3 Posters 1 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
    Thangnc
    wrote on last edited by
    #1

    I used function VarBstrFromI1 conver char to BSTR: //Adsoft.cpp STDMETHODIMP CMyData::get_CGetComputerName(BSTR *pVal) { // TODO: Add your implementation code here char szHostName[200];//char* szHostName gethostname(szHostName,strlen(szHostName)); struct hostent* strTemp; strTemp=gethostbyname(szHostName); if(strTemp !=NULL) strcpy(szHostName,strTemp->h_name); BSTR* abc; if(VarBstrFromI1(szHostName,abc)==S_OK) pVal=abc; return S_OK; } Program error: error C2660: 'VarBstrFromI1' : function does not take 2 parameters -- modified at 0:19 Friday 26th August, 2005

    T 1 Reply Last reply
    0
    • T Thangnc

      I used function VarBstrFromI1 conver char to BSTR: //Adsoft.cpp STDMETHODIMP CMyData::get_CGetComputerName(BSTR *pVal) { // TODO: Add your implementation code here char szHostName[200];//char* szHostName gethostname(szHostName,strlen(szHostName)); struct hostent* strTemp; strTemp=gethostbyname(szHostName); if(strTemp !=NULL) strcpy(szHostName,strTemp->h_name); BSTR* abc; if(VarBstrFromI1(szHostName,abc)==S_OK) pVal=abc; return S_OK; } Program error: error C2660: 'VarBstrFromI1' : function does not take 2 parameters -- modified at 0:19 Friday 26th August, 2005

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      Thangnc wrote: if(VarBstrFromI1(szHostName,abc)==S_OK) error C2660: 'VarBstrFromI1' : function does not take 2 parameters reflecting a bit, what does the error description tells you ? it is because you call VarBstrFromI1 with two parameters, when it does take 2 ones. see its declaration/definition to understand how it works...


      TOXCCT >>> GEII power
      [toxcct][VisualCalc]

      J 1 Reply Last reply
      0
      • T toxcct

        Thangnc wrote: if(VarBstrFromI1(szHostName,abc)==S_OK) error C2660: 'VarBstrFromI1' : function does not take 2 parameters reflecting a bit, what does the error description tells you ? it is because you call VarBstrFromI1 with two parameters, when it does take 2 ones. see its declaration/definition to understand how it works...


        TOXCCT >>> GEII power
        [toxcct][VisualCalc]

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

        I'm amazed that you even bothered to reply. You must have a young and not yet tired soul! :) Good music: In my rosary[^] -- modified at 15:42 Friday 26th August, 2005

        T 1 Reply Last reply
        0
        • J Jorgen Sigvardsson

          I'm amazed that you even bothered to reply. You must have a young and not yet tired soul! :) Good music: In my rosary[^] -- modified at 15:42 Friday 26th August, 2005

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #4

          Jörgen Sigvardsson wrote: You must have a young and not yet tired soul! maybe... or i was just under a good day ! :cool:


          TOXCCT >>> GEII power
          [toxcct][VisualCalc]

          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