|
To all that have answered so far, Thanks.
Let me clarify a little more. The program is crashing during loading
of "Kernel32.DLL" before it is even getting to "WinApp". There is no
source code except assembly for this level of code. Something has
probably been screwed up in the environment; ie, from the program
crashing the AP-Studio.
Thanks again.
Eldon Zacek
Czech-Mate Enterprises, LLC
|
|
|
|
|
Then I bet you have global instances of some classes that are causing the crash when the application starts.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Yeah, check for their constructors.
Michel
If I am wrong or said something stupid, I apologize in advance
|
|
|
|
|
Hi.
My MFC dialog app is using a console for dumping some boring status info. I AllocConsole() to get it.
Is there a way I can capture the user clicking the close [X] button on the console? and handle it?
Thanks
Jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
You might find your answer by looking at these help from MSDN:
AllocConsole (the console you allocated for your process)
GetStdHandle (get the handle of the above console) ( STD_INPUT_HANDLE)
Reading Input Buffer Event
mouse_event
and the MOUSEEVENT_XDOWN should be the event you interested in.
good luck!
|
|
|
|
|
Hi,
I created a project. I deleted the OK and CANCEL buttons. But when I execute my project and I press the ESC or ENTER KEYS, the project is stopped.
How can I do for inhibe this KEYS?
Best Regards
youssef
|
|
|
|
|
I have this problem before as well. Although the button is not there, but you still have invisible OnOK() and OnCancel() function working for you! would you say it a feature or a bug?
what I did is to overwrite the above two functions, and say if these two buttons don't have input focus, just return. Something like this:
if ( GetFocus() != GetDlgItem(IDOK))
return;
else
CDialog::OnOK();
|
|
|
|
|
void CMyDialog::OnOk()
{
}
void CMyDialog::OnCancel()
{
}
|
|
|
|
|
|
you have to write and add these functions to your project:
void CMyproject::OnCancel(){
}
void CMyproject::OnOk(){
}
|
|
|
|
|
I have created a simple VC Dialog based application and added a CRecordSet through the wizard over a table in the Oracle database using an ODBC connection.
The ODBC connection is fine cause the ODBC test for Oracle has verified it.
The problem is when I call
COracleRecSet recset;
recset.Open();
The application hangs . Can anybody please tell what can be the problem.
|
|
|
|
|
Maybe oracle only support open with:
CRecordset::forwardOnly
|
|
|
|
|
Did you open a CDatabase object first to the database?
Something like :
CDatabase DB;
DB.OpenEx(...)
COracleRecSet recset (&DB);
recset.Open(...)
Best regards,
Alexandru Savescu
|
|
|
|
|
Is it necessary. I think for CRecordSet that was not necessary. But I tried that too.
Sorry same problem. It hangs when calling recset.Open()
|
|
|
|
|
Well I think it necessary. Try stepping into the MFC code and see where it hangs more specifically. There are a lot of reasons for which a Open will fail.
Good luck!
Best regards,
Alexandru Savescu
|
|
|
|
|
First of all thanks that you are taking interest in this.
I traced into the MFC recordset code. The database object gets allocated fine. The application hangs on the actual SC_ API call that connects to the oracle database.
Someone suggested that it can be the problem of the drivers. Can you comment...This problem is really bugging me.
|
|
|
|
|
I need to display a bitmap file at a rate of 10 frames per seconds or higher. I am using Chris' CDIBSectionLite. And here is my code for OnDraw:
HDC hdc = pDC->GetSafeHdc();
HDC hMemDc = CreateCompatibleDC(hdc);
HBITMAP hBmp = m_dib.GetSafeHandle(); // m_dib is an object of CDIBSectionLite
SelectObject(hMemDc, hBmp);
BitBlt(hdc, 0, 0, width, height, hMemDc, 0, 0, SRCCOPY);
DeleteDC(hMemDc);
but the display still flickers, not any better than a direct call to m_dib.Draw(pDC, ptDest, TRUE); or m_dib.Draw(pDC, ptDest, FALSE);
Am I missing anything?
Thank you very much in advance!
|
|
|
|
|
the problem is probably in your OnEraseBackground function. that function will clear the background between OnDraw calls. override it and return FALSE (or is it TRUE? anyway, return whichever says "i'll handle the background myself")
-c
Conscience is what hurts when everything else feels good.
Smaller Animals Software, Inc.
|
|
|
|
|
Hi Chris, I've tried this. I overwrite BOOL CMainFrame::OnEraseBkgnd(CDC* pDC) , but no matter what I returned (TRUE or FALSE), I get the flicking problem all the same.
any clue?
|
|
|
|
|
lucy wrote:
I overwrite BOOL CMainFrame::OnEraseBkgnd(CDC* pDC)
You also have a view though, right? How about implementing OnEraseBkgnd() for the view?
Developers that like shiny objects also dig case mods and scratch-and-sniff stickers. Klaus Probst, The Lounge
|
|
|
|
|
Ah I got it. At first I thought the WM_ERASEBKGND can only be handled by the frameWnd since I couldn't find it in classWizard for the view. After reading your advice, I overwrite the view's WindowProc and check for this message, then overwrite it based on my program requirement. now the bitmap is shown perfectly.
Thank both of you a lot!
|
|
|
|
|
sorry, one more question:
I am updating the display using a bitmap file at a rate of 10 frames per second in a worker thread, when I need to overwrite the process of WM_ERASEBKGND. At the same time, I want to respond to user event, like file open.
The problem is: if my worker thread is running and the background is not erased, there would be funny things left on the display, like the file open dialog even after the dialog is closed. How do I know the WM_ERASEBKGND is posted by the worker thread and when it is posted by other UI thread so that I can treat it differentely in my view?
Thanks a lot!
|
|
|
|
|
Sorry if i missunderstand your question, but:
You should not be posting WM_ERASEBKGND directly. Use Invalidate() , do nothing in OnEraseBkgnd() , and draw the bitmap in OnPaint(). That way, whenever the frame changes, you'll invalidate and the window will repaint. And, when the window is invalidated for some other reason (window is uncovered, menu disappears, etc.) the window will also repaint correctly.
Developers that like shiny objects also dig case mods and scratch-and-sniff stickers. Klaus Probst, The Lounge
|
|
|
|
|
yeah, I think I am doing this. the pseudo code is :
CMainFrame::OnImage()
{
AfxBeginThread(BitmapUpdate, pMyView);
}
UINT BitmapUpdate(LPVOID pParam)
{
m_bImage = true;
while(m_bImage)
{
pMyView->Invalidate();
}
}
CMyView:: OnDraw()
{
}
CMyView::WindowProc(....)
{
if ( message == WM_ERASEBKGND && m_bImage )
return TRUE;
}
but when m_bImage is true, when my bitmap cannot cover the whole client area, background outside my bitmap area will not be updated until I clear m_bImage. What should I do?
|
|
|
|
|
If you know what area the bitmap takes up, just erase the borders around that area before returning on WM_ERASEBKGND . BTW, you should be able to use CMyView::OnEraseBkgnd() instead of CMyView::WindowProc() .
As a side note:
kilowatt has written several very nice articles on these subjects you may want to read; i would especially recommend you read Guide to WIN32 Paint for Intermediates and A Guide to WIN32 Clipping Regions as they are both very relevant to what you are trying to accomplish.
Developers that like shiny objects also dig case mods and scratch-and-sniff stickers. Klaus Probst, The Lounge
|
|
|
|