hi, => To get the orientation u can do: void GetInitOrientation() { PRINTDLG pd; pd.lStructSize = (DWORD) sizeof(PRINTDLG); if( GetPrinterDeviceDefaults(&pd)) { DEVMODE FAR* pDevMode = (DEVMODE FAR*)::GlobalLock(m_hDevMode); if(pDevMode) { nStartupOrientation = pDevMode->dmOrientation; ::GlobalUnlock(m_hDevMode); } } } => To set the orientation: This does not actually invoke the print dialog void SetOrientation(int mode) { PRINTDLG pd; pd.lStructSize = (DWORD) sizeof(PRINTDLG); if( GetPrinterDeviceDefaults(&pd)) { DEVMODE FAR* pDevMode = (DEVMODE FAR*)::GlobalLock(m_hDevMode); if(pDevMode) { switch (mode) { case 1: pDevMode->dmOrientation = DMORIENT_LANDSCAPE; break; case 0: default: pDevMode->dmOrientation = DMORIENT_PORTRAIT; break; }; ::GlobalUnlock(m_hDevMode); } } } hope this helps, Sharad Ganesh
Sharad Ganesh
Posts
-
How to set the print orientation on printer dialog ? -
File Browser Controlhi, U can use the MFC - CFileDialog to do the same. Rgds, Sharad Ganesh
-
DLLshi, Use Dependency Walker which comes with MS Visual Studio Tools! Rgds, Sharad Ganesh
-
Rendering XML using JSPhi, What exactly do u mean by render XML ? Do u want to parse the XML and display the contents onto the browser ? If so, u can use the xerces parser which is an open-source from IBM-Apache. You can get it at http://xml.apache.org. Get the JAR - xerces.jar. Rgds, Sharad Ganesh
-
Application crashhi, Did u check up on the corrected code i posted ? There was a corection "new char". Rgds, Sharad
-
missing export:MSVCRTD.DLLhi, Basically, this error means that something looking for of MSVCRTD.DLL (the MicroSoft Visual C RunTime Dynamic Link Library) is finding a different (probably older) version/ or it is absent. The version it is finding does not have the all the exports (places that things calling the DLL can enter by) that the version it wants has. Regards, Sharad Ganesh
-
help needed....!hi, To start with u can create a simple Dialog based application. You'll have to read MSDN for more information, for how to:Create a dialog based app". Then u can use Windows SDK funtions and MFC to do the rest. Like use CreateProcess / WinExec to open the .xls file. MFC provies a Find dialog class which is easy to use. Its very difficult to explain a step-by-step process. It would be better if u read MSDN on the said lines. hope this helps, Sharad Ganesh
-
Application crashhi, Assigning a pointer to NULL does not actually free the allocated memory. Your memory should have been allocated by using "new char". ch is not any type here. I presume it should have been "char". One very nice thing about delete is that even if the pointer = NULL, ur app _won't_ crash. I just replace that new ch with "new char". and then delete ptrChar; Regards, Sharad Ganesh
-
How to replace last line of a file?hi, If you're keen on using the C++ library, u could do this with fstream's ::seekg to seek to the end(ios::end) minus the offset which is calculated. The offset would be calculated using sizeof(string). Specify the offset in (-)ve. Now you can write the present contents from this location. P.S. Open the file in binary mode. hope this helps, Sharad In C you write your own bugs, in C++ you inherit them ! - Anonymous