|
I'm not exatcly sure what you mean.... But I've used this method to stop my dialog from scrolling from non window scrollbars.
if you have a OnHScroll or OnVScroll for your dialog ...
try returning from the function if pScrollBar is not NULL before doing any of the switch statements.
void CEdrumMonDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
if(pScrollBar != NULL){return;}
switch (nSBCode).........
.......
}
|
|
|
|
|
hi
How to handle exception generated from CFile::Write() function?
try
{
f2.Write(buf,length);
}
catch(CFileException *e)
{
e->Delete();
}
In the above piece of code wen there is an exception due to disk full it does not come to catch part rather the OS handles....I need to handle thru the application....
Thanx in advance..
birajendu
CyberG India
Delhi
India
|
|
|
|
|
Try using CException instead. The exception might not be from CFile.
<font=arial>Weiye Chen
Give me the Death Note, and I'll cleanse the world...
|
|
|
|
|
CException also not working...actually m working in eVC++,is there may b some different method...can u plz help...
birajendu
CyberG India
Delhi
India
|
|
|
|
|
Check this article[^]. Try using TRY and CATCH macros see if it helps.
Or have you used catch(...)?
<font=arial>Weiye Chen
Give me the Death Note, and I'll cleanse the world...
|
|
|
|
|
Check out SetErrorMode()
I think you can use this:
<br />
SetErrorMode(SEM_FAILCRITICALERRORS);<br />
...... Do stuff, such as filling up the disk and get the errorcode.<br />
SetErrorMode(0);<br />
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Win CE doesnot support SetErrorMode().
birajendu
CyberG India
Delhi
India
|
|
|
|
|
Hello,
Either u can write
try
{
}
catch(...)
{
}
or u can write
<code>__try
{
}
__except(1)
{
CString str;
str.Format(_T("%x"),GetExceptionCode());
AfxMessageBox(str);
}</code> .
regards,
Divyang Mithaiwala
System Engineer & Software Engineer
|
|
|
|
|
For MFC, use TRY /CATCH instead.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I used class CFileDialog in order to open file and save file in my application
But when I select CFileDialog with mode open (flag bOpenFileDialog = TRUE),change size it and close.
I select CFileDialog with mode save as (flag bOpenFileDialog = FALSE).
size of save as dialog exactly the same like size of open dialog when close.
Can I avoid this behaviour?
Please help me!
|
|
|
|
|
The file dialog is a system dialog and the size is saved in the registry for each app that uses it. To change the behaviour you have to subclass the file dialog and do all the saving and restoring of the dialog sizes yourself. There are articles about subclassing the CFileDialog here on CP, do a search.
|
|
|
|
|
Can you tell me more clearly about key of system dialog in registry .
I have tried subclassing the CFileDialog and set size of it in OnDestroy() and on OnInitDialog() but not successed.
|
|
|
|
|
toanmtkh@yahoo.com wrote: I have tried subclassing the CFileDialog and set size of it in OnDestroy() and on OnInitDialog() but not successed.
What didn't work? It works for me.
|
|
|
|
|
I think you could specify a hook, and in that procedure, respond to the WM_INITDIALOG message. In addition, you'll most likely need to use GetOpenFileName() instead of CFileDialog .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Friends,
I've a simple dialog based application and when user right clicks on the dialog window, a menu gets opened.
Now the menu gets closed when user presses escape key or click on the dialog. I want to detect that the menu has been closed.
How can i determine that the menu has been closed ? Is there any such event ?
Imtiaz
|
|
|
|
|
|
Hi,
int id;
const int ********::get_id() const
{
return id;
}
I want to do these operations.
**** gh;
int th = gh.get_id (how is it possibele to type cast)
int th =10;
if (th == gh.get_id) (how is it possible to compare)
COleDateTime& CTableInfo::edit_date()
{
return edit_date;
}
CtableInfo in;
COleDateTime ct;
ct = in.edit_date(); //this is not happening and
//'=' : cannot convert from 'class COleDateTime (__thiscall
CToleranceTableInfo::*)(void)' to 'class COleDateTime *'
give me some solution...
thanks in advance..
bye
kk
kk
|
|
|
|
|
to understand problem easily, can you reword your problem. Are ***** placeholders for something ?
|
|
|
|
|
Hi,
int id;
const int Cinfo::get_id() const
{
return id;
}
I want to do these operations.
CInfo gh; //take obj of the class in some way.
int th = gh.get_id (how is it possibele to type cast)
int th =10;
if (th == gh.get_id) (how is it possible to compare)
COleDateTime CTableInfo::edit_date()
{
return edit_date;
}
COleDateTime ct;
CtableInfo in;
ct = in.edit_date(); //this is not happening and
//'=' : cannot convert from 'class COleDateTime (__thiscall
CToleranceTableInfo::*)(void)' to 'class COleDateTime *'
|
|
|
|
|
Cinfo::get_id() is a member function, so to call it you have to use the parameters at the end to denote the parameter list. If not you are getting the address of the function.
int th = gh.get_id(); kk_mfc wrote: COleDateTime CTableInfo::edit_date()
{
return edit_date;
}
Give your function and member variables different names. Right now the function is trying to return it's own address, cast to a COleDateTime pointer. It can not do that.
|
|
|
|
|
Thanks ...
the first solution worked out...
i am already using a different variable name...
COleDateTime CTableInfo::get_edit_date()
{
return m_edit_date;
}
COleDateTime dt;
CTableInfo cy;
dt = cy.get_edit_date();
error mess binary '=' : no operator defined which takes a right-hand operand of type 'class COleDateTime' (or there is no acceptable conversion)
and i am trying to compare the current date with previous date
if(dt == cy.get_edit_date())
if(dt > cy.get_edit_date())
error
binary '==' : no operator defined which takes a left-hand operand of type 'class COleDateTime' (or there is no acceptable conversion)
kk
|
|
|
|
|
What are the error numbers that the compiler gives you (C####)? Looking up those numbers in MSDN can be very helpful in figuring out the errors.
|
|
|
|
|
kk_mfc wrote:
COleDateTime dt;
CTableInfo cy;
dt = cy.get_edit_date();
error mess binary '=' : no operator defined which takes a right-hand operand of type 'class COleDateTime' (or there is no acceptable conversion)
The code you've shown is correct. The problem is related to other code that you've not shown. Change your CTableInfo class such that only necessary statements are present. In other words, remove the statements that have nothing to do with the problem.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
You are not described complete code here.
This code with some spelling correction should work.
kk_mfc wrote: if (th == gh.get_id) (how is it possible to compare)
I think you want to use ,
if (th == gh.get_id ())
{
}
kk_mfc wrote: COleDateTime CTableInfo::edit_date()
{
return edit_date;
}
You have kept class member variable name and function name same.
kk_mfc wrote: ct = in.edit_date(); //this is not happening and
//'=' : cannot convert from 'class COleDateTime (__thiscall
CToleranceTableInfo::*)(void)' to 'class COleDateTime *'
If you corrected above mistake , this error should not come.
whats CToleranceTableInfo
? Thats why I said, you have not desribed your problem clearly.
|
|
|
|
|
Thanks ...
the first solution worked out...
i am already using a different variable name...
COleDateTime CTableInfo::get_edit_date()
{
return m_edit_date;
}
COleDateTime dt;
CTableInfo cy;
dt = cy.get_edit_date();
error mess binary '=' : no operator defined which takes a right-hand operand of type 'class COleDateTime' (or there is no acceptable conversion)
and i am trying to compare the current date with previous date
if(dt == cy.get_edit_date())
if(dt > cy.get_edit_date())
error
binary '==' : no operator defined which takes a left-hand operand of type 'class COleDateTime' (or there is no acceptable conversion)
kk
|
|
|
|