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 To add VB ActiveX file into VC++ program???

How To add VB ActiveX file into VC++ program???

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++csharpvisual-studiocom
9 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.
  • S Offline
    S Offline
    savitri
    wrote on last edited by
    #1

    Hello EveryOne, Hi..I am doing one vc++ program in that i want to call VB OCX file.I am doing that but when i am accessing the funtions from the ocx or activex control it is giving error.in VB OCX program function is like this: Public Sub Processattendacne(strProcess As Integer) lblProcessing.Caption = strProcess End Sub when i am adding know then this function is like this: void C_UserControl1::Processattendacne(BSTR* strProcess) { static BYTE parms[] = VTS_PBSTR; InvokeHelper(0x60030000, DISPATCH_METHOD, VT_EMPTY, NULL, parms, strProcess); } I am calling this function in my program it is giving parameter missmatch error..like this.. void CPassingVarsDlg::OnGetIt() { // TODO: Add your control notification handler code here CString str='s'; m_UserVariable.Processattendacne(str); } ERROR IS LIKE THIS: :\Program Files\Microsoft Visual Studio\My Projects\PassingVars\PassingVarsDlg.cpp(177) : error C2664: 'Processattendacne' : cannot convert parameter 1 from 'class CString' to 'unsigned short ** ' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called Error executing cl.exe. Please Help me out to solve this problem.I am not getting which datatype i have to use to resovle this problem. Reply me As Soon As Possible.. Thanks In Advance, Savitri

    C 1 Reply Last reply
    0
    • S savitri

      Hello EveryOne, Hi..I am doing one vc++ program in that i want to call VB OCX file.I am doing that but when i am accessing the funtions from the ocx or activex control it is giving error.in VB OCX program function is like this: Public Sub Processattendacne(strProcess As Integer) lblProcessing.Caption = strProcess End Sub when i am adding know then this function is like this: void C_UserControl1::Processattendacne(BSTR* strProcess) { static BYTE parms[] = VTS_PBSTR; InvokeHelper(0x60030000, DISPATCH_METHOD, VT_EMPTY, NULL, parms, strProcess); } I am calling this function in my program it is giving parameter missmatch error..like this.. void CPassingVarsDlg::OnGetIt() { // TODO: Add your control notification handler code here CString str='s'; m_UserVariable.Processattendacne(str); } ERROR IS LIKE THIS: :\Program Files\Microsoft Visual Studio\My Projects\PassingVars\PassingVarsDlg.cpp(177) : error C2664: 'Processattendacne' : cannot convert parameter 1 from 'class CString' to 'unsigned short ** ' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called Error executing cl.exe. Please Help me out to solve this problem.I am not getting which datatype i have to use to resovle this problem. Reply me As Soon As Possible.. Thanks In Advance, Savitri

      C Offline
      C Offline
      CPallini
      wrote on last edited by
      #2

      savitri wrote:

      Reply me As Soon As Possible..

      [military tone] Of course, Sir! [/military tone] If the function requires a pointer to a BSTR object, why are you passing a CString instance? :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [Image resize DLL]

      S 1 Reply Last reply
      0
      • C CPallini

        savitri wrote:

        Reply me As Soon As Possible..

        [military tone] Of course, Sir! [/military tone] If the function requires a pointer to a BSTR object, why are you passing a CString instance? :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [Image resize DLL]

        S Offline
        S Offline
        savitri
        wrote on last edited by
        #3

        Hii.. If i took variable of type BSTR* then also it is giving error...please tell me what type i have to use...I am not getting how to use this give me some suggestions please.. Thanks in advance, Savitri..

        C 1 Reply Last reply
        0
        • S savitri

          Hii.. If i took variable of type BSTR* then also it is giving error...please tell me what type i have to use...I am not getting how to use this give me some suggestions please.. Thanks in advance, Savitri..

          C Offline
          C Offline
          CPallini
          wrote on last edited by
          #4

          Please show your (updated) code. :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [Image resize DLL]

          S 1 Reply Last reply
          0
          • C CPallini

            Please show your (updated) code. :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [Image resize DLL]

            S Offline
            S Offline
            savitri
            wrote on last edited by
            #5

            ok i am giving u activex code and aslo my program code .. This activex is in VB..my variable of type string in vb but after adding activex it is converting as BSTR. ActiveX code is : void C_UserControl1::Processattendacne(BSTR* strProcess) { static BYTE parms[] = VTS_PBSTR; InvokeHelper(0x60030000, DISPATCH_METHOD, VT_EMPTY, NULL, parms, strProcess); } My code is : void CPassingVarsDlg::OnGetIt() { // TODO: Add your control notification handler code here CString str='s'; m_UserVariable.Processattendacne(str); } please tell me how to solve this problem.. Thanks Alot Savitri

            C 1 Reply Last reply
            0
            • S savitri

              ok i am giving u activex code and aslo my program code .. This activex is in VB..my variable of type string in vb but after adding activex it is converting as BSTR. ActiveX code is : void C_UserControl1::Processattendacne(BSTR* strProcess) { static BYTE parms[] = VTS_PBSTR; InvokeHelper(0x60030000, DISPATCH_METHOD, VT_EMPTY, NULL, parms, strProcess); } My code is : void CPassingVarsDlg::OnGetIt() { // TODO: Add your control notification handler code here CString str='s'; m_UserVariable.Processattendacne(str); } please tell me how to solve this problem.. Thanks Alot Savitri

              C Offline
              C Offline
              CPallini
              wrote on last edited by
              #6

              savitri wrote:

              CString str='s'; m_UserVariable.Processattendacne(str);

              I don't see any BSTR * variable in the above code. :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [Image resize DLL]

              S 1 Reply Last reply
              0
              • C CPallini

                savitri wrote:

                CString str='s'; m_UserVariable.Processattendacne(str);

                I don't see any BSTR * variable in the above code. :)

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [Image resize DLL]

                S Offline
                S Offline
                savitri
                wrote on last edited by
                #7

                first i used BSTR* only but that time aslo giving error..so i changed again to CString only..I am fed up of this VB ocx..or tell me steps of adding vb dll into vc program..please tell me i am getting tension.. Thanks in advance, savitri

                C 1 Reply Last reply
                0
                • S savitri

                  first i used BSTR* only but that time aslo giving error..so i changed again to CString only..I am fed up of this VB ocx..or tell me steps of adding vb dll into vc program..please tell me i am getting tension.. Thanks in advance, savitri

                  C Offline
                  C Offline
                  CPallini
                  wrote on last edited by
                  #8

                  Probably you have to change the following lines

                  CString str='s';
                  m_UserVariable.Processattendacne(str);

                  to something similar to (error checking omitted)

                  BSTR bstr = SysAllocString(L"s");
                  m_UserVariable.Processattendacne(&bstr);
                  SysFreeString(bstr);

                  :)

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                  [Image resize DLL]

                  S 1 Reply Last reply
                  0
                  • C CPallini

                    Probably you have to change the following lines

                    CString str='s';
                    m_UserVariable.Processattendacne(str);

                    to something similar to (error checking omitted)

                    BSTR bstr = SysAllocString(L"s");
                    m_UserVariable.Processattendacne(&bstr);
                    SysFreeString(bstr);

                    :)

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                    [Image resize DLL]

                    S Offline
                    S Offline
                    savitri
                    wrote on last edited by
                    #9

                    Thanku very much..User technich is working properly...now i am inspered by you to learn more new things.. Please will u tell me how to take record set data from ocx and send to ocx.. in activex it is like this : void C_UserControl11::Processattendacne(LPDISPATCH* rs, LPDISPATCH* rs1, BOOL* blnprocess) { static BYTE parms[] = VTS_PDISPATCH VTS_PDISPATCH VTS_PBOOL; InvokeHelper(0x60030000, DISPATCH_METHOD, VT_EMPTY, NULL, parms, rs, rs1, blnprocess); } please tell me how to do this... give me some suggestions please... It is very helpful for me... Thanks aLot.. Savitri

                    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