petermeachem
Programmer
This is long and a bit complex, and I'm very stuck.
1) VB5
2) Can't use common dialog ocx (don't worry why)
3) Found code to display Print Setup via dll. All fine.
4) Stupidly, VB uses only default printer and code found doesn't change same.
5) After a bit more hunting about, I found this.
retvalue = GetVersionExA(osinfo)
If osinfo.dwMajorVersion = 3 And osinfo.dwMinorVersion = 51 And osinfo.dwBuildNumber = 1057 And osinfo.dwPlatformId = 2 Then
Call WinNTSetDefaultPrinter(PrinterName)
ElseIf osinfo.dwMajorVersion = 4 And osinfo.dwMinorVersion = 0 And osinfo.dwBuildNumber = 67109814 And osinfo.dwPlatformId = 1
Then
Call Win95SetDefaultPrinter(PrinterName)
ElseIf osinfo.dwMajorVersion = 4 And osinfo.dwMinorVersion = 0 And osinfo.dwBuildNumber = 1381 And osinfo.dwPlatformId = 2 Then
Call WinNTSetDefaultPrinter(PrinterName)
End If
This works for nt, but not for win98 (major is 4 and minor is 10!). No idea about win2k.
So I put a default in.
6) The code for the subs is long, I'll mail it to you if you like.
7)The winnt sub does a sendmessage to tell all programmes that the default has changed, the win95 doesnt.
8) The problem is that on win98, I can change the default printer ok, (seen in start/settings/printers) but if I have already printed from my programme, it won't change the printer the programme uses. So I can change the default everywhere, apart from in my prog.
9) Well stuck!
1) VB5
2) Can't use common dialog ocx (don't worry why)
3) Found code to display Print Setup via dll. All fine.
4) Stupidly, VB uses only default printer and code found doesn't change same.
5) After a bit more hunting about, I found this.
retvalue = GetVersionExA(osinfo)
If osinfo.dwMajorVersion = 3 And osinfo.dwMinorVersion = 51 And osinfo.dwBuildNumber = 1057 And osinfo.dwPlatformId = 2 Then
Call WinNTSetDefaultPrinter(PrinterName)
ElseIf osinfo.dwMajorVersion = 4 And osinfo.dwMinorVersion = 0 And osinfo.dwBuildNumber = 67109814 And osinfo.dwPlatformId = 1
Then
Call Win95SetDefaultPrinter(PrinterName)
ElseIf osinfo.dwMajorVersion = 4 And osinfo.dwMinorVersion = 0 And osinfo.dwBuildNumber = 1381 And osinfo.dwPlatformId = 2 Then
Call WinNTSetDefaultPrinter(PrinterName)
End If
This works for nt, but not for win98 (major is 4 and minor is 10!). No idea about win2k.
So I put a default in.
6) The code for the subs is long, I'll mail it to you if you like.
7)The winnt sub does a sendmessage to tell all programmes that the default has changed, the win95 doesnt.
8) The problem is that on win98, I can change the default printer ok, (seen in start/settings/printers) but if I have already printed from my programme, it won't change the printer the programme uses. So I can change the default everywhere, apart from in my prog.
9) Well stuck!