|
that does work, i then have it call OnERASEBKGND(GetDC()), but it seems to call the erasing after the drawing.. as my background gets drawn over the data.. thanks for the help tho!
|
|
|
|
|
LRESULT CMyView::WindowProc(UINT message, WPARAM wParam, LPARAM)
{
if ( message == WM_ERASEBKGND )
{
MessageBox("erase");
return TRUE;
|
|
|
|
|
It's OnEraseBkgnd() not OnERASEBKGND().
Developers that like shiny objects also dig case mods and scratch-and-sniff stickers. Klaus Probst, The Lounge
|
|
|
|
|
thanks a bunch
-dz
|
|
|
|
|
The following code to populate a List Control Box with data from a database when a button is pressed works successfully when the List Control Box is placed on the main IDD_DIALOG. However when the List Control Box and button is placed on a tab, eg IDD_TAB1 the program hangs when the button is pressed.
(The header files "afxdb.h" and "odbcinst.h" are included in both the mainDlg.cpp and Tab1Dlg.cpp)
Any ideas as to why this is happening?
Any help is greatly appreciated.
Aoife
***********************************************************
void CInterfaceDlg::OnMainRead()
{
CDatabase database;
CString SqlString;
CString sNumber, sSender, sDate, sMessage;
CString sDriver = "MICROSOFT ACCESS DRIVER (*.mdb)";
CString sDsn;
CString sFile = "c:\\THE PROJECT\\Interface\\Project_Databases.mdb";
int iRec =0;
//Build ODBC connection string
sDsn.Format("ODBC;DRIVER={%s};DSN='';DBQ=%s",sDriver,sFile);
TRY
{
//Open the Database
database.Open(NULL,false,false,sDsn);
//Allocte the Record set
CRecordset recset (&database);
//Build the SQL statement
SqlString = "SELECT Number, Sender, Date, Message "
"FROM pc_Inbox";
//Execute the query
recset.Open(CRecordset::forwardOnly,SqlString,CRecordset::readOnly);
//Populate the Grids
ListView_SetExtendedListViewStyle(m_listControl,LVS_EX_GRIDLINES);
//Column width and heading
m_listControl.InsertColumn(0, "SMS No.", LVCFMT_LEFT, -1,0);
m_listControl.InsertColumn(1, "Sender", LVCFMT_LEFT, -1,1);
m_listControl.InsertColumn(2, "Date", LVCFMT_LEFT, -1,2);
m_listControl.InsertColumn(3, "Message", LVCFMT_LEFT, -1,3);
m_listControl.SetColumnWidth(0, 100);
m_listControl.SetColumnWidth(1, 100);
m_listControl.SetColumnWidth(2, 100);
m_listControl.SetColumnWidth(3, 200);
//Loop through each record
while (!recset.IsEOF())
{
//Copy each column into a variable
recset.GetFieldValue("Number",sNumber);
recset.GetFieldValue("Sender",sSender);
recset.GetFieldValue("Date",sDate);
recset.GetFieldValue("Message",sMessage);
//Insert values into the list control
iRec = m_listControl.InsertItem(0,sNumber,0);
m_listControl.SetItemText(0,1,sSender);
m_listControl.SetItemText(0,2,sDate);
m_listControl.SetItemText(0,3,sMessage);
//Go to the next record
recset.MoveNext();
}
//Close the Database
database.Close();
}
CATCH(CDBException, e)
{
//If a database exception occured, show an error message
AfxMessageBox("Database error: "+e->m_strError);
}
END_CATCH;
}
|
|
|
|
|
I try it. no problems!
maybe you should look:
1. use IsBOF before while ( oracle happen error when the recordset is empty)
2. sure Close Database at any condition
|
|
|
|
|
I have a CDialogBar instance docked on CFrameWnd derived class. If I undock the dialog bar and close it, then the 'x' on the right top of the FrameWnd does not close the window. It has no effect. Infact, it seems that the whole title bar gets disabled.
Interestingly this does not happen, when I hide the dialogbar through a menu item using the 'ShowControlBar' API.
Have you guys come across this before?
Thanks for any help
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
After recompiling program for release mode, the program crashes on startup
in Kernel32.DLL. I get the following error message:
First-chance exception in tachmate.exe (KERNEL32.DLL): 0xC0000005: Access Violation.
Any clue as how to attack this would be appreciated!
Thanks.
Eldon Zacek
Czech-Mate Enterprises, LLC
|
|
|
|
|
Debug it.
Jeremy L. Falcon
"The One Who Said, 'The One Who Said...'"
<nobr>
Homepage : Sonork = 100.16311 01000010011011110110001000100000011101110110000101110011 00100000011010000110010101110010011001010010111000000000
|
|
|
|
|
did you verify that the arguments and compiling options are the same in debug and in release mode?
if yes, it's perhaps because release mode is faster than debug, so if you have a multithreaded app, it could crash because a threads are not launch at the same times.
wish that would help
|
|
|
|
|
Turn on debugging information in release mode. However, make sure you keep optimizations turned on.
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?
|
|
|
|
|
the slow way: sprinkle file writes through out your program that say things like "I'm in function CFoo::DoFoo with params X, Y and Z". have these all go to the same file (appending to the file). you can use one of the many file logging classes here on CP for this.
the fast way: go to Project / Settings. in the C/C++ section, General category, change optimizations to Disabel (Debug); change Debug info to "Program Database for Edit and Continue" or "C7 Compatible". On the Link tab, check "Generate Debug Info". now, rebuild your app and debug it as you would a "Debug" build. be sure to change everything back, for your real release.
-c
Conscience is what hurts when everything else feels good.
Smaller Animals Software, Inc.
|
|
|
|
|
Configure your release build with debugging symbols, then run it through the debugger. I suggest:
1- After compiling the release version, run it outside the debugger. When it crashes, choose <Cancel> in the window in order to start the debugger. The debugger will point you at the point it crashes. Use the drop-down to navigate in the call stack.
2- If you didn't figure out right away what went wrong, you at least have a better idea of where to put your break points. Now you can run it inside the debugger.
AS a side note, this happens probably because the debug version of malloc puts guard bytes before and after the memory allocated, which it does not do for the non-debug version.
Michel
If I am wrong or said something stupid, I apologize in advance
|
|
|
|
|
Tim Smith wrote:
However, make sure you keep optimizations turned on
Hmmm.... I was always under the impression (and experience) that the VC++ optimizer could do some strange things, so would it not make sense to have them turned off when trying to debug a release-only problem? Just to be sure that optimizations are not causing the problem?
Peace!
-=- James.
|
|
|
|
|
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.
|
|
|
|
|