|
i dont think the first one works!?
u see,
here is my code:
strcpy((char *)cFilePath, ( LPCSTR )( LPCTSTR )RawFile.GetPathName() ) ;
where cFilePath is TCHAR type
anyideas?
|
|
|
|
|
i forgot to put up one more point,that is ,
in teh above 'strcpy' does compile,but only the first letter of the whole word gets copied!
the declaration for cFilePath is
TCHAR cFilePath[_MAX_PATH]
|
|
|
|
|
TCHAR is a char in ANSI/MBCS but wchar_t for Unicode. You are probably compiling for a Unicode build. The following would work fine in either configuration (that's what TCHAR macros are for):
TCHAR cFilePath[_MAX_PATH];
_tcsncpy(cFilePath, (LPCTSTR) RawFile.GetPathName(), _MAX_PATH);
cFilePath[_MAX_PATH-1] = _T('\0');
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
thank u sir .....
brilliant!!!!!
|
|
|
|
|
ThatsAlok wrote:
#1 By TypeCast
(LPSTR)(LPCTSTR)CString Variable //return Char*
This way is only for a const TCHAR*. That is, this address can only be read. It's not safe to write.
ThatsAlok wrote:
#2 By Using GetBuffer()..
CStringVar::GetBuffer() //return Char*
..............
Do your Work
..............
CStringVar::RelaseBuffer()
This is the standard way to get the address of the buffer. You should pass a max length for the buffer in GetBuffer(), and then the pointer can be written.
|
|
|
|
|
If you mean LPCTSTR or const TCHAR* (i.e., a pointer to a read-only string of TCHAR s):
CString sText = _T("This is a test");
LPCTSTR p = sText;
If you mean LPTSTR or TCHAR* (i.e., a pointer to a string of TCHAR s that you are allowed to modify):
CString sText = _T("This is a test");
LPTSTR p = sText.GetBuffer();
_tcscpy(p, _T("end of test");
sText.ReleaseBuffer(-1);
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I use VS6. As I type in an object variable, VS6 provides me with a list of member variables and functions for autocompletion. But this list is outdated and doesnt take into account any new items added to the class. Is there any way to fix this?
|
|
|
|
|
Anonymous wrote:
Is there any way to fix this?
delete project.bsc file from you DEBUG and RELEASE folder
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
full rebuild can help.
-prakash
|
|
|
|
|
i'm using the following code in my SDI application:
void CMyView::OnDraw(CDC* )
{
CMyDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
Graphics graphics(m_hWnd);
SolidBrush brush(Color(255, 0, 0, 0));
FontFamily fontFamily(L"Times New Roman");
Font font(&fontFamily, 20, FontStyleRegular, UnitPixel);
RectF rectF(0.0f, 5.0f, 140.0f, 40.0f);
StringFormat stringFormat;
stringFormat.SetAlignment(StringAlignmentCenter);
graphics.SetSmoothingMode(SmoothingModeAntiAlias);
graphics.DrawString(L"Text", -1, &font, rectF, &stringFormat, &brush);
}
but when i run the application, the following message is displayed and application does not contiues furter:
Unhandled exception at 0x7c918fea in Dxf.exe: 0xC0000005: Access violation writing location 0x00000010.
the above code works fine for dialog classes. what might possibly be wrong?
Do first things first, and second things not at all. —Peter Drucker.
|
|
|
|
|
Alright, I got the solution.
I was being stupid...now dont ask me more...
"Do first things first, and second things not at all."
— Peter Drucker.
|
|
|
|
|
It would be nice if you post the solution too. I Suspect the constant string that you provided to the funtion, not sure if thats rite.
-prakash
|
|
|
|
|
Well..if you say so...
I was wrongly calling GdiplusShutdown(m_gdiplusToken) here:
BOOL CMyApp::InitInstance()
{
...
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
GdiplusShutdown(m_gdiplusToken);
return TRUE;
}
instead of here:
int CMyApp::ExitInstance()
{
GdiplusShutdown(m_gdiplusToken);
return CWinApp::ExitInstance();
}
"Do first things first, and second things not at all."
— Peter Drucker.
|
|
|
|
|
Hi,
I want to access sql store procedure.It has 3 input parameter and 8 output parameters. store procedure also retun the result set. Can you please give me reference of sample code to access store procedure. I am totally new to DB.
Thanks
|
|
|
|
|
Good day,
Im posting this up here bec. there is not much interaction on Embedded/Mobile section but here on Visual C++ a lot of good people come.
Anyway,I'm using Embedded Visual C++ 3.0 on my development. I'am given so LITTLE TIME to do my task, so I'm planning to bring my task at home. Unfurtunately my pc at home is stand-along(doesnt have network -thou I have network card but can't afford yet to have an internet con.). I wanted to run the emulator(Pocket PC 2002) at home but the protocol used is TCP/IP. My Emulator cant connect to the Platform manager do I cant transfer files and debug my program. I've search here in the office on how to connect emulator with active sync (see site below).
.(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devguidesp/html/sp_intro_to_the_ce_emulator_zjht.asp)
However, I dont have that null modem cable nor serial cable at home. Can anybody help me how I could communicate my emulator with EVC3.0?
Any suggestion would be a great Help.
Thanks
|
|
|
|
|
I have no experience in Mobile programming, but if you need network connection you can install Microsoft Loopback driver.
it work like a NIC.
Iman Ghasrfakhri
|
|
|
|
|
Good day,
I have tried to install MS Loopback and yes I do have network connection, however, when I ran the emulator, EVC3 emulator platform manager could not connect.
Anyway thanks Iman, I've learn something.
have a nice day.
|
|
|
|
|
Hi,
I know it's bad practice to disable warnings but I'm fighting my way through lines and lines of irrelevant information in the Output window to find my TRACE output.
Is it possible to temporarily switch off DLL loading messages such as:
'XYZ.exe': Loaded 'C:\WINDOWS\system32\abcdefg.dll', No symbols loaded.
Thanks,
Simon
|
|
|
|
|
I preface my debug statements with asterisks, something like:
***** This is my debug message
That way it stands out above all the other noise.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I have an ATL Composite Control (DLL) that that includes my own control (CMySlider) derived from CSliderCtrl.
Here is the message map of this control.
BEGIN_MESSAGE_MAP(CMySlider, CSliderCtrl)
//{{AFX_MSG_MAP(CPlayerSlider)
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomdraw)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
When Composite Control is embedded in the Dialog or FormView, CMyControl receives notification, OnCustomdraw gets called and everything draws/works perfectly.
The problem is that when the Composite Control is embedded in HTML page, I’m not receiving notification at all and instead of custom slider I’m getting the standard windows control.
Does anybody know what should I do to make it work on the web page?
Any help would be greatly appreciated.
Thanks,
Lev
|
|
|
|
|
I am sorry ,I use c++ 2years, but i donot know this code
can you tell me
my email is yujian6044@163.com
my name is jerry
BEGIN_MESSAGE_MAP(CMySlider, CSliderCtrl)
//{{AFX_MSG_MAP(CPlayerSlider)
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomdraw)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
|
|
|
|
|
There are a lot of samples with ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomdraw)on this site. Do a search and ypu find a lot of references.
|
|
|
|
|
I seem to have the same problem, have you found a solution for this one?
|
|
|
|
|
Hello all,
This is my first post to this forum, so apologies in advance for the lack of clarity.
Im trying to assign an unsigned 16 bit word to a char array i.e. two 8 bit single bytes.
my value (u16 sum) contains the word value 24fa which I need to insert into the middle of a char array buff[100]. Obviously, I am concious of the fact that the array is of type char (8 bit), thus any allocation will shorten the original value e.g. buff[0] = sum //buff[0] only contains 0x24
Is there any way to change the word value to two 8 bit singular bytes for storage?
Or is there another way via strcat/memcpy etc..etc
Many thanks in advance.
Stu
|
|
|
|
|
oh me too .I can not know use this forum
my english is poor
haha
I
|
|
|
|