Announcement

Collapse
No announcement yet.

C struct conversion question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • C struct conversion question

    Sorry for the basic question here folks. It's been a while and wheels are turning slowly this morning.

    I'm translating a header file and have the following structure:

    Code:
    'typedef struct ss_ct_createeditorcontrol_args
    '{
    '   LPTSTR lpszName;   // in: name of custom celltype
    '   HWND   hWndSpread; // in: HWND of Spread control
    '   long   lStyle;     // in: style for custom celltype
    '   int    CtrlId;     // in: Value to use for control id
    '   HWND   hWndEditor; // out: HWND of editor control
    '} SS_CT_CREATEEDITORCONTROL_ARGS, FAR *LPSS_CT_CREATEEDITORCONTROL_ARGS;
    I'm wondering how best to handle the first field in the corresponding PB TYPE declaration. Should I define lpszName as a DWORD or would an ASCIIZ PTR work?
    Bernard Ertl
    InterPlan Systems

  • #2
    Personally I'd go with ASCIIZ PTR.

    But you may use whatever you want, as long as the VALUE of that member ( a 32-bit integer) represents the address of a null-terminated string and you make your assignments in a manner consistent with your datatype choice.
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      ASCIIZ PTR is correct, DWORD or LONG could also be used also but it depends whether you will be referencing the string content of the pointer (@lpszName) after assignment, in which case you'd need ASCIIZ PTR.
      kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

      Comment

      Working...
      X