Undefined Value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • krishnasamy
    New Member
    • Jun 2007
    • 31

    Undefined Value

    Hi,

    I have declaring the variable following way in vc++,

    BYTE* pTemplate = NULL;

    BYTE* pTemp;

    When I Trace the "pTemplate" value at runtime which returns "<Undefined Value>".

    The same in C# defined,

    IntPtr pTemplate
    byte[] template = null;
    IntPtr pTemp;

    what is the problem of defining in vc++?
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    Originally posted by krishnasamy
    Hi,

    I have declaring the variable following way in vc++,

    BYTE* pTemplate = NULL;

    BYTE* pTemp;

    When I Trace the "pTemplate" value at runtime which returns "<Undefined Value>".

    The same in C# defined,

    IntPtr pTemplate
    byte[] template = null;
    IntPtr pTemp;

    what is the problem of defining in vc++?

    What is BYTE?
    Is that any user defined Data Type?
    And please could you give me the whole code so that I can trace it?

    Kind regards,
    Dmjpro.

    Comment

    • krishnasamy
      New Member
      • Jun 2007
      • 31

      #3
      Originally posted by dmjpro
      What is BYTE?
      Is that any user defined Data Type?
      And please could you give me the whole code so that I can trace it?

      Kind regards,
      Dmjpro.

      Hi,
      Thanks for your reply.

      When i give the definition of that BYTE type i get the following reference in system header file.

      typedef unsigned char BYTE;

      Its not user defined data type. Its based vc6.0 data type.

      Here i given my code.
      [code=c]
      BYTE* pTemplate = NULL;
      BYTE* pTemp;
      int err = PR2_Ptr(IPhandl e, 1, Data, pTemp, size, quality, FALSE, 500, 500);
      txt_ChkRet->Text = err.ToString();
      [/code]
      Last edited by Banfa; Aug 28 '07, 10:34 AM. Reason: Added [code]...[/code] round the code

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        What does the function PR2_Ptr do?
        What does the function PR2_Ptr expect to be passed as arguments?

        I suspect the problem is that you pass PR2_Ptr the pTemp parameter which is a NULL pointer, I think you probably need to allocate memory to it first.

        Comment

        • krishnasamy
          New Member
          • Jun 2007
          • 31

          #5
          Originally posted by Banfa
          What does the function PR2_Ptr do?
          What does the function PR2_Ptr expect to be passed as arguments?

          I suspect the problem is that you pass PR2_Ptr the pTemp parameter which is a NULL pointer, I think you probably need to allocate memory to it first.
          Thanks for your reply.

          PR2_Ptr is a Function Prototype. I declare that below way,

          typedef int (CALLBACK* PROC2_IP) ( IDS_HANDLE hHandle, int numFingers, CaptureData pData[], BYTE* &pTemplate, unsigned int &size, unsigned char &quality, bool bQuick, int MaxWidth, int MaxHeight);

          HINSTANCE hinstLib_IP;

          INIT_IP IP_InitPtr;
          PROC2_IP PR2_Ptr;

          PR2_Ptr = (PROC2_IP) GetProcAddress( hinstLib_IP, "process2") ;

          if (fRunTimeLinkSu ccess = (PR2_Ptr != NULL))
          (PR2_Ptr);


          int err = PR2_Ptr(IPhandl e, 1, Data, pTemplate, size, quality, FALSE, 500, 500);

          txt_ChkRet->Text = err.ToString();


          I have used above code. How to allocate the memory to pTemplate?

          Please suggest me.

          Comment

          Working...