|
Thanks it is working.Sir how can i convert this char *lpStr1 to LPCSTR.
Plz help me
|
|
|
|
|
Doing a double cast like that is not the proper way. Ever heard of CString::GetBuffer()?
|
|
|
|
|
PJ Arends wrote: Doing a double cast like that is not the proper way. Ever heard of CString::GetBuffer()?
That is relative, for read-only purposes, my proposal will be simpler.
Calling GetBuffer() implies calling ReleaseBuffer() later, according to MSDN configuration.
Best regards,
Jaime.
|
|
|
|
|
I am useing this code.Is it right or not.
char buffer_1[ ] = "c:\\Test\\sample.txt";
char *lpStr1;
lpStr1 = buffer_1;
CString string = _T(lpStr1);
int nLen = string.GetLength();
LPCSTR lpszBuf = string.GetBuffer(nLen);
string.ReleaseBuffer();
LPCSTR pF=lpszBuf;
|
|
|
|
|
It could be shorter:
char buffer_1[ ] = "c:\\Test\\sample.txt";
CString string = _T(buffer_1);
LPCSTR pF = (LPCSTR)string.GetBuffer(0);
string.ReleaseBuffer();
Best regards,
Jaime.
|
|
|
|
|
Thanks for reply
Can i check pF values contain any null values?
|
|
|
|
|
You can use something like:
CString string = buffer_1 ? _T(buffer_1) : _T("");
Best regards,
Jaime.
|
|
|
|
|
My new code is this
char buffer_1[ ] = "c:\\Test\\sample.txt";
char *lpStr1;
lpStr1 = buffer_1;
PathRemoveFileSpec(lpStr1);
CString string = _T(lpStr1);
int nLen = string.GetLength();
LPCSTR lpszBuf = string.GetBuffer(nLen);
string.ReleaseBuffer();
And what i change here sir.
Plz help me
|
|
|
|
|
Jaime Olivares wrote: That is relative, for read-only purposes, my proposal will be simpler.
That's true, but you must know in advance that access will be read-only.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
when i am useing these
LPCSTR lpszBuf in the file Shfileoperation as a source directory then it's not working.i am useing code this
char buffer_1[ ] = "c:\\Test\\sample.txt";
char *lpStr1;
lpStr1 = buffer_1;
PathRemoveFileSpec(lpStr1);
CString string = _T(lpStr1);
int nLen = string.GetLength();
LPCSTR lpszBuf = string.GetBuffer(nLen);
string.ReleaseBuffer();
LPCSTR pF=lpszBuf;
LPCSTR pT="c:\\Test2";
SHFILEOPSTRUCT sf;
memset(&sf,0,sizeof(sf));
sf.hwnd = 0;
sf.wFunc = FO_COPY;
sf.pFrom = pF;
sf.pTo = pT;
sf.fFlags = FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI;
int n = SHFileOperation(&sf);
if( n == 0)
{
AfxMessageBox("Success\n");
}
else
{
AfxMessageBox("Failed\n");
}
Can you tell me where i am worng.
|
|
|
|
|
What do you intend to do?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Copy C:\\Test folder in C:\\Test2 folder.I want to take Source folder name from char buffer_1[ ].
Plz help me
Thanks in advance
|
|
|
|
|
MsmVc wrote:
Plz help me
Michael Dunn can [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks All It's working.Your's reply help me
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
It helps to state your request first rather than let a thread drag on forever showing only bits and pieces along the way.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I deleted some bitmap resources in the project in both local and vss2005.
But everytime when I tried to check in the whole project, it warns that the deleted bitmaps are not valid files.
Any way to fix it?
logics
|
|
|
|
|
hi,
how to develop windows system startup applications (windows recovery consol) ?
exm: checkdisk, O&O defrag boot time tool etc.
thanx.
|
|
|
|
|
Isn't it just a matter of where they are placed in the 'run' area of the registry?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
|
thank you. cp is best. thanks you very much.
|
|
|
|
|
In the OnBeginPrinting function of my view class I am displaying a CFontDialog dialog box. I want the default font to be Arial and the default size to be 8. When the dialog box displays, it a shows default size of 50.
Here is the code. These are the first lines in the OnBeginPrinting function.
ASSERT(pDC->GetMapMode() == MM_TEXT);
LOGFONT lf;
::ZeroMemory(&lf, sizeof(LOGFONT));
lf.lfHeight = -MulDiv(10, pDC->GetDeviceCaps(LOGPIXELSY), 72);
lstrcpy(lf.lfFaceName, _T("Arial"));
CFontDialog dlg(&lf, CF_PRINTERFONTS, pDC);
if (dlg.DoModal() == IDOK)
{
m_strFont = dlg.GetFaceName();
m_nPointSize = dlg.GetSize() / 10;
}
The value returned by pDC->GetDeviceCaps(LOGPIXELSY) is 600.
The computed value for lf.lfHeight when 8 points is used is -67.
The resulting size value in the Select Font dialog is 50.
Why is the Select Font dialog displaying as font size of 50 instead of 8?
Here are the results from some other point sizes.
input dialog box
8 50
10 62
12 75
14 88
20 125
Every example of code I can find looks just like the above. Why is this code not working?
Thanks!
|
|
|
|
|
Why do you think it is not working?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I have found the answer.
lfHeight must be converted from print units to screen units because the CFontDialog class uses screen units. Here is the updated code:
ASSERT(pDC->GetMapMode() == MM_TEXT);
LOGFONT lf;
::ZeroMemory(&lf, sizeof(LOGFONT));
int nPrintDpi = pDC->GetDeviceCaps(LOGPIXELSY);
lf.lfHeight = -MulDiv(10, pDC->GetDeviceCaps(LOGPIXELSY), 72);
HDC hDC = GetDC(m_pView->m_hWnd);
int nScreenDpi = GetDeviceCaps(hDC, LOGPIXELSY);
lf.lfHeight = MulDiv(lf.lfHeight, nScreenDpi, nPrintDpi);
lstrcpy(lf.lfFaceName, _T("Arial"));
CFontDialog dlg(&lf, CF_PRINTERFONTS, pDC);
if (dlg.DoModal() == IDOK)
{
m_strFont = dlg.GetFaceName();
m_nPointSize = dlg.GetSize() / 10;
}
|
|
|
|
|
I have my own Win32 API GUI based on an image etc, and i want to insert
an IDD_FORMVIEW inside a certain area, is this possible?
because if it is it means i can make it frameless and add a menu etc, makes life a bit easier
also if it is, where would i look to find out how its done, i tried google but for this im not sure what im searching for.
|
|
|
|