Creating a Handle to DEVNAMES and DEVMODE

I have created a handle to DEVNAMES and assigned it to printDlg.  Do I also have to create a handle to DEVMODE and assign it to printDlg?  If so, Why?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

paulcaAuthor Commented:
I am using Visual C++ 4.2.
>> Do I also have to create a handle to
>> DEVMODE and assign it to printDlg?
No you don't HAVE to.  You can if you need to.  You can either create a DEVNAMES in global memory and store the handle to it int he PRINTDLG structure or you can specify NULL for the handle in the structure.  

However, if you don't create the global memory to store the DEVNAMES, then the print dialog will and will return a handle to it in the PRINTDLG.  So even if you don't allocate this DEVNAMES, you must delete it when done.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Note, you might want to upgrade to VC 6.  It is a much nicer compiler and it has fer better on-line help, it might make this sort of thing clearer.  (Although 4.2 had good help.)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.