|
ns wrote:
If by chance or perversity the user chooses a random folder with none of the expected images in it, a grand crash ensues. How can I exit gracefully in case this happens?
IMO, the real question you should be asking is "why is there a crash at all?" you should be checking for possible error situations everywhere, and acting accordingly at all times. it's a bad idea to assume every situation is a good one.
if you really need to exit immediately, try PostQuitMessage. but, that's really not much better than simply crashing, since the user has no clue as to what went wrong in either case.
-c
"I am angry that so many of the sons of the powerful and well-placed... managed to wangle slots in Reserve and National Guard units...Of the many tragedies of Vietnam, this raw class discrimination strikes me as the most damaging to the ideal that all Americans are created equal and owe equal allegiance to their country."
--Colin Powell
|
|
|
|
|
ns wrote:
If they browse to a random database, it will crash of course
You access the database through a db driver, right ? So, depending on the database (sql server, oracle, mysql, ...) you have system tables describing user tables.
And I swallow a small raisin.
|
|
|
|
|
Just handle the db errors - depending on the data access technology you're using, you may have to check error code or catch appropriate exception.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Hi there,
Is there way to show URL address in CRichEditCtrl like URL link in webpages ??
I mean when user hit the link in the CRichEditCtrl my program open browser …
Please help me …
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Yeah, but the user has to have RichEdit 2.0 on the system, so make sure you program a fail safe... most will have it but all it takes is that one who doesn't. But any way here you go.
<br />
<br />
HANDLE m_hRichEdit2 = LoadLibrary(_T("RICHED20.DLL"));<br />
if (m_hRichEdit2 == NULL) <br />
{ <br />
AfxMessageBox("Failed to initialize rich edit 2.0", MB_OK | MB_ICONEXCLAMATION); <br />
return FALSE; <br />
} <br />
<br />
CRichEditCtrl m_ctlEdit;<br />
if (m_hRichEdit2 != NULL)<br />
m_ctlEdit.SendMessage(EM_AUTOURLDETECT, (WPARAM)TRUE, 0); <br />
if (m_hRichEdit2 != NULL)<br />
m_ctlEdit.SendMessage(EM_AUTOURLDETECT, (WPARAM)FALSE, 0);<br />
<br />
<br />
if (m_hRichEdit2 != NULL)<br />
{<br />
::FreeLibrary(m_hRichEdit2);<br />
} <br />
<br />
<><><><><><><><><><><><><><>
Matthew R. Miller
mattrmiller@computersmarts.net
www.computersmarts.net
|
|
|
|
|
Coool, Thanks for sample
I have just a little question about your code ...
So, By your source code, if i have a URL address, RichEdit box make link for it, automaticly ... right ???
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Yup! Just like in Outlook or Outlook Express
<><><><><><><><><><><><><><>
Matthew R. Miller
mattrmiller@computersmarts.net
www.computersmarts.net
|
|
|
|
|
Ok, Thanks aloooot for your helps
With Best Regards
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
You bet!
<><><><><><><><><><><><><><>
Matthew R. Miller
mattrmiller@computersmarts.net
www.computersmarts.net
|
|
|
|
|
Hello again Mr.Matthew,
I'm sorry but i have other little problem ...
I used of your source code for using links in a rich edit box ...
But there is a problem, your code just change the mouse arrow and text case to link ... but when i click on that it doesn't work
I want to when i click on a link in rich edit, my program open IE browser ...
How can i do that ?
Please help me ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Just a sec... looking at my code.. I could have forgotten something. Be back in a minute
<><><><><><><><><><><><><><>
Matthew R. Miller
mattrmiller@computersmarts.net
www.computersmarts.net
|
|
|
|
|
DUH!!! I forgot to tell you to subclass it. There are other ways to do this, but this is the easiest in my opinion.
BOOL CMyRichEdit::PreCreateWindow(CREATESTRUCT& cs)
{
// Make sure Rich Edit 2
cs.lpszClass = "RICHEDIT20A";
return CMyRichEdit::PreCreateWindow(cs);
}
See if that completes it, sorry about that.
<><><><><><><><><><><><><><>
Matthew R. Miller
mattrmiller@computersmarts.net
www.computersmarts.net
|
|
|
|
|
|
Hello again dear Matthew,
Sorry for delay ...
I add this code, too but it doesn't work
BOOL CMyRichEdit::PreCreateWindow(CREATESTRUCT& cs)
{
// Make sure Rich Edit 2
cs.lpszClass = "RICHEDIT20A";
return CMyRichEdit::PreCreateWindow(cs);
}
What's wrong ?
Can you send your project for me ?
Please help me ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Unfortunately my project is a product, so I really can't send that to you. That is really all that I did to implement it, don't know how you are doing it exactly.... but if you want to email me your rich edit class I can compare it to mine.... I looked at my code last night after the post... and that is really all I had. But send me some code and I can compare it.
<><><><><><><><><><><><><><>
Matthew R. Miller
mattrmiller@computersmarts.net
www.computersmarts.net
|
|
|
|
|
Mr.Matthew, I sent a mail for you
Please check it as soon as possible
With Best Regards
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I sent you the fixed project, you never loaded the DLL, which is needed.
<><><><><><><><><><><><><><>
Matthew R. Miller
mattrmiller@computersmarts.net
www.computersmarts.net
|
|
|
|
|
It doesn't work again
Please check my mail
Regards,
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
How do I read the mime settings for an extension and then retrieve the icon path and index? Can this be done efficiently?
Also. How do I get the path of the system directory. For example mine is C:\Windows\System32. I want my app to be able to adjust for varying installations.
- Matt Newman / Windows XP Activist
-Sonork ID: 100.11179
"You can't seriously believe that you could get away with suing someone over quoting text from a message posted in a public forum, can you?" - John Simmons
|
|
|
|
|
For the mime settings I believe you have to read them from the registry.
And the simplest way to obtain a path to the windows dir is GetWindowsDirectory() and GetSystemDirectory() or just use ExpandEnvironmentStrings()
int x=1, y=5;
x^=y^=x^=y;
<a href="http://www.codeproject.com/tips/StupidXORTrick.asp" target="_blank">ClickHereForHelp();</a>
|
|
|
|
|
Andreas Saurwein wrote:
GetSystemDirectory()
Thanks, thats what I needed
- Matt Newman / Windows XP Activist
-Sonork ID: 100.11179
"You can't seriously believe that you could get away with suing someone over quoting text from a message posted in a public forum, can you?" - John Simmons
|
|
|
|
|
If you delete a record from a database, do the remaining records arrange themselves so that if #5 was deleted, #6 now becomes the new #5 etc?
Or does some other type of reordering hapen? If so what control do we have over this ordering?
|
|
|
|
|
Depends of the primary key of the table....
I believe that that will happen.
Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Thanks. There is no primary key though....I am doing PutAbsolutePosition(index) and deleting them.
If there are none left, and I try to delete one, I am sure it will crash. so how would I test my delete condition? Check recordcount before each delete?
Important question: ReQuery(-1)
Do I have to requery? I feel that I should so that the deleted record vanishes (thats what I read anyways). Whats your opinion?
thanks,
ns
|
|
|
|
|
It depends. If you are using CRecordset and ODBC then they are not arranged. You sould use Move(0) to refresh current row. Also you can test if the row has beem deleted with the IsDeleted method.
Best regards,
Alexandru Savescu
|
|
|
|