[comp.windows.ms.programmer] How to handle structure with SDK HANDLE

qiu@cs.mcgill.ca (Zhiping QIU) (02/07/91)

Hi,

Does anybody out there know how to use HANDLE to define
class (or struct) and to do reference and de-reference?

I am now using Zortech C++ with Window SDK to set up an
application program. The program needs to use a large 
amount of memory which exceeds the local stack. It seems
that Zortech C++ has its own handle type which can solve
the problem as follows:

struct tree {
	char __handle *word;
	int count;
	struct tree __handle *left;
	struct tree __handle *right;
};

... ...

struct tree __handle *p;
p = (struct tree __handle *) 
	handle_calloc(sizeof(struct tree));
p-count ++; 	// it is the de-reference

... ...

But according to SDK's manual, the use of malloc and
calloc should be avoided although SDK has its own version
of them. And Zortech's handle_calloc obviously refers
those functions. So we should avoid using handle_calloc?

If I must use window's HANDLE to do that, how can I 
implement the above struct and its reference/dereference?

Thanks in advance.

---James Z. Qiu