printer properties setting
-
hi i am wiritng my own print dialogbox. on that i place the controls for setting properties. i like to set that properties to selected printer. i wrote below code. but printer doesn't set the user selected properties . please correct the code where i am wrong. otherwise please give guidence Thank you void CmyPrintSetup::OnButPrint() { // TODO: Add your control notification handler code here unsigned char temp[32]; DEVMODE *devout,*devin; DWORD dwNeeded,dwRet; DEVMODE* pDevMode; if(!OpenPrinter(printername,&hprinter,NULL)) MessageBox("Printer can't be opened","error",MB_OK); dwNeeded=DocumentProperties(NULL,hprinter,printername,NULL,NULL,0); pDevMode=(DEVMODE*)malloc(dwNeeded); dwRet=DocumentProperties (NULL,hprinter,printername,pDevMode,NULL,DM_OUT_BUFFER); if (dwRet != IDOK) { /* If failure, cleanup and return failure. */ free(pDevMode); ClosePrinter(hprinter); } pDevMode->dmOrientation=m_orientation; pDevMode->dmCopies=m_copies; dwRet=DocumentProperties (NULL,hprinter,printername,pDevMode,pDevMode,DM_IN_BUFFER|DM_OUT_BUFFER); if(dwRet!=IDOK) { MessageBox("properties initialization error","error",MB_OK); } } please help it's urgent