[comp.windows.ms.programmer] SwitchStackTo args in DLLs...

nick@aimed.uucp (Nick Pemberton) (05/31/91)

Greetings all.

I while back I asked about calling C functions from within a DLL - wanted
to avoid DS != SS... Anyway, some one suggested I use the 
SwitchTaskTo function. I have since got a chance to get back to this, and
find myself wondering what the args to SwitchTaskTo ought to be (its
counterpart, SwitchTaskBack looks easy enough :-)

It takes three parameters, wStackSegment, wStackPointer and wStackTop.

How does one derive these?

For example, lets say I've just read a string in from the serial port,
and I want to use sscanf() on it.

1) How should I declare a variable, say buffer, for use here. More
   importantly, *when* should I declare it?

2) Would the code be something like this:

.
.
.

Dllfunction(arg1, arg2...)
.
.
{
	char buffer[256];
.
.
.
	SwitchTaskTo(what,goes,here);
	sscanf(buffer,"whatever", var1, var2, etc);
	SwitchTaskBack();

.
.
.
}

I'm really not sure how to use this. And I can't find a great long 
discussion of it in the SDK manuals...

Thanks,

Nick


-- 
Nick Pemberton  		 uucp: !{lsuc, uunet!mnetor}!aimed!nick
AIM, Inc			  bus: (416) 429-1085
Toronto, Ontario, Canada         Home: (416) 690-0647