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. C / C++ / MFC
  4. calling function...dll

calling function...dll

Scheduled Pinned Locked Moved C / C++ / MFC
helpdatabasesysadmin
13 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.
  • W With_problem

    //This is dll function which i am calling to insert data short setQuoteToDB(BSTR* strDateTimeStamp, short* intMarketNo, BSTR* strMarketName, BSTR* strBid, BSTR* strAsk, short* intMarketState); // This is function from which i am getting data fom remote server void CArielProjectVer2Dlg::OnPriceChangeArielapictrl1(LPCTSTR SessionId, LPCTSTR RequestId, short MarketNo, LPCTSTR Market, LPCTSTR Bid, short BidDirection, LPCTSTR Ask, short AskDirection, LPCTSTR High, LPCTSTR Low, short MarketState, LPCTSTR Timestamp) Now when i call this dll function....setQuotetoDB...by passing parameter i got error setQuoteToDB(Timestamp,marketno,Market,ask_d,bid_d,marketstate); What should i do so that i can insert data...in database...any help...

    P Offline
    P Offline
    prasad_som
    wrote on last edited by
    #2

    abrakadbra wrote:

    Now when i call this dll function....setQuotetoDB...by passing parameter i got error

    Which error ?

    Prasad Notifier using ATL | Operator new[],delete[][^]

    W 1 Reply Last reply
    0
    • P prasad_som

      abrakadbra wrote:

      Now when i call this dll function....setQuotetoDB...by passing parameter i got error

      Which error ?

      Prasad Notifier using ATL | Operator new[],delete[][^]

      W Offline
      W Offline
      With_problem
      wrote on last edited by
      #3

      setQuoteToDB' : cannot convert parameter 1 from 'const char *' to 'unsigned short ** '

      P 1 Reply Last reply
      0
      • W With_problem

        setQuoteToDB' : cannot convert parameter 1 from 'const char *' to 'unsigned short ** '

        P Offline
        P Offline
        prasad_som
        wrote on last edited by
        #4

        You are passing LPCTSTR in place of BSTR*. Convert LPCTSTR to BSTR by using

        USES_CONVERSION;
        BSTR b =A2BSTR(lpszText);//lpszText is LPCSTR

        and pass it address to wherever BSTR* is required.

        Prasad Notifier using ATL | Operator new[],delete[][^]

        W 1 Reply Last reply
        0
        • P prasad_som

          You are passing LPCTSTR in place of BSTR*. Convert LPCTSTR to BSTR by using

          USES_CONVERSION;
          BSTR b =A2BSTR(lpszText);//lpszText is LPCSTR

          and pass it address to wherever BSTR* is required.

          Prasad Notifier using ATL | Operator new[],delete[][^]

          W Offline
          W Offline
          With_problem
          wrote on last edited by
          #5

          Can you tell me more clearly...by writing one converting data type...i am very thankful to you

          1 Reply Last reply
          0
          • W With_problem

            //This is dll function which i am calling to insert data short setQuoteToDB(BSTR* strDateTimeStamp, short* intMarketNo, BSTR* strMarketName, BSTR* strBid, BSTR* strAsk, short* intMarketState); // This is function from which i am getting data fom remote server void CArielProjectVer2Dlg::OnPriceChangeArielapictrl1(LPCTSTR SessionId, LPCTSTR RequestId, short MarketNo, LPCTSTR Market, LPCTSTR Bid, short BidDirection, LPCTSTR Ask, short AskDirection, LPCTSTR High, LPCTSTR Low, short MarketState, LPCTSTR Timestamp) Now when i call this dll function....setQuotetoDB...by passing parameter i got error setQuoteToDB(Timestamp,marketno,Market,ask_d,bid_d,marketstate); What should i do so that i can insert data...in database...any help...

            P Offline
            P Offline
            prasad_som
            wrote on last edited by
            #6

            abrakadbra wrote:

            setQuoteToDB(Timestamp,marketno,Market,ask_d,bid_d,marketstate

            This call would go like,

            USES_CONVERSION;
            BSTR bsTimeStamp = A2BSTR(Timestamp);
            BSTR bsMarket = A2BSTR(Market);
            BSTR bsBid = A2BSTR(Bid);
            BSTR bsAsk = A2BSTR(Ask);
            setQuoteToDB(&bsTimeStamp,&marketno,&bsMarket,&bsAsk,&bsBid,&marketstate);
            // in above call short* parameter will go as it is
            SysFreeString(bsTimeStamp);
            SysFreeString(bsMarket);
            SysFreeString(bsBid);
            SysFreeString(bsAsk);

            Prasad Notifier using ATL | Operator new[],delete[][^]

            W 3 Replies Last reply
            0
            • P prasad_som

              abrakadbra wrote:

              setQuoteToDB(Timestamp,marketno,Market,ask_d,bid_d,marketstate

              This call would go like,

              USES_CONVERSION;
              BSTR bsTimeStamp = A2BSTR(Timestamp);
              BSTR bsMarket = A2BSTR(Market);
              BSTR bsBid = A2BSTR(Bid);
              BSTR bsAsk = A2BSTR(Ask);
              setQuoteToDB(&bsTimeStamp,&marketno,&bsMarket,&bsAsk,&bsBid,&marketstate);
              // in above call short* parameter will go as it is
              SysFreeString(bsTimeStamp);
              SysFreeString(bsMarket);
              SysFreeString(bsBid);
              SysFreeString(bsAsk);

              Prasad Notifier using ATL | Operator new[],delete[][^]

              W Offline
              W Offline
              With_problem
              wrote on last edited by
              #7

              I am really thankful for your effort....i am trying to solve this from past 20 days but now i am getting error for 'setQuoteToDB' : cannot convert parameter 2 from 'class CString *' to 'short *' How to solve this....pls

              1 Reply Last reply
              0
              • P prasad_som

                abrakadbra wrote:

                setQuoteToDB(Timestamp,marketno,Market,ask_d,bid_d,marketstate

                This call would go like,

                USES_CONVERSION;
                BSTR bsTimeStamp = A2BSTR(Timestamp);
                BSTR bsMarket = A2BSTR(Market);
                BSTR bsBid = A2BSTR(Bid);
                BSTR bsAsk = A2BSTR(Ask);
                setQuoteToDB(&bsTimeStamp,&marketno,&bsMarket,&bsAsk,&bsBid,&marketstate);
                // in above call short* parameter will go as it is
                SysFreeString(bsTimeStamp);
                SysFreeString(bsMarket);
                SysFreeString(bsBid);
                SysFreeString(bsAsk);

                Prasad Notifier using ATL | Operator new[],delete[][^]

                W Offline
                W Offline
                With_problem
                wrote on last edited by
                #8

                I have define 1)marketno and market state as CString to format(marketno.Format("%d",MarketNo); 2)marketstate.Format("%d",MarketState);

                1 Reply Last reply
                0
                • P prasad_som

                  abrakadbra wrote:

                  setQuoteToDB(Timestamp,marketno,Market,ask_d,bid_d,marketstate

                  This call would go like,

                  USES_CONVERSION;
                  BSTR bsTimeStamp = A2BSTR(Timestamp);
                  BSTR bsMarket = A2BSTR(Market);
                  BSTR bsBid = A2BSTR(Bid);
                  BSTR bsAsk = A2BSTR(Ask);
                  setQuoteToDB(&bsTimeStamp,&marketno,&bsMarket,&bsAsk,&bsBid,&marketstate);
                  // in above call short* parameter will go as it is
                  SysFreeString(bsTimeStamp);
                  SysFreeString(bsMarket);
                  SysFreeString(bsBid);
                  SysFreeString(bsAsk);

                  Prasad Notifier using ATL | Operator new[],delete[][^]

                  W Offline
                  W Offline
                  With_problem
                  wrote on last edited by
                  #9

                  you are not going to hlp me anymore????pls help me....:(

                  P 1 Reply Last reply
                  0
                  • W With_problem

                    you are not going to hlp me anymore????pls help me....:(

                    P Offline
                    P Offline
                    prasad_som
                    wrote on last edited by
                    #10

                    To make others solve your problem, you need to give complete/clear problem definition. You can convert CString to BSTR using CString::AllocSysString().

                    Prasad Notifier using ATL | Operator new[],delete[][^]

                    W 1 Reply Last reply
                    0
                    • P prasad_som

                      To make others solve your problem, you need to give complete/clear problem definition. You can convert CString to BSTR using CString::AllocSysString().

                      Prasad Notifier using ATL | Operator new[],delete[][^]

                      W Offline
                      W Offline
                      With_problem
                      wrote on last edited by
                      #11

                      This is the complete code i am using and geeting error for marketno,and marketstate setQuoteToDB' : cannot convert parameter 2 from 'unsigned short ** ' to 'short *' void CArielProjectVer2Dlg::OnPriceChangeArielapictrl1(LPCTSTR SessionId, LPCTSTR RequestId, short MarketNo, LPCTSTR Market, LPCTSTR Bid, short BidDirection, LPCTSTR Ask, short AskDirection, LPCTSTR High, LPCTSTR Low, short MarketState, LPCTSTR Timestamp) { // TODO: Add your control notification handler code here SessID=SessionId; CurrentRequestId=RequestId; txtMarket = Market; // declaration of vaiable for marketno and market state as CString marketno.Format("%d",MarketNo); bid_d.Format("%c",BidDirection); ask_d.Format("%c",AskDirection); marketstate.Format("%d",MarketState); m_MainEdit=m_MainEdit + "" + SessionId + RequestId + marketno ; m_MainEdit=m_MainEdit + Market + Bid + bid_d + Ask +ask_d + High ; m_MainEdit=m_MainEdit + Low marketstate + Timestamp + "\r\n"; UpdateData(FALSE); iLineCount=m_EditCtrl.GetLineCount(); m_EditCtrl.LineScroll(iLineCount); USES_CONVERSION; BSTR bsmarketno = marketno.AllocSysString(); BSTR bsTimeStamp = A2BSTR(Timestamp); BSTR bsMarket = A2BSTR(Market); BSTR bsBid = A2BSTR(Bid); BSTR bsAsk = A2BSTR(Ask); setQuoteToDB(&bsTimeStamp,&bsmarketno,&bsMarket,&bsAsk,&bsBid,&marketstate); SysFreeString(bsTimeStamp); SysFreeString(bsMarket); SysFreeString(bsBid); SysFreeString(bsAsk); Error: setQuoteToDB' : cannot convert parameter 2 from 'unsigned short ** ' to 'short *'

                      P 1 Reply Last reply
                      0
                      • W With_problem

                        This is the complete code i am using and geeting error for marketno,and marketstate setQuoteToDB' : cannot convert parameter 2 from 'unsigned short ** ' to 'short *' void CArielProjectVer2Dlg::OnPriceChangeArielapictrl1(LPCTSTR SessionId, LPCTSTR RequestId, short MarketNo, LPCTSTR Market, LPCTSTR Bid, short BidDirection, LPCTSTR Ask, short AskDirection, LPCTSTR High, LPCTSTR Low, short MarketState, LPCTSTR Timestamp) { // TODO: Add your control notification handler code here SessID=SessionId; CurrentRequestId=RequestId; txtMarket = Market; // declaration of vaiable for marketno and market state as CString marketno.Format("%d",MarketNo); bid_d.Format("%c",BidDirection); ask_d.Format("%c",AskDirection); marketstate.Format("%d",MarketState); m_MainEdit=m_MainEdit + "" + SessionId + RequestId + marketno ; m_MainEdit=m_MainEdit + Market + Bid + bid_d + Ask +ask_d + High ; m_MainEdit=m_MainEdit + Low marketstate + Timestamp + "\r\n"; UpdateData(FALSE); iLineCount=m_EditCtrl.GetLineCount(); m_EditCtrl.LineScroll(iLineCount); USES_CONVERSION; BSTR bsmarketno = marketno.AllocSysString(); BSTR bsTimeStamp = A2BSTR(Timestamp); BSTR bsMarket = A2BSTR(Market); BSTR bsBid = A2BSTR(Bid); BSTR bsAsk = A2BSTR(Ask); setQuoteToDB(&bsTimeStamp,&bsmarketno,&bsMarket,&bsAsk,&bsBid,&marketstate); SysFreeString(bsTimeStamp); SysFreeString(bsMarket); SysFreeString(bsBid); SysFreeString(bsAsk); Error: setQuoteToDB' : cannot convert parameter 2 from 'unsigned short ** ' to 'short *'

                        P Offline
                        P Offline
                        prasad_som
                        wrote on last edited by
                        #12

                        abrakadbra wrote:

                        setQuoteToDB(&bsTimeStamp,&bsmarketno,&bsMarket,&bsAsk,&bsBid,&marketstate);

                        Second parameter is short*, you need to pass address of MarketNo. Your call would be like ;

                        setQuoteToDB(&bsTimeStamp,&MarketNo,&bsMarket,&bsAsk,&bsBid,&marketstate);

                        Prasad Notifier using ATL | Operator new[],delete[][^]

                        W 1 Reply Last reply
                        0
                        • P prasad_som

                          abrakadbra wrote:

                          setQuoteToDB(&bsTimeStamp,&bsmarketno,&bsMarket,&bsAsk,&bsBid,&marketstate);

                          Second parameter is short*, you need to pass address of MarketNo. Your call would be like ;

                          setQuoteToDB(&bsTimeStamp,&MarketNo,&bsMarket,&bsAsk,&bsBid,&marketstate);

                          Prasad Notifier using ATL | Operator new[],delete[][^]

                          W Offline
                          W Offline
                          With_problem
                          wrote on last edited by
                          #13

                          i have no word to say thank you:rose: Thanks again..now it is ok...

                          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