Need Help please
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Need Help please

  1. #1
    Join Date
    Feb 2013
    Posts
    3

    Unhappy Need Help please

    What do i do wrong here?

    I have Mq4 platform calling functions from DLL some how it doesnt make any differents when I make the call....


    // DLL Code

    #define WIN32_LEAN_AND_MEAN
    #define MT4_EXPFUNC __declspec(dllexport)

    using namespace std;
    std::string My_String;
    #define stringify(mymonths ) # mymonths

    #pragma pack(push,1)
    struct RateInfo { unsigned int ctm; double open; double low; double high; double close; double vol; };
    struct MqlStr { int len; char *string; };
    #pragma pack(pop)


    int BarsCount = 2000;

    MT4_EXPFUNC bool _stdcall StartRulls(int bars)
    {
    bool result = false;

    if (bars > BarsCount) result = true;

    return(result);
    }


    //Mqh Lib File /* My_Lib.mqh */

    #import "My_DLL.dll"


    bool StartRulls(int bars);

    #import


    //mq4 code My_Mq4.mq4

    #include <My_Lib.mqh>

    I call this function

    bool counts = StartRulls(bars);

    Print("counts =",counts );

    2013.02.09 23:03:24 2010.03.31 16:37 My_Mq4.mq4 EURCAD,M5: counts = 1

    My result always stays 1

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,392

    Re: Need Help please

    Quote Originally Posted by MT4_EXPFUNC View Post
    I call this function

    Code:
    bool counts =  StartRulls(bars);
    
    Print("counts =",counts );
    2013.02.09 23:03:24 2010.03.31 16:37 My_Mq4.mq4 EURCAD,M5: counts = 1

    My result always stays 1
    I have no idea what this function Print does, but bool type can take only two values: either true or false. So what else info are you trying to get from it?
    Victor Nijegorodov

  3. #3
    Join Date
    Feb 2013
    Posts
    3

    Re: Need Help please

    My DLL does receives numeric number based on my bars on my chart, so when it counts over 2000 , I want my bool value change from 0 to 1 or from false to true.... bars always reads from mt4 functions " Bars " which I use to get bars counts value from mq4 pass it over to dll check the bar value, if bars are more then 2000 then change the return value....

  4. #4
    Join Date
    Feb 2013
    Posts
    3

    Re: Need Help please

    My DLL does receives numeric number based on my bars on my chart, so when it counts over 2000 , I want my bool value change from 0 to 1 or from false to true.... bars always reads from mt4 functions " Bars " which I use to get bars counts value from mq4 pass it over to dll check the bar value, if bars are more then 2000 then change the return value.... Thank you so much for the reply !!

  5. #5
    Join Date
    Apr 1999
    Posts
    27,427

    Re: Need Help please

    Quote Originally Posted by MT4_EXPFUNC View Post
    My DLL does receives numeric number based on my bars on my chart, so when it counts over 2000 , I want my bool value change from 0 to 1 or from false to true.... bars always reads from mt4 functions " Bars " which I use to get bars counts value from mq4 pass it over to dll check the bar value, if bars are more then 2000 then change the return value.... Thank you so much for the reply !!
    First, use code tags when posting code. The code you posted is unformatted and practically unreadable.

    Second, you didn't show us a complete program. Where does "bars" come from when you call the DLL function? It just pops up out of nowhere -- who knows where it comes from, what value it has, where it was declared, nothing. How are we to know if your function works if the argument you're passing to it is not known by anyone looking at your post?
    Code:
    #include <My_Lib.mqh>
    #include <iostream>
    
    using namespace std;
    int main()
    {
       cout << StartRulls(1) <<  "\n" << StartRulls(2001) << "\n";
    }
    So what does this print? Note that there are no unknowns such as a mysterious "bars" variable. I called the function with known values to see what happens.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; February 10th, 2013 at 04:53 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center