Making a structure with ot4xb

This forum is for general support of Xbase++
Post Reply
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Making a structure with ot4xb

#1 Post by rdonnay »

I have a customer who needs to add custom forms to printers via code.

Windows has an API call named AddForm() under Printer Spooler functions.

This requires a structure.

I understand that ot4xb has features that are supposed to make it easier to create structures rather than using BAP.
I don't see any examples of this.

Does anyone have a sample?
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1406
Joined: Wed Feb 24, 2010 3:44 pm

Re: Making a structure with ot4xb

#2 Post by Auge_Ohr »

rdonnay wrote:Does anyone have a sample?
i guess you have download Source of ot4xb too.
in \Source\winapi_CommonStructures.cpp you will find a lot of Structure ready to use.
as Attachment Sample EnumPrinters.zip which also show how to write own Structure.
EnumPrinters.zip
(42.77 KiB) Downloaded 708 times
greetings by OHR
Jimmy

User avatar
Tom
Posts: 1170
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Making a structure with ot4xb

#3 Post by Tom »

You don't need any source. What you need is a correct description of the structure. Structures in OT4XB are class objects, created this way:

Code: Select all

BEGIN STRUCTURE oMyStructureName
  MEMBER UNIT _FirstPara
  MEMBER HWND _hWnd
  MEMBER BOOL _lWhatever
END STRUCTURE
This code should be at the end of the PRG. The structure object itself is created this way:

Code: Select all

oStruct := oMyStructureName():New()
All elements can be populated after that:

Code: Select all

oStruct:_FirstPara := 15
oStruct:_lWhatever := .T.
If you get a pointer to an existing structure of that kind somewhere, like in a callback, do this:

Code: Select all

FUNCTION MyCallBack(nStructPtr)
LOCAL oStruct := oMyStructureNAme():New():_link_(nStructPtr,.T.)
The last parameter (.T.) means that a copy of the structure is used here.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Post Reply