User Tag List

Page 3 of 3 FirstFirst 1 2 3
Results 21 to 27 of 27

Thread: Question about pointers to DOUBLEs (VC++6.0)

  1. #21
    Clicker Fusion 2.5 Developer

    Join Date
    May 2007
    Posts
    548
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Question about pointers to DOUBLEs (VC++6.0)

    Confirmed now. It's the pointer to the double. The function somehow accepts pointers to any basic types, even strings but not to doubles or floats.

    Is there any other way to pass arguments of unknown type to a function without using pointers? I tried with variants but with no success.

    Thanks.

  2. #22
    No Products Registered

    Join Date
    Jul 2006
    Posts
    379
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Question about pointers to DOUBLEs (VC++6.0)

    You could use unions, function overloading or templates, when writing a function which should take different parameters. What are you trying to do? What is the function used for?

    (If you want, you could send me the extension code, and I can tell you how to do it if you don't get it to work.)

  3. #23
    Clicker Fusion 2.5 Developer

    Join Date
    May 2007
    Posts
    548
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Question about pointers to DOUBLEs (VC++6.0)

    Hi, z33z. The function I use is this:

    Code:
    PutValue(comobj o, LPCOLESTR command, ...);
    The "..." represents infinite parameters with a *marker pointer.
    Now I call the function like this:

    Code:
    Put Value(rdPtr->obj, L"Columns(%s).Size = %e", param[0], param[1], param[2], param[3], param[4], param[5],
    param[6], param[7], param[8], param[9], param[10]);
    "%s" tells me the parameter is an LPSTR argument and "%e" is a double.

    The param[i] array is a pointer array which I change the types of each pointer individually depending on what is passed by the user. So I must have in param[0], by the example above, an LPSTR string and in param[1] a double. Since there are only two arguments in the command(%s and %e), the rest of the parameters passed will be NULL and that is acceptable by the function.

    The user passes as arguments a string like "A:E,250.95" which I extract the parameters individually and convert the pointer accordingly.

    Code:
    _variant_t parameter1;
    _variant_t parameter2;
    
    parameter1.ChangeType(VT_LPSTR);
    parameter1 = "A:E";
    parameter2.ChangeType(VT_R8);
    parameter2 = 250.95;
    
    param[0] = reinterpret_cast<void*>(ConvertBstrToAnsiStr(parameter1.bstrVal));
    param[1] = reinterpret_cast<void*>(&parameter2.dblVal);
    The rest of the parameters, I pass NULL. If in param[1], there is an int, the function will work correctly. I've tried with many parameters at the same time and if they are not of DOUBLE type, it'll work flawlessly.

    Can you see what's wrong here, please? If not, I can send you the source code. Thank you once again.

  4. #24
    No Products Registered

    Join Date
    Jul 2006
    Posts
    379
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Question about pointers to DOUBLEs (VC++6.0)

    Hmm, don't see it at first glance. You could send it to the_znail at hotmail.com and I can see if I can help you.

  5. #25
    Clicker Fusion 2.5 Developer

    Join Date
    May 2007
    Posts
    548
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Question about pointers to DOUBLEs (VC++6.0)

    Sure thing. Once I'm home, I'll do that.
    Thanks.

  6. #26
    Clicker Fusion 2.5 Developer

    Join Date
    May 2007
    Posts
    548
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Question about pointers to DOUBLEs (VC++6.0)

    Hi, z33z. The e-mail was sent.
    It's the source code with an example which shows the problem with the PUT VALUE function. Thanks.

  7. #27
    Clicker Fusion 2.5 Developer

    Join Date
    May 2007
    Posts
    548
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Question about pointers to DOUBLEs (VC++6.0)

    Hi, guys. Some news here.

    Now that I found a way to do it, I'm facing a horrible C1001 - INTERNAL COMPILER ERROR and, from what I've read so far, it's a compiler bug since other compilers like gcc can manage the same source code. It's when using a class as a template parameter and returning that class. Like:


    //V is a class
    template <typename TYPE>
    TYPE variant_cast<TYPE>(V &var)
    {
    return var;
    }

    So I'm on a quest to upgrade to Visual C++ 2005 Express. Does anyone use it? Sorry to be offtopic but I didn't want to create a new topic just for this post.

    Thank you. And happy kliking...

    Sincerely,


    Andre Guerreiro (byo)

Page 3 of 3 FirstFirst 1 2 3

Similar Threads

  1. An explanation of why I'm here, a few general pointers needed.
    By Tinez in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 26th January 2013, 05:43 PM

Posting Permissions

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