Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to pass an array by reference to DeviceCapabilities
Message
 
To
29/03/2000 07:38:14
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00351940
Message ID:
00352074
Views:
18
>We have the following situation: our program needs to set another printer as the default printer, with a particular user defined paper. Then, we came back to the original default printer. We maneged to do it in a Win95 environment. Now, we're changing to WinNT workstations, with both Win95 and WinNT spoolers. What happens?? The program is not getting the default paper size.
>
>We're trying to use the DeviceCapabilities API (winspool.drv) to determine with papers are available form a printer driver, and after this we must set the correct paper size.
>
>But... To use this API, we need to send an array by reference! How can we do it in FOX?

No, you can't. You'd need to either write a C++ DLL to wrap the functionality. Or use something like Christof Lange's Structures or Ed Rauh's CLSHEAP files which are available in the download section under Win32 and Other APIs.

>PS. Is there any difference between using the DECLARE statement and the old Regfn32 in FoxTools.fll? It works only with the second one.

Quite a bit. RegFN32 and CallFN32 are unneeded for dealing with the API. RegFN32 returns a "handle" (for want of a better term) to the function that CallFN32 needs to use. There's also a different way of declaring the parameter list and return values, plus you call the function directly. For example, here's the declaration and usage of the FindWindow() API call.
* Using RegFN32/CallFN32
* lccaption is the caption to find
nFindWind = RegFN32('FindWindow', '@C@C', 'I')
lnhwnd = CallFN32(nFindWind, 0, @lccaption)
* DECLARE - DLL
DECLARE INTEGER FindWindow IN Win32API;
  STRING @lpclassname, STRING @lpcaption
lnhwnd = FindWindow(0, @lccaption)
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform