|
Thank you,
I am getting Debug Assertion in afxwin1.ini file.
I told that we have to create dlg instance globally because,when i create it inside the initinstance then dialog will be disappeared when the it is out of the scope,so I wanted it as a global one.
|
|
|
|
|
siddharthsan wrote: I am getting Debug Assertion in afxwin1.ini file.
The file is over 1100 lines long. Which one?
siddharthsan wrote: I told that we have to create dlg instance globally because,when i create it inside the initinstance then dialog will be disappeared when the it is out of the scope,so I wanted it as a global one.
Make it a member of your CWinApp -derived class instead.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
So are you directly or indirectly calling AfxGetResourceHandle() ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
No, I am not calling that function directly.
But global declaration where I am doing Is it correct?
After the App instance creation,I am creating Dlg instance.
|
|
|
|
|
siddharthsan wrote: No, I am not calling that function directly.
I also asked about an indirect call. When the assertion fires, check the call stack.
siddharthsan wrote: But global declaration where I am doing Is it correct?
Not in my opinion. Until you actually solve the problem, you'll not know for sure if it's correct or not.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
In my project i want to disable and enable Main Menu at run time using mfc .
I had try to run the following code, but don't send error occurred
CMenu* mmenu = GetMenu();
CMenu* submenu = mmenu->GetSubMenu(0);
submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED);
Please help me How to Disable/Enable Main Menu using View class
|
|
|
|
|
I don't think we can work on Menus using View object. try to get the MainWindow handle and use that handle for obtaining menus.
CWnd* wnd=AfxGetMainWnd();
CMenu* mmenu = wnd->GetMenu();
CMenu* submenu = mmenu->GetSubMenu(0);
submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED);
Try this and i hope this will work fine.
|
|
|
|
|
Hi
I had work with following code in view class, but Debug assertion failed had occured.
code:
CWnd* wnd=AfxGetMainWnd();
CMenu* mmenu = wnd->GetMenu();
CMenu* submenu = mmenu->GetSubMenu(0);
submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED);
|
|
|
|
|
mohindar_kks wrote: ...but Debug assertion failed had occured.
What line of what file is asserting?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi
I had solved Debug assertion failed problem.
Problem : Not disable menu with gray color from the following code
code:
CWnd* wnd=AfxGetMainWnd();
CMenu* mmenu = wnd->GetMenu();
CMenu* submenu = mmenu->GetSubMenu(0);
submenu->EnableMenuItem(ID_FILE_NEW,MF_DISABLED | MF_GRAYED);
|
|
|
|
|
I have to use Web Page in VC++.Can anyone suggests me something
S.Yamini
|
|
|
|
|
You can use Web Browser Control-CWebBrowser2 / CHtmlView
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Try using Web Browser control.
Regards,
Paresh.
|
|
|
|
|
|
yaminisridaran wrote: I have to use...
What do you mean by "use?" If you simply want to open a URL in the default browser, just use ShellExecute() . Otherwise, see the other suggestions.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
how to input strings in new lines in edit box in MFC??????????????
|
|
|
|
|
Use "\r\n" to add a new line.
|
|
|
|
|
Also, make sure the control has the ES_MULTILINE style.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hey, how can change these code in CDaoDatabase... thanks
void CReadDBDlg::OnRead()
{
// TODO: Add your control notification handler code here
CDatabase database;
CString SqlString;
CString sCatID, sCategory;
CString sDriver = "MICROSOFT ACCESS DRIVER (*.mdb)";
CString sDsn;
CString sFile = "C:\\Documents and Settings\\common.MIT-SGP\\Desktop\\new\\ReadDB\\Test.mdb";
// You must change above path if it's different
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);
// Allocate the recordset
CRecordset recset( &database );
// Build the SQL statement
SqlString = "SELECT CatID, Category "
"FROM Categories";
// Execute the query
recset.Open(CRecordset::forwardOnly,SqlString,CRecordset::readOnly);
// Reset List control if there is any data
ResetListControl();
// populate Grids
ListView_SetExtendedListViewStyle(m_ListControl,LVS_EX_GRIDLINES);
// Column width and heading
m_ListControl.InsertColumn(0,"Category Id",LVCFMT_LEFT,-1,0);
m_ListControl.InsertColumn(1,"Category",LVCFMT_LEFT,-1,1);
m_ListControl.SetColumnWidth(0, 120);
m_ListControl.SetColumnWidth(1, 200);
// Loop through each record
while( !recset.IsEOF() )
{
// Copy each column into a variable
recset.GetFieldValue("CatID",sCatID);
recset.GetFieldValue("Category",sCategory);
// Insert values into the list control
iRec = m_ListControl.InsertItem(0,sCatID,0);
m_ListControl.SetItemText(0,1,sCategory);
// goto next record
recset.MoveNext();
}
// Close the database
database.Close();
}
CATCH(CDBException, e)
{
// If a database exception occured, show error msg
AfxMessageBox("Database error: "+e->m_strError);
}
END_CATCH;
}
|
|
|
|
|
Did you try having a look at the Database articles at this site?
|
|
|
|
|
hi friend!
To add CDAORecordset class, create a new class from class wizard.
Type the Class name in the Name dialog box (e.g. CCEmp_Recset) and select the Base class as CDAORecordset.
Open the Emp_Dlg header file and add the following codings:
class CEmp_Recset;
with in the CEmp_Dlg class add the pointer variable
CEmp_Recset *m_set;
Add the member function in as
void Emp_Getset( ) for Receiving data from the table and transferred to dialog box.
void Emp_Setget( ) for transferring the data from the Dialog to table.
type the following coding on OnInitDialog( ) Function:
m_set = new CEmp_Recset();
m_set->Open();
Emp_Getset();
Type the following coding with in the function
void CEmp_Dlg::Emp_Getset()
{
m_ac_no = m_set->m_ac_no;
m_bank_name = m_set->m_bank_name;
m_bank_code = m_set->m_bank_code;
m_micr_no = m_set->m_micr_no;
m_remark = m_set->m_remark;
UpdateData(FALSE);
}
void CEmp_Dlg::EmpSetget()
{
UpdateData(TRUE);
m_set->m_ac_no = m_ac_no;
m_set->m_bank_name = m_bank_name;
m_set->m_bank_code = m_bank_code;
m_set->m_micr_no = m_micr_no;
m_set->m_remark = m_remark;
}
void CEmp_Det_Dlg::OnClickBtnMfisrt()
{
// TODO: Add your control notification handler code here
mset->MoveFirst();
Emp_Getset();
}
void CEmp_Det_Dlg::OnClickBtnMnext()
{
// TODO: Add your control notification handler code here
if(mset->IsEOF())
{
MessageBox("Reached at EOF()");
}
else
{
mset->MoveNext();
Emp_Getset();
}
}
void CEmp_Det_Dlg::OnClickBtnMprev()
{
// TODO: Add your control notification handler code here
if(mset->IsBOF())
{
MessageBox("Reached at BOF()");
}
else
{
mset->MovePrevious();
Emp_Getset();
}
}
void CEmp_Det_Dlg::OnClickBtnMlast()
{
// TODO: Add your control notification handler code here
mset->MoveLast();
Emp_Getset();
}
pls mail me if u need any help i will send a sample project..
AK
|
|
|
|
|
hero1995 wrote: hey, how can change these code in CDaoDatabase...
Why are you wanting to change CDaoDatabase code? It would be easier to just derive a class from CDaoDatabase . Take advantage of the virtual methods to supply your specific code.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello, could somebody help me in sending and receiving a struct via winsock?
Do I have to allocate memory for the struct before sending/receiving?
How can I properly access the members of the structure after receiving?
Any help would be appreciated... bye
(I'm using VC++ 6 and Winsock 2 on asynchronous TCP socket)
|
|
|
|
|
sockets only understand bytes.
To send a struct you send it as a stream of bytes.
To get a pointer to the struct use the "address of" operator (&)
You'll need to cast this to a char* for some socket operations.
For the length of the struct (in bytes), use the sizeof operator.
When you receive the number of bytes equal to the sizeof the struct, you can cast a pointer to
those bytes into a struct pointer or just receive the bytes directly into a struct object.
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|