|
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
|
|
|
|
|
Yes, the semi-colon was a typo. When I copied and pasted the code, it turned the arrow head into > and I didn't delete the semi-colon.
It is also being debugged in debug mode. I was putting a breakpoint where it was changing unexpectedly. The underlying code appeared to be getting corrupted.
This problem appears to have gone away when I fixed the order with which I created the tabs. I noticed I had two reversed and fixed it. That made the problem go away mysteriously. I'm not sure why having the tabs out of order caused the SetWindowText() function to get corrupted, but I have seen stranger things.
I once spent two weeks trying to find a bug in some hardware I designed. The thing just would not work. One morning, it just started working. My lead predicted it would be back and I had to agree with him. The hardware went into production and nobody ever saw that bug again. The debugging gnomes is the only explanation I have. (I'm feeling old, I just realized that was more than 20 years ago...)
Thanks anyway,
Bill
|
|
|
|
|
|
Hi,
Suppose I have a class
Class ABC
{
void DO();
}
I want to do the following;
void main()
{
ABC Object[20];
for(int i=0;i<20;i++)
createthread(Object[i].DO); //So 20 Threads are created here.
}
I was able to do the above with boost library but unfortunately Visual C++ 2008 has some issues with Boost::threads package. Microsoft states that they wouldnt be able to fix the issue.
Is there any other way I can implement the above?
Thanks
|
|
|
|
|
jobin007007 wrote: Is there any other way I can implement the above?
In addition to fixing the syntax errors (there are at least 5), you'd need to make DO() a static member, correct its prototype, and make it public (unlike structs, class members default to private ).
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|