>>Wow! This IS heavy artilery!
>>
>>I'll play with this tomorrow - I have a fryday today, and won't trust myself to get this right.
>>
>>In case of W9x, I'd probably just skip the whole thing and let them print... those poor guys don't need me to add to their troubles :). And I somehow don't expect the average user of the app to have anything old installed. These are the guys with new laptops :)
>
>
>Arrghg, there is a wrong thing in that sample. For the GlobalUnlock, it should be unlocking the handle instead of the pointer.
>
>** This
>GlobalUnlock( pDevMode )
>
>** Replace with this
>GlobalUnlock( hDevMode )
>
This thing really works! I had to make only one modification - to remove more than one type of printer, I passed the filter as a comma delimited list of no-no words, and then had to modify the loop to count shown printers backwards (For ln_I = ln_Counts TO 0 STEP -1) because when you remove one, the others shift.
I'm a bit worried, though - I have absolutely no control over the deployment of the app, it's a shrink wrap thing, I never see the target machines. Do you have any ideas on potentially dangerous (as in "may produce an error and cause phone calls") pieces of this, and how to make this as robust as possible? If it errors out, what does it do, return bad values or -?
Also, which functions are not there on archaic versions of Windows? I presume these would be in this part
lh_Wnd = FindWindowEx( This.hPrintDlg, 0, '#32770', 'General' )
lh_Wnd = FindWindowEx( lh_Wnd, 0, 'SHELLDLL_DefView', 0 )
lh_Wnd = FindWindowEx( lh_Wnd, 0, 'SysListView32', 'FolderView' )
where W9x probably has a combo, not a listview/folderview.
I see I'll also have to set the default printer to any of the printers I allow before even calling this dialog - because if I remove the default printer, and the user doesn't select one, the default printer is still selected even though it's not listed anymore.