|
hi friends
i am new in c++
I have one file enc.cpp in which i write many functions and one entry point.
i dnt know how to run it.
plz tell me how to run project in c++ .net
thanks in advance.
khan
|
|
|
|
|
|
Hi,
i am using ShellExecuteEx function in an Embeded VC++(MFC Based) to run other application(not MFC) but its Window not get
Minimized though i am passing ShExecInfo.nShow = SW_MINIMIZE parameter. My Code is:
BOOL CSBCApp::InitInstance()
{
CMainFrame* pFrame = new CMainFrame;
m_pMainWnd = pFrame;
pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL);
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = _T("Disk\\MyTest.exe");
ShExecInfo.lpParameters = _T("");
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_MINIMIZE;
ShExecInfo.hInstApp = NULL;
bool ReturnType=ShellExecuteEx(&ShExecInfo);
// The one and only window has been initialized, so show and update it.
pFrame->ShowWindow(m_nCmdShow);
pFrame->UpdateWindow();
return TRUE;
}
Warm Regards,
priyank
|
|
|
|
|
pri_skit wrote: ShExecInfo.nShow = SW_MINIMIZE;
Use SW_SHOWMINIMIZED instead.
|
|
|
|
|
WINDOW CE(5.0) does not support SW_SHOWMINIMIZED.
Message displayed:
error C2065: 'SW_SHOWMINIMIZED' : undeclared identifier
priyank
|
|
|
|
|
pri_skit wrote: WINDOW CE(5.0) does not support SW_SHOWMINIMIZED
Yes. I overseen WinCE in your original post.
With available options for ShowWindow on WinCE it doesn't seem possible.
|
|
|
|
|
Only the following are supported in WinCE. SW_SHOW, SW_HIDE, SW_SHOWNORMAL, SW_SHOWNA
If your requirement is to create a new window but to retain the topmost state of your current window, then create the new window with SW_SHOWNA as the nCmdShow parameter to ShowWindow() .
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
you specified the window to minimize
ShExecInfo.nShow = SW_MINIMIZE;
you are again specifying the window to show with m_nCmdShow
pFrame->ShowWindow(m_nCmdShow);
it depends on m_nCmdShow. comment Show and UpdateWindow functions. it may work.
HTH,
-- Murali Krishna.
|
|
|
|
|
pFrame->ShowWindow(m_nCmdShow);
This function is for Main MFC Application.
I am using ShellExecuteEx() fuction to run an other Application(not MFC,.exe file) which get minimize at StartUp.Therefore ShExecInfo.nShow = SW_MINIMIZE;
is used.
HTH,
priyank
|
|
|
|
|
hi,
i got LNK2001 errors.
I created a sample class in flashplayer7 and in that class i created pointer instances of some Directshow interfaces like IMediaControl etc....
When i tried to access the functions from the interfaces it is showing the below linker errors.
error LNK2001: unresolved external symbol "public: __thiscall CFlashPlayback::CFlashPlayback(void)" (??0CFlashPlayback@@QAE@XZ)
CFlashPlayback.obj : error LNK2005: "struct HWND__ * m_hWnd" (?m_hWnd@@3PAUHWND__@@A) already defined in win32camera.obj
Thanks and Regards
Harshadha
|
|
|
|
|
harshadha wrote: error LNK2001: unresolved external symbol "public: __thiscall CFlashPlayback::CFlashPlayback(void)" (??0CFlashPlayback@@QAE@XZ)
You forgot to provide defintion for constructor you declared.
harshadha wrote: CFlashPlayback.obj : error LNK2005: "struct HWND__ * m_hWnd" (?m_hWnd@@3PAUHWND__@@A) already defined in win32camera.obj
It seems that m_hWnd is declared twice in same namespace.
|
|
|
|
|
My error got resolved ..Thanks ...
Thanks
Harshadha
|
|
|
|
|
Hi,
I have to print images from my application.
For doing this, I created a Printer DC and the images is painted using 'StretchDIBits'.
Now the printing is OK.
The problem is of the sheet size.
How can i change the print size according to the different sheet sizes supported by the specified printer?
Please help.
Regards,
Kumar
Krishnakumar
|
|
|
|
|
For print you can use also of PrintDlg and also see this structure DEVMODE on MSDN
|
|
|
|
|
Hi,
Actually i want to know that, whether the printer DC is to be resized according to the paper sizes.
If yes, how can i change the size?
Me already checked with the following code
for( int nIndex = 0; nIndex < nNumPapers; nIndex++ )
{
CString csPaperSize = _T( pPaperNames ); /* Got from GetDeviceCapabilities */
memcpy( pDevModeOutput->dmFormName, csPaperSize.GetBuffer(csPaperSize.GetLength()), 32) ;
HDC hTempHandle;
pDevModeOutput->dmFields |= DM_FORMNAME;
CString csTemp( _T( "" ));
hTempHandle = ResetDC( hDc, pDevModeOutput );
nPixelX = GetDeviceCaps( hDc, HORZRES );
nPixelY = GetDeviceCaps( hDc, VERTRES );
csTemp.Format( _T( "%s : %d, %d" ), pDevModeOutput->dmFormName, nPixelX, nPixelY );
AfxMessageBox( csTemp );
}
but the nPixelX, nPixelY always getting the same for all paper sizes
Regards,
Krishnakumar
|
|
|
|
|
Did you see DEVMODE ? here[^] (dmPaperSize )
|
|
|
|
|
Hi,
The way I change the paper size is given below
pDevModeOutput->dmPaperSize = 0; // It should be set to zero if paper length and width are given seperately
pDevModeOutput->dmPaperLength = pPaperSizes[nSelection].y; // 2970 in case A4
pDevModeOutput->dmPaperWidth = pPaperSizes[nSelection].x; // 2100 in case A4
CString csPaperSize = _T( "" );
memcpy( pDevModeOutput->dmFormName, csPaperSize.GetBuffer(csPaperSize.GetLength()), 32) ;
pDevModeOutput->dmPrintQuality = -1;
pDevModeOutput->dmYResolution = 0;
//pDevModeOutput->dmScale = 90;
pDevModeOutput->dmFields = DM_PAPERSIZE |
DM_PAPERLENGTH |
DM_PAPERWIDTH |
DM_FORMNAME |
DM_PRINTQUALITY |
DM_YRESOLUTION; // DM_SCALE;
// To get the Devmode structure filled
if( !DocumentProperties( NULL, // handle to parent window
hHandle, // handle to printer object
csPrinterName.GetBuffer(csPrinterName.GetLength()+1), // device name
pDevModeOutput, // modified device mode
0, // original device mode
DM_IN_BUFFER// mode options
))
{
return;
}
hDc = CreateDC( NULL, csPrinterName.operator LPCTSTR(), NULL, pDevModeOutput );
nDPIX = GetDeviceCaps( hDc, LOGPIXELSX );
nDPIY = GetDeviceCaps( hDc, LOGPIXELSY );
Actually I don't know the procedure that how to change the paper size. I think some mistakes are there in my code or something is missing. I have to draw a rectangle that is fit into the specified paper size.
Please reply.
Krishnakumar
|
|
|
|
|
|
Hopefully this little cut & paste will help you...
Iain.
szPrintablePixelsMax.cx= ::GetDeviceCaps (hPrinterDC, HORZRES);
szPrintablePixelsMax.cy= ::GetDeviceCaps (hPrinterDC, VERTRES);
szPrintableArea.cx = ::GetDeviceCaps (hPrinterDC, HORZSIZE);
szPrintableArea.cy = ::GetDeviceCaps (hPrinterDC, VERTSIZE);
|
|
|
|
|
Me already tried the below code
szPrintablePixelsMax.cx= ::GetDeviceCaps (hPrinterDC, HORZRES);
szPrintablePixelsMax.cy= ::GetDeviceCaps (hPrinterDC, VERTRES);
it always returns the same value for all sheet sizes.
Regards,
Kumar
|
|
|
|
|
That's not a surprise - its returning the DPI for the printer. There were FOUR lines in the message I posted, and you are looking at the wrong two. Try the other two lines.
Iain.
|
|
|
|
|
As per MSDN, the below code returns the width and height in pixels,
int nX = GetDeviceCaps( hDc, HORZRES );
int nY = GetDeviceCaps( hDc, VERTRES );
Actually i meant that for some of the printers ( HP LaserJet 4250 PCL 5e ), the code gives different values for different sheet sizes.
But the problem is that some of other printers (hp deskjet 3500 series) gives the same values for different papaer sizes.
I am setting the size using the "DocumentProperties" function as below
pDevModeOutput->dmPaperSize = 0; // It should be set to zero if paper length and width are given seperately
pDevModeOutput->dmPaperLength = pPaperSizes[nSelection].y; // 2100 in case A4
pDevModeOutput->dmPaperWidth = pPaperSizes[nSelection].x; // 2970 in case A4
CString csPaperSize = _T( "" );
memcpy( pDevModeOutput->dmFormName, csPaperSize.GetBuffer(csPaperSize.GetLength()), 32) ;
pDevModeOutput->dmPrintQuality = -1;
pDevModeOutput->dmYResolution = 0;
//pDevModeOutput->dmScale = 90;
pDevModeOutput->dmFields = DM_PAPERSIZE |
DM_PAPERLENGTH |
DM_PAPERWIDTH |
DM_FORMNAME |
DM_PRINTQUALITY |
DM_YRESOLUTION; // DM_SCALE;
// To get the Devmode structure filled
if( !DocumentProperties( NULL, // handle to parent window
hHandle, // handle to printer object
csPrinterName.GetBuffer(csPrinterName.GetLength()+1), // device name
pDevModeOutput, // modified device mode
0, // original device mode
DM_IN_BUFFER// mode options
))
{
return;
}
Krishnakumar
|
|
|
|
|
What is the maximum possible size of an INI file in Windows XP to operate with standard windows APIs?
- NS -
|
|
|
|
|
|
NS17 wrote: What is the maximum possible size of an INI file in Windows XP to operate with standard windows APIs?
The maximum valid size for a .INI file is 64 kilobytes (K). Reference[^]
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|