|
Hello,
I have application which makes a call to CreateFile and return handle FILE*, I can write to the file using this handle on XP, but on vista it does not work, it creates the file, but fprintf calls returns -1.
Is there any difference of C Run time library on XP and VISTA ?
Looking forward to hear from you soon.
Many Thanks.
Kamlesh Patel
|
|
|
|
|
krolta wrote: I have application which makes a call to CreateFile and return handle FILE*...
CreateFile() returns a HANDLE , not a FILE pointer.
krolta wrote: ...but fprintf calls returns -1.
Since you opened the file with CreateFile() , you should be using WriteFile() . Otherwise, you'll need to open the file with fopen() .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Can you use of CFile class?
|
|
|
|
|
i get an error often while i run my project and error is in dlgdata.cpp and saying some-- ASSERT(FALSE);in line 42...what might be the reason for such errors???
Raja
|
|
|
|
|
What does your dialog's DoDataExchange() method look like?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Did you use of debugger and breakpoints for see more info about error?
|
|
|
|
|
yes.the error occurs when the buttonclick does the domodal() function to show another dialog..there is nothing wrong in my coding..but doesn't know why it occurs!!
Raja
|
|
|
|
|
|
i have 7dialogs and i have inlinks between them,the problem occured when i tried to add coding to backtraverse between the dialogs and in the first dialog has only this code,
newdlg onclick;
onclick.Domodal
and the error is in dlgdata.cpp,here
HWND CDataExchange::PrepareCtrl(int nIDC)
{
ASSERT(nIDC != 0);
ASSERT(nIDC != -1);
HWND hWndCtrl;
COleControlSite* pSite = NULL;
m_pDlgWnd->GetDlgItem(nIDC, &hWndCtrl);
if (hWndCtrl == NULL)
{
pSite = m_pDlgWnd->GetOleControlSite(nIDC);
if (pSite == NULL)
{
TRACE(traceAppMsg, 0, _T("Error: no data exchange control with ID 0x%04X.\n"), nIDC);
ASSERT(FALSE);------------------------------------------>ERROR
AfxThrowNotSupportedException();
}
}
m_idLastControl = nIDC;
m_bEditLastControl = FALSE;
return hWndCtrl;
}
Raja
|
|
|
|
|
I think you must change your code to this:
m_pDlgWnd->GetDlgItem(nIDC, &hWndCtrl);
if (hWndCtrl != NULL)
and you must be check hWndCtrl before return hWndCtrl;
if (hWndCtrl )
return hWndCtrl;
else
return NULL;
|
|
|
|
|
where should i do this coding change,wil you please say me from where(websites) i should learn basics to create an application for MFC
Raja
|
|
|
|
|
You must be change this line if (hWndCtrl == NULL) to if (hWndCtrl != NULL) and instead return hWndCtrl; insert this code if (hWndCtrl) return hWndCtrl; else return NULL.
|
|
|
|
|
how to create handle controls??
Raja
|
|
|
|
|
You can use of GetDlgItem or you can declare a variable for it,is this your question?
|
|
|
|
|
First of all, when asking a question about why an ASSERT fails post some code around the ASSERT : 9 times out of 10 this is all that is needed to answer the question. I see you've given the file's name the line number, but what version of MFC are you using?
In my version of MFC line 43 contains an ASSERT(FALSE); and line 42 looks as follows:
TRACE1("Error: no data exchange control with ID 0x%04X.\n", nIDC);
You should see this message in the debugger. This should answer your question or at least put you on the right track. Don’t be afraid to look at the source!
Steve
|
|
|
|
|
yes,i do have error at the same line saying no dataexchange,what should be done??
Raja
|
|
|
|
|
The error message is saying, quite clearly, that a control with the id in question does not exist. Go through the data exchange map and the dialog template and find the mismatch. This should be a cakewalk.
Steve
|
|
|
|
|
Hi to all,
How to write a constant member function in Managed C++ class.
public ref class CMyClass
{
public :
void Function(void) const
{
}
}
Here I got error as,
error C3842: 'Function': 'const' and 'volatile' qualifiers on member functions of managed types are not supported
- Aniket A. Salunkhe
|
|
|
|
|
[^].
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
|
|
|
|
|
Hi,
Please try this technique,
public ref class CMyClass
{
public:
void Function(void) const;
};
void CMyCLass::Function() const
{
.
.
.
}
Wish you Good Luck...
Jagdish Bhimbha
S/W Developer
|
|
|
|
|
Aniket Salunkhe wrote: error C3842: 'Function': 'const' and 'volatile' qualifiers on member functions of managed types are not supported
See here.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The error message pretty much says it all. I can't understand why you felt the need to post the question.
Steve
|
|
|
|
|
I think there is a wider question here - are we saying that the .net languages do not support const correctness at all, or is the syntax just different? Unless you didn't guess I am from a C++ background! For instance if I have a const handle to an object, how do I restrict the caller to only calling certain functions - for instance getters which do not modify the object and not setters which would cause the object to be modified?
|
|
|
|
|
how to get individualvalues(month,day,year) from a datetimepicker???
Raja
|
|
|
|
|
Deja vu.
The MFC way:
Use CDateTimeCtrl::GetTime to retrieve a COleDateTime object, then call COleDateTime::GetMonth , COleDateTime::GetDay , COleDateTime::GetYear .
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
|
|
|
|