>>pi2->pDevMode = pDevMode >>>
>>SendMessageTimeout(HWND_BROADCAST, WM_DEVMODECHANGE, 0L, >> (LPARAM)(LPCSTR)pPrinterName, SMTO_NORMAL, 1000, NULL); >>>
Declare Long SendMessageTimeout in User32 ; Long nhWnd, Long nMessage, Long wParam, String @lParam, ; Long nFlags, Long nTimeout, Long @dwResult SendMessageTimeout( HWND_BROADCAST, WM_DEVMODECHANGE, 0, ; cPrinterName, SMTO_NORMAL, 1000, 0 )Well, I think pointer is confusing to some VFP'er who knows a bit (or never use) a Low Level Language. Let's make it straight. The important thing is, from VFP POV, assume a pointer is just a NUMBER, that's it (that's all !!) don't get confuse. So you can use Integer or Long to pass in a parameter.
bFlag = GetPrinter(hPrinter, 2, 0, 0, &dwNeeded); pi2 = (PRINTER_INFO_2 *)GlobalAlloc(GPTR, dwNeeded); // The second GetPrinter fills in all the current settings, so all you // need to do is modify what you're interested in... bFlag = GetPrinter(hPrinter, 2, (LPBYTE)pi2, dwNeeded, &dwNeeded);You can convert it to VFP this way:
#Define GPTR 0x40 *** Since VFP also has internal GetPrinter() function, *** we need to change this API name to differentiate. Declare Long GetPrinter in WinSpool.Drv as API_GetPrinter ; Long hPrinter, Long nLevel, Long pPrnInfo, ; Long nBufSize, Long @nBufNeeded Declare Long GlobalAlloc in Kernel32 Long uFlags, Long dwBytes dwNeeded = 0 bFlag = API_GetPrinter( hPrinter, 2, 0, 0, @dwNeeded ) ** the return value is just a NUMBER. Or you can say... a POINTER :) pi2 = GlobalAlloc( GPTR, dwNeeded ) bFlag = API_GetPrinter( hPrinter, 2, pi2, dwNeeded, @dwNeeded )You see, it is very easy to use a Pointer in VFP :-)