>I am trying to create a pair of macros to change a printer setup in FPW2.5. I want the first one to go from the default printer, landscape, legal to generic/text (to send a report to a .txt file), and I want the second one to reverse that process.
>
>I can get my macro to access the printer setup dialog, but then it stops running. No changes are made. What's up? Do I have to have one macro to call up the dialog, and then have that macro call another macro to type in a few letter-commands in the dialog, or what?
>
>If there's a faster way to do this, like by changing printer settings in memory, I'm all for it, but I don't know how to do that either.
>
>I'd appreciate a little help here.
>
>TIA,
>\/\/\
Vernon,
I think you're doing a little too much work here. What you can
do is use the Windows API to do all your work for you. You'll
first need to have the FOXTOOLS.FLL library loaded. Then you'll
need the following declarations:
m.getstr = RegFN('GetProfileString', 'CCC@CI', 'I')
m.writestr = RegFN('WriteProfileString', 'CCC', 'I')
m.sendmsg = RegFN('SendMessage', 'III@C', 'I')
To retrieve the current default:
m.winsect = 'windows'
m.buffer = SPACE(100) + CHR(0)
m.buflen = LEN(m.buffer)
m.buflen = CallFN(m.getstr, m.winsect, 'device', "", @buffer,;
m.buflen)
m.defprn = LEFT(m.buffer, m.buflen)
Get the necessary information for the Generic/Text Only printer.
m.buffer = SPACE(100) + CHR(0)
m.buflen = LEN(m.buffer)
m.buflen = CallFN(m.getstr, 'PrinterPorts', 'Generic/Text Only',;
"", @buffer, m.buflen)
m.txtprn = LEFT(m.buffer, m.buflen)
Change to the text printer:
m.newdefprn = 'Generic/Text Only,'+ m.txtprn
= CallFN(m.writestr, m.winsect, 'device', m.newdefprn)
Let the world (all open applications) know about it, so they'll
reloaded the necessary WIN.INI section. This is a must.
Otherwise, all the above works, but has no effect.
= CallFN(m.sendmsg, 65535, 26, 0, @winsect)
Hope this helps.
George
George
Ubi caritas et amor, deus ibi est