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. /GS compile option

/GS compile option

Scheduled Pinned Locked Moved C / C++ / MFC
help
16 Posts 3 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

    yesterday you help me out to solve my dll problem ther only i am getting this error while inserting data through dll to sqlserver......if you want i can copy paste that code agin to help me..pls

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

    With_problem wrote:

    yesterday you help me out to solve my dll problem

    Ohh ! you have changed your nick name.

    With_problem wrote:

    i am getting this error while inserting data through dll to sqlserver

    If you see the callstack, it might point you in the code, where the problem is.

    With_problem wrote:

    ......if you want i can copy paste that code agin to help me..pls

    Its better to post code again. Its not me , who only is seeing this post. And everbody would not want to track your last post. And it would be helpful if you tell where debugger taking you in the callstack.

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

    W 1 Reply Last reply
    0
    • P prasad_som

      With_problem wrote:

      yesterday you help me out to solve my dll problem

      Ohh ! you have changed your nick name.

      With_problem wrote:

      i am getting this error while inserting data through dll to sqlserver

      If you see the callstack, it might point you in the code, where the problem is.

      With_problem wrote:

      ......if you want i can copy paste that code agin to help me..pls

      Its better to post code again. Its not me , who only is seeing this post. And everbody would not want to track your last post. And it would be helpful if you tell where debugger taking you in the callstack.

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

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

      this is my code......

      typedef int (CALLBACK* Set_Quote_DB)(unsigned short**,short*,unsigned short**,unsigned short**,unsigned short**,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
      HINSTANCE hInstance=LoadLibrary("WartzODLCOM.dll");
      Set_Quote_DB SetQuote;
      SetQuote = (Set_Quote_DB)GetProcAddress(hInstance,"setQuoteToDb");

      SessID=SessionId;
      CurrentRequestId=RequestId;
      
      CString marketstate,marketno,bid\_d,ask\_d;
      
      marketno.Format("%d",MarketNo);
      bid\_d.Format("%c",BidDirection);
      ask\_d.Format("%c",AskDirection);
      marketstate.Format("%d",MarketState);
      
      
      m\_MainEdit=m\_MainEdit + " + SessionId + "\\t" + RequestId +"\\t"+ a ; 
      m\_MainEdit=m\_MainEdit + "\\t"+ Market + Bid  + b + Ask +c +"\\t "+ High + "\\t";
      m\_MainEdit=m\_MainEdit + Low + "\\t" + d + "   "+ "\\t" + Timestamp + "\\r\\n"; 
      
      UpdateData(FALSE);
      iLineCount=m\_EditCtrl.GetLineCount();
      m\_EditCtrl.LineScroll(iLineCount);
      
      
      USES\_CONVERSION;
      BSTR bsTimeStamp = A2BSTR(Timestamp);
      BSTR bsMarket =  A2BSTR(Market);
      BSTR bsBid = A2BSTR(Bid);
      BSTR bsAsk = A2BSTR(Ask);
                  
          // debugging error when calling this function...of dll....access violation
      HRESULT hResult = SetQuote(&bsTimeStamp,&MarketNo,&bsMarket,&bsAsk,&bsBid,&MarketState);
      if(FAILED(hResult))
      {
      	AfxMessageBox(\_T("Error  inserting record"));
      	return;
      }
      else
      {
      	MessageBox(\_T("data entered" ));
      }
      
      SysFreeString(bsTimeStamp);
      SysFreeString(bsMarket);
      SysFreeString(bsBid);
      SysFreeString(bsAsk);
      
      FreeLibrary( hInstance );
      

      }

      -- modified at 3:02 Friday 15th December, 2006

      P 1 Reply Last reply
      0
      • W With_problem

        this is my code......

        typedef int (CALLBACK* Set_Quote_DB)(unsigned short**,short*,unsigned short**,unsigned short**,unsigned short**,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
        HINSTANCE hInstance=LoadLibrary("WartzODLCOM.dll");
        Set_Quote_DB SetQuote;
        SetQuote = (Set_Quote_DB)GetProcAddress(hInstance,"setQuoteToDb");

        SessID=SessionId;
        CurrentRequestId=RequestId;
        
        CString marketstate,marketno,bid\_d,ask\_d;
        
        marketno.Format("%d",MarketNo);
        bid\_d.Format("%c",BidDirection);
        ask\_d.Format("%c",AskDirection);
        marketstate.Format("%d",MarketState);
        
        
        m\_MainEdit=m\_MainEdit + " + SessionId + "\\t" + RequestId +"\\t"+ a ; 
        m\_MainEdit=m\_MainEdit + "\\t"+ Market + Bid  + b + Ask +c +"\\t "+ High + "\\t";
        m\_MainEdit=m\_MainEdit + Low + "\\t" + d + "   "+ "\\t" + Timestamp + "\\r\\n"; 
        
        UpdateData(FALSE);
        iLineCount=m\_EditCtrl.GetLineCount();
        m\_EditCtrl.LineScroll(iLineCount);
        
        
        USES\_CONVERSION;
        BSTR bsTimeStamp = A2BSTR(Timestamp);
        BSTR bsMarket =  A2BSTR(Market);
        BSTR bsBid = A2BSTR(Bid);
        BSTR bsAsk = A2BSTR(Ask);
                    
            // debugging error when calling this function...of dll....access violation
        HRESULT hResult = SetQuote(&bsTimeStamp,&MarketNo,&bsMarket,&bsAsk,&bsBid,&MarketState);
        if(FAILED(hResult))
        {
        	AfxMessageBox(\_T("Error  inserting record"));
        	return;
        }
        else
        {
        	MessageBox(\_T("data entered" ));
        }
        
        SysFreeString(bsTimeStamp);
        SysFreeString(bsMarket);
        SysFreeString(bsBid);
        SysFreeString(bsAsk);
        
        FreeLibrary( hInstance );
        

        }

        -- modified at 3:02 Friday 15th December, 2006

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

        With_problem wrote:

        HINSTANCE hInstance=LoadLibrary("WartzODLCOM.dll"); Set_Quote_DB SetQuote; SetQuote = (Set_Quote_DB)GetProcAddress(hInstance,"setQuoteToDb");

        Have you checked hInstance, SetQuote for NULL. I'm sure its NULL in your case.

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

        W 1 Reply Last reply
        0
        • P prasad_som

          With_problem wrote:

          HINSTANCE hInstance=LoadLibrary("WartzODLCOM.dll"); Set_Quote_DB SetQuote; SetQuote = (Set_Quote_DB)GetProcAddress(hInstance,"setQuoteToDb");

          Have you checked hInstance, SetQuote for NULL. I'm sure its NULL in your case.

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

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

          sorry to bother you but can you tell me how to check...i am very new to vc++

          P 1 Reply Last reply
          0
          • W With_problem

            sorry to bother you but can you tell me how to check...i am very new to vc++

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

            INSTANCE hInstance=LoadLibrary("WartzODLCOM.dll");
            if (hInstance == NULL)
            {
            // dont go further
            return;
            }
            Set_Quote_DB SetQuote;
            SetQuote = (Set_Quote_DB)GetProcAddress(hInstance,"setQuoteToDb");
            if (SetQuote == NULL)
            {
            // dont go further
            return;
            }

            I advise you to learn basic c/c++, before adventuring further.

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

            W 1 Reply Last reply
            0
            • P prasad_som

              INSTANCE hInstance=LoadLibrary("WartzODLCOM.dll");
              if (hInstance == NULL)
              {
              // dont go further
              return;
              }
              Set_Quote_DB SetQuote;
              SetQuote = (Set_Quote_DB)GetProcAddress(hInstance,"setQuoteToDb");
              if (SetQuote == NULL)
              {
              // dont go further
              return;
              }

              I advise you to learn basic c/c++, before adventuring further.

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

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

              Thanks for your advice.....i really dont know vc++/c++ but i got this project to be done...and i have no option...but ya after finishing this project this is last stage inserting the data i will first learn this lang. from basic. And now about the problem..now it is ok no error but now it has stoped displaing anything in edit box...and also not inserting the data...any clue

              P 1 Reply Last reply
              0
              • W With_problem

                Thanks for your advice.....i really dont know vc++/c++ but i got this project to be done...and i have no option...but ya after finishing this project this is last stage inserting the data i will first learn this lang. from basic. And now about the problem..now it is ok no error but now it has stoped displaing anything in edit box...and also not inserting the data...any clue

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

                With_problem wrote:

                now it is ok no error but now it has stoped displaing anything in edit box...and also not inserting the data...any clue

                It is because, either your dll is not loaded, or not getting address of function you required. Check from where it is returning, check valid dll is present it the path you mentioned.

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

                W 1 Reply Last reply
                0
                • P prasad_som

                  With_problem wrote:

                  now it is ok no error but now it has stoped displaing anything in edit box...and also not inserting the data...any clue

                  It is because, either your dll is not loaded, or not getting address of function you required. Check from where it is returning, check valid dll is present it the path you mentioned.

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

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

                  yes i have checked my for dll : project->setting->link->C:\ActiveXdll\WartzODLCOM.lib And in c: drive also it is present wartzODLCOM.dll and .lib is present And i have "#define WartzODLCOM" in my cpp file include where i am calling this dll function... Now whats wrong here....:doh: (Or should i need to include header file of dll in my project and then call function.....) -- modified at 4:48 Friday 15th December, 2006

                  P 1 Reply Last reply
                  0
                  • W With_problem

                    yes i have checked my for dll : project->setting->link->C:\ActiveXdll\WartzODLCOM.lib And in c: drive also it is present wartzODLCOM.dll and .lib is present And i have "#define WartzODLCOM" in my cpp file include where i am calling this dll function... Now whats wrong here....:doh: (Or should i need to include header file of dll in my project and then call function.....) -- modified at 4:48 Friday 15th December, 2006

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

                    With_problem wrote:

                    project->setting->link->C:\ActiveXdll\WartzODLCOM.lib

                    I this case you can directly call dll function. I would suggest reading this series of article[^] to understand usage of dlls.

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

                    1 Reply Last reply
                    0
                    • W With_problem

                      I am trying to include strsafe.h file to also my project but there is error no such file r directory.......can you help me how to solve this

                      Z Offline
                      Z Offline
                      zeemalik
                      wrote on last edited by
                      #16

                      make sure that you have updated Windows Plateform SDK if not you can download and install it from "http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en" because the library which contains the "strsafe.h" functions won't be availaible to you without installing SDK. Once u have installed SDK go to Start->Programs->Microsoft Plateform SDK for Windows Server 2003 SPI->Visual Studio Registration->Registerd PSDK Directories with Visual Studio. Once you have done with it you have to include the "strsafe.lib" in your program from Projects->Settings->Link. Now include the "strsafe.h" in your program and and enjoy using strsafe functions. VV IMPORTANT : Include "strsafe.h" at the end of all other include directives. Thanks and Regards, Love Zeeshan Malik

                      Prepare yourseld for the life after death.God bless you.

                      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