|
PankajB wrote: unicode = (unicode1 << 8) | unicode;
That converts the two characters unicode and unicode1 into a single 16-bit wide character. It assumes that the wide characters have been stored in a little-endian fashion.
PankajB wrote: Also, this method is not able to correctly identify all the chars.
Possibly because not al unicode characters fit into 16 bits?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for the reply buddy.
Can you please suggest some solution for the second problem mentioned above? i.e., Possibly because not al unicode characters fit into 16 bits?
|
|
|
|
|
I'd suggest that you use some library (like, say libiconv[^] to read the file and do the conversion from whatever character encoding is used for the file to a full Unicode enconding (e.g. UTF-32). Then process each of those 32-bit characters the way you are in your original code.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
HI,
im using CopyFile function as below...
::CopyFile(_T("F:\\test.ini"),_T("E:\\test.ini"),FALSE);
ie im copying ini file from a DVD which in F Drive to E drive...
BUt the issue is the copied file is in Readonly mode..how can i change to Write mode using code...
normally if i copy file from one localdrive to other it is not in Readonly mode...but if i copy from CDDrive then the file becomes Readonly..?
|
|
|
|
|
The documentation for CopyFile[^] states that:
File attributes for the existing file are copied to the new file. For example, if an existing file has the FILE_ATTRIBUTE_READONLY file attribute, a copy created through a call to CopyFile will also have the FILE_ATTRIBUTE_READONLY file attribute. For more information, see Retrieving and Changing File Attributes.
Given that all all files on a CD drive are read-only, your problem is not surprising.
The solution is to use the SetFileAttributes[^] function on the destination file after the copying is complete to make the file writeable.
Steve
|
|
|
|
|
HI Guys,
Can any body provide a source code to read .pst file Inbox mails. or even a procedure to how to read it
|
|
|
|
|
|
Hi,
In my application, I need to read an unicode string _T("AT+COPS=?\r") from an xml file.
The problem I am facing is that when I read an string from the xml file, it is treating the elements "\r" in "AT+COPS=?\r" as 2 different characters rather than a single carriage return value.
How do I get around this problem.
|
|
|
|
|
That's how it is supposed to work. Escape sequences are only used this way in string litterals (e.g., when you write the string yourself in the code). If you read that from a file, "\r" are two characters and they are treated as two independant characters. What you have to understand about escape sequences (like "\r") is that they are replaced by your compiler by a single character.
If you really want to do something like you that, you will need to parse the string yourself and replace the sequence yourself.
|
|
|
|
|
How to use Integrated Windows Authentication Method in VC++/MFC Applications ?
|
|
|
|
|
I am working on MDI application which has some lengthy operation on
View and also on some dialog boxes, I want to display busy cursor hours glass I implemented as below it is working during the length operation on the View, but when while there was a lengthy operation on the dialog, mouse pointer is not changed on the dialog, but if I move the mouse on the MainFram then the mouse pointer is changed, I want the mouse pointer to be changed on the Dialog also, please advice
view.cpp
void CMyView::PerformLengthyOperation()
{
m_ChangeCursor = TRUE;
AfxGetApp()->DoWaitCursor(1)
AfxGetApp()->DoWaitCursor(-1)
m_ChangeCursor = FALSE;
}
BOOL CMyView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if (m_ChangeCursor)
{
RestoreWaitCursor();
return TRUE;
}
return CView::OnSetCursor(pWnd, nHitTest, message);
}
Dlg.cpp
void CDlg::PerformLengthyOperation()
{
m_ChangeCursor = TRUE;
AfxGetApp()->DoWaitCursor(1)
AfxGetApp()->DoWaitCursor(-1)
m_ChangeCursor = FALSE;
}
|
|
|
|
|
why dont you try using CWaitCursor class for this? Check this link[^]
|
|
|
|
|
Yes I get Busy symbol but, I want to user Hourglass for this
modified on Tuesday, June 2, 2009 2:15 AM
|
|
|
|
|
Then why don't you use this
SetCursor(LoadCursor(NULL, IDC_WAIT));
Until the operation that you are doing is over?
|
|
|
|
|
It is not working in my current applicaion on which I am working,
I crated a new MDI applicaion and tried this to test, it is working fine
But I want the same to work in my application also, Please help
int i=0;
SetCursor(LoadCursor(NULL, IDC_WAIT));
while(i<500)
{
Sleep(10);
i++;
}
SetCursor(LoadCursor(NULL, IDC_ARROW));
|
|
|
|
|
Why will it not work for you in your application if its working with MDI? show the part of code where you are implementing it
|
|
|
|
|
I used exactly same, but in my application I used in non MFC class,
which is having a Lengthy operationfucntion
and in my test appliaction I used ina OnButton() cmd handler.
|
|
|
|
|
why dont you show that implementation?
|
|
|
|
|
opps, sorry again , here is the correct one, Please advice
CSearchDlg::OnSearchBtn()
{
CLengthyOper cls;
cls.PerformLengthyOperation();
}
CLengthyOper::PerformLengthyOperation()
{
SetCursor(LoadCursor(NULL, IDC_WAIT));
SetCursor(LoadCursor(NULL, IDC_ARROW));
}
modified on Thursday, June 4, 2009 2:53 AM
|
|
|
|
|
Can some one please help me out in this
|
|
|
|
|
You cannot expect the cursor to change while you have yourself blocked the message processing loop. For the cursor to change you must return and then let the message processing loop handle the cursor change message.
As far as I understand you need a separate thread for doing the time taking processing or do it in OnIdle
Hope this helps
|
|
|
|
|
I have a project in which I was using a view using a CTabCtrl. I ran into some issues turning tabs on and off and my searching led me to the CPropertyView described here: Property Sheet View[^]
I am writing here because the article is old and probably not being maintained. The original was written for VC 6. I have compiled the demo projects just fine under both VC 6 and VC 2005.
When I included CPropertyView in my project and attempted to compile, I got three errors which are real head scratchers. In my class derived from CPropertyView, I get the following errors:
C2248: 'CPropertyView::GetThisMessageMap' : cannot access protected member declared in class 'CPropertyView'
C2352: 'CPropertyView::AssertValid' : illegal call of non-static member function
C2352: 'CPropertyView::Dump' : illegal call of non-static member function
The C2248 error comes up with the END_MESSAGE_MAP() macro. I tried commenting out everything in the message map and I still got the error.
I have carefully checked the syntax and AssertValid and Dump are declared and called identically in this class as in all others. There is a slight variation between VC6 and VC2005 in that VC2005 has an extra #ifdef for Windows CE, but the error happens whether the ifdef is there or not.
I found a Microsoft Knowledge Base article (Q243351) that talks about the C2248 error happening when the /Za flag is used in the compiler, but I'm not using that flag.
I'm sure the answer is something simple, but I've run into a brick wall.
Bill
|
|
|
|
|
Have you put a DECLARE_MESSAGE_MAP in your derived class?
[edit]Also - I presume you've inherited publicly from CPropertyView?[/edit]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
DECLARE_MESSAGE_MAP is there. I was tracking down another compiler error and stumbled across the problem. When I converted the class as derived from CFormView to CPropertyView, I had updated all the references to CFormView except 1. I don't know why the compiler didn't see that as a problem, but when I changed that, it compiled.
I'm having some other problems now. It appears that something in the parent class is causing a memory corruption in the derived class. It was blowing up when I tried to call Clear() for a COleVariant class variable. When I looked at it in the debugger, it was set to something strange. In the class declaration, I moved the COleVariant to the end of the fire and it ran Clear() fine. However, it now blows up when calling SetWindowText() for a CEdit variable.
Tracing down into the debugger, everything looks fine until
m_pCtrlSite->;SetWindowText(lpszString);
I try to trace into it, but I get an access violation reading location 0x00000000. The issue is almost certainly caused by something in CPropertyView because the program runs just fine through that point with the old TabView.
What tools are available to figure out what's corrupting memory?
Bill
|
|
|
|
|
wdolson wrote: m_pCtrlSite->;SetWindowText(lpszString);
I hope that first semi-colon's just a typo in the message
First thing - I presume you're using a Debug rather than Release build for your debugging (strange things can appear to happen when you debug a Release build).
If it is a Debug build, try setting a Data Breakpoint on the thing that's changing unexpectedly - that should be triggered when the data changes value.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|