|
Surround the code for retrieving with a try and catch. then get the error reason by catching the Exception object throught the method what();
I think Jonathan is right. The recordset value is NULL and hence throws an Acess Violation Error
There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing.
Oscar Wilde (1854-1900)
Regards...
Shouvik
|
|
|
|
|
sir thnaks
but i dont know about the what(); function
so can u help me sir
thanks
hi
|
|
|
|
|
Actually I'm not well versed with ODBC section in VC 6.0 So I m just givin u a generalized concept.
Whenever you surround any code with try catch you throw an exception which is the Object of CException Class.
try
{
}
catch(CException e)
{
MessageBox(e.what());
}
So this way you can atleast trace what error are u getting.
There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing.
Oscar Wilde (1854-1900)
Regards...
Shouvik
|
|
|
|
|
sir what() is not working with this
it will give error
'what' : is not a member of 'CException'
please sir solve this
thanks
hi
|
|
|
|
|
Change the code to this:
int i;
MYSQL *myDB = NULL;
MYSQL_RES *res = NULL;
MYSQL_ROW row;
CString user,pass,aqp;
try
{
if((myDB = mysql_init((MYSQL*) 0)) &&
mysql_real_connect(myDB,"localhost","root",NULL,NULL,3306,NULL,NULL))
{
if(mysql_select_db( myDB,"gourav"))
{
GetDlgItemText(IDC_USER,user);
GetDlgItemText(IDC_PASS,pass);
if(mysql_query(myDB,"select * from login"))
{
res=mysql_store_result(myDB);
if(res)
{
row = mysql_fetch_row(res);
if(row != FALSE)
MessageBox(row[0]);
}
}
}
else
MessageBox("Can't connect !\nPlease try later.") ;
mysql_close(myDB);
}
catch(CException& e)
{
MessageBox(e.what());
}
do you get a messagebox with a description of the error in it ?
|
|
|
|
|
no messagebox sir
because what() is not working with this
it will give error
'what' : is not a member of 'CException'
thanks
hi
|
|
|
|
|
Change what() to ReportError()
|
|
|
|
|
hi try this
catch(CException& e)
{
MessageBox(e.ReportError());
}
but gives this error
'MessageBoxA' : cannot convert parameter 1 from 'int' to 'const char *'
hi
|
|
|
|
|
you will find in my previous post how to get the error into the char err[255].
now pass this as
MessageBox(err);
I hope this works for you fine now
There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing.
Oscar Wilde (1854-1900)
Regards...
Shouvik
|
|
|
|
|
virtual BOOL GetErrorMessage(LPTSTR lpszError,UINT nMaxError,PUINT pnHelpContext = NULL);
Sorry if it is not working. use the above function...the lpszError will containt the error message.
you can have the a
char err[255];
exp_obj.GetErrorMessage(err,255);
hope u get my point
There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing.
Oscar Wilde (1854-1900)
Regards...
Shouvik
|
|
|
|
|
I got assertion error when im starting the application. it show me the error at Application class(GUSapp.cpp)
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
Whe i debug it,particularly the error occurs at the line
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
At this line assertion error occurs and it debug library shows File:Winmdi.cpp,Line:139.
Why this error occur? My applcation is MDI application and im working in MFC.
Anu
|
|
|
|
|
The short answer is: because your menu doesnt have enough items in it.
CMDIFrameWnd::OnCreate() attempts to guess which sub-menu is the Window menu. It does this based on the assumption that you have followed the Windows user interface guidelines and have a Help menu as the right-most item and a Window menu immediately to the left of that. The assertion you are getting is specifically because the menu you have made for IDR_MAINFRAME has less than 2 items.
|
|
|
|
|
OK. But i need only one menu for my application and specially i dont want help menu and file,view etc.,
I added a one new menu in IDR_MAINFRAME as Operator Station,thats all. This is enough for me.
IS there anyway to overcome this error?
Anu
|
|
|
|
|
I think before anything else you should read and understand all the functionality of CMDIFrameWnd Class[^] and perhaps review the Win32 MDI documentation[^]
Then you might replace your OnCreateClient with this
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) <br />
{<br />
CMenu* pMenu = NULL;<br />
if (m_hMenuDefault == NULL)<br />
{<br />
pMenu = GetMenu();<br />
ASSERT(pMenu != NULL);<br />
pMenu = pMenu->GetSubMenu(0);<br />
ASSERT(pMenu != NULL);<br />
}<br />
<br />
return CreateClient(lpcs, pMenu);<br />
}
That will append the window list to your single Operator Station menu, you might also need to override other member functions of CMDIFrameWnd such as GetWindowMenuPopup which expects to find a standard window menu.
Alternately you could add a standard Window menu after Operator Station and replace your OnCreateClient with this
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) <br />
{<br />
CMenu* pMenu = NULL;<br />
if (m_hMenuDefault == NULL)<br />
{<br />
pMenu = GetMenu();<br />
ASSERT(pMenu != NULL);<br />
pMenu = pMenu->GetSubMenu(1);<br />
ASSERT(pMenu != NULL);<br />
}<br />
<br />
return CreateClient(lpcs, pMenu);<br />
}
this is the way I would do it, if I really had to leave out the help menu, as it reduces the number of member functions that you might have to override.
Personally I would include the standard Window menu and a simple Help menu with just an about box.
|
|
|
|
|
Yes, It works.I includeed OnCreateClient() and it works fine.
Anu
|
|
|
|
|
It works fine. But i cannot close,minimize,maximize the mainframe as well as child window.Even i have buttons for all this.
Whats the problem in that?Pls help me.
Anu
|
|
|
|
|
Not sure where to start with this. Do you get any messages in the Output window when you debug the application and try to close,minimize,maximize the mainframe or child windows ?
|
|
|
|
|
the output windows shows like this..but no repsonse when i click close or minimize button.
SENDING command id 0x8032 to CMainFrame target.
GUS: PumpMessage: hwnd=0x9F03C4, msg = WM_TIMER (0x0000, 0x00000000)
GUS: WndProc: hwnd=0x9F03C4, msg = WM_TIMER (0x0000, 0x00000000)
GUS: PumpMessage: hwnd=0x7F0376, msg = 0x0373 (0x0000, 0x00000000)
GUS: WndProc: hwnd=0x7F0376, msg = 0x0373 (0x0000, 0x00000000)
GUS: WndProc: hwnd=0x9F03C4, msg = WM_IDLEUPDATECMDUI (0x0001, 0x00000000)
GUS: WndProc: hwnd=0x3C02C4, msg = WM_IDLEUPDATECMDUI (0x0001, 0x00000000)
GUS: WndProc: hwnd=0x35038C, msg = WM_IDLEUPDATECMDUI (0x0001, 0x00000000)
GUS: WndProc: hwnd=0x3C02C4, msg = WM_IDLEUPDATECMDUI (0x0001, 0x00000000)
....Like this only.
Actually we using this application without any frame i.e., we use without any close buttons and minimize and maximize button.
For that we change the code precreatewindow in both mainframe and childframe.
But now we need all windows with these buttons.So i commented the cs Style in precreatewindow in both frames.So i get the buttons but it does not work. Particularly if it is restore position,i can mimimize it. But when i maximize it, i cannot do anything.When i click in that button no clicking action takes place.it just sit as it is.I have OnClose() in CMainframe().But when i close the button it does not move to Onclose() function.
Anu
|
|
|
|
|
Does your CMainFrame have its own OnSysCommand() handler?
If so does it call that base class OnSysCommand()?
|
|
|
|
|
My CMainFrame() don't have OnSysCOmmand function.
I made some sample application in MDI.
But there we dont use OnsysCommand(), but every buttons work perfectly it gets minimized,maximized etc.,
My application also MDI application. Then why this problem?
Really i confused why this problem particularly occur in my application.
Even again i started from the scratch,selectin all project settings and added my class codings.But no use.The same problem exists.
Anu
|
|
|
|
|
I'm sorry I have insufficient information to further analyse this problem. Something in your "class codings" must be interfering with the default message handling.
|
|
|
|
|
Using windows address book, its possible to search active directory for a group or user, right click on it and show the properties.
Can anyone point me in the right direction for this, or possibly give me a clue so I can work it out myself?
Regards
Martin
|
|
|
|
|
I have no idea if this is the right direction, but hopefully it's a possible clue...
Active Directory Domain Services[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for your suggestion, and sorry for writing a completly useless message to describe what I'm trying to do. No-one in the world could figure out what I meant by that, having read back my original message.. It has been a long week!
I am actually trying to programmatically open the properties dialog of a security group or user.. the same dialog which would be displayed by following the steps I descibed before. That is..
Windows Address Book, Edit, Find people, typing in either a user name or a group, right clicking on it and choosing properties.
I am interested in any advice in at the very least locating which dll might be responsible for displaying this dialog.
And if anyone actually has a way of programatically showing this box given maybe an ads path, etc, that would be perfect
Regards
Martin
|
|
|
|
|
hi, i'm a beginner in both MFC and multithreading.
i created a dialog and in my CMy61xxTestDlg.h, i declared:
UINT __cdecl Start(LPVOID pParam);
// CMy61xxTestDlg dialog
class CMy61xxTestDlg : public CDialog
{......
and in my cpp file, i have
hDrv=0;
CWinThread* pThread=AfxBeginThread(Start,(UINT)hDrv,THREAD_PRIORITY_BELOW_NORMAL);
i got error like:
error C2665: 'AfxBeginThread' : none of the 2 overloads could convert all the argument types
.....\afxwin.h(4202): could be 'CWinThread *AfxBeginThread(AFX_THREADPROC,LPVOID,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)'
.....\afxwin.h(4205): or 'CWinThread *AfxBeginThread(CRuntimeClass *,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)'
while trying to match the argument list '(UINT (__cdecl *)(LPVOID), UINT, int)'
could anyone help me with this?
thx!!!
|
|
|
|