Newsgroups: comp.windows.ms.programmer Path: utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!geac!aimed!nick From: nick@aimed.uucp (Nick Pemberton) Subject: SwitchStackTo args in DLLs... Organization: Artificial Intelligence in Medicine Date: Fri, 31 May 91 16:39:00 GMT Message-ID: <1991May31.163900.10682@aimed.uucp> 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