|
Thanks bob16972
for your help
|
|
|
|
|
hi all
i have made an application in vc++ with mysql as database
i have face a problem that it gives a problem as unhandled exception access voilation
i use debugger but i cannot solve problem becoz debugger does not show error
it show LIBMYSQL! 10007764() and i could not understand this
please help me
hi
|
|
|
|
|
paras_s12 wrote: Wow. That has absolutely nothing related to your first post
Can you post the code that does not work ?
|
|
|
|
|
if(!mysql_query(myDB,"SELECT passowrd from login WHERE user= \'" + user + "\'")
res=mysql_store_result(myDB);
if (!res)
{
MessageBox("Could not run query");
}
row = mysql_fetch_row(res);
{
i = (int) mysql_num_rows( res );
if (i != 1)
{
MessageBox("WRONG LOGIN PLEASE TRY AGAIN"," pop. ",MB_ICONASTERISK);
mysql_free_result( res ) ;
the problem is that data is not fetched
and i think exception is due to no value in res
hi
|
|
|
|
|
So why are you not stepping through this code to find the problem? The debugger is your friend. Learn to use it.
"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
|
|
|
|
|
i want to execute some code when a dialog is destroyed, but the code in DeatroyWindow() function doesn't executes when i use EndDialog() but executes when i use DestroyWindow().
What is the diff. between these two and which should be best to use?
|
|
|
|
|
I'd go for DestroyWindow(), or OnOK, OnCancel if you are using MFC. I've never done anything with EndDialog().
|
|
|
|
|
i use EndDialog()for modal dialog boxs and DestroyWindow() for modeless dialog boxes
|
|
|
|
|
Dialog Window Created by DialogBox, DialogBoxIndirect .. should be destroyed using EndDialog. OnOk, OnCancel internally uses EndDialog.
And surely OnDestroy() will get called when EndDialog is used.
Are u using MFC?
|
|
|
|
|
DestroyWindow is something you call, not something that gets called. In MFC,
CWnd::DestroyWindow() is virtual. If you've overridden it, your override will get called at the
end of DoModal() but that doesn't make it a good place to do something when a dialog is destroyed.
That's a side effect of the way MFC does modal dialogs.
I think a better place is any time at or after you receive a WM_NCDESTROY message.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
ya... i'm too thinking that...
because i've placed code in overridden DestroyWindow() function
but it never gets called if EndDialog() method is used to close the dialog box.
|
|
|
|
|
Abhijeet Pathak wrote: but it never gets called if EndDialog() method is used to close the dialog box.
Looking at the source code, that is correct
Note that when you receive WM_NCDESTROY, child windows (controls etc) have been destroyed.
If you need access to the controls before they are destroyed, respond to WM_DESTROY which is sent
before WM_NCDESTROY.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello!
Please help me!
Whether can Windows Media Encoder read such stream:http://wm1.streaming.castor.nl/castor=castorradio
If yes that as?
If is not present, than it would be possible to read what to transfer the ambassador on processing in Windows Media Encoder?!
|
|
|
|
|
If I get press enter key message from edit control, like this:
<br />
BOOL PreTranslateMessage(MSG* pMsg) <br />
{ <br />
<br />
if(pMsg->message == WM_KEYDOWN) <br />
{ <br />
<br />
CWnd *p = GetDlgItem(IDC_EDIT1); <br />
<br />
if(pMsg->wParam == VK_RETURN && pMsg->hwnd == p->m_hWnd ) <br />
{ <br />
MessageBox("OK"); <br />
return TRUE; <br />
} <br />
<br />
} <br />
<br />
return CDialog::PreTranslateMessage(pMsg); <br />
}<br />
that's OK, but if I get press enter key message from combobox control:
<br />
BOOL PreTranslateMessage(MSG* pMsg) <br />
{ <br />
<br />
if(pMsg->message == WM_KEYDOWN) <br />
{ <br />
<br />
CWnd *p = GetDlgItem(IDC_COMBO);
<br />
if(pMsg->wParam == VK_RETURN && pMsg->hwnd == p->m_hWnd ) <br />
{ <br />
MessageBox("OK"); <br />
return TRUE; <br />
} <br />
<br />
} <br />
<br />
return CDialog::PreTranslateMessage(pMsg); <br />
}<br />
pMsg->hwnd not equals p->m_hWnd,
why?
|
|
|
|
|
Hi,
I think this is because combo box is not a single window,it is a combo of list box, edit box and combo itself.
Try CComboBox::GetComboBoxInfo() and it has three HWND handle and match the EDIT box handle as the Enter key message must have been issued from edit control.
Best regards
Rajkumar
|
|
|
|
|
As I looked at some of the examples and articles posted on this site, and trying to code a scalable server, I have a few questions about the design.
How many I/O completion ports does a scalable server usually will use? I thought about it and decided maybe 2 or more? However, most examples I saw uses just 1. Two would mean one for a thread that solely accepts new connections using AcceptEx extension function loaded using WSAIoctl, and the other for another thread that deals with overlapped send, receive and transmit.
Or is it better to have a completion port per task? Say four for new connections, send, receive and transmit each on their own thread?
|
|
|
|
|
|
Thanks for the tip, I think I finally managed to get it working, well, just a basic implementation. I got a much clearer picture of how it works in the background.
|
|
|
|
|
hai,
i am a new member..
i am doing zoom program in vc++ using buttons.
i am creating a lcd display having 240*128 pixls.
i have to zoom a wave in lcd either in right,left,up,down using these buttons.
any body please help me.
thanks in advance..
rokini.k
roki
|
|
|
|
|
Although I don't know the details of how you have implemented your lcd, a technique that might be useful is changing the mapping mode of the window (lcd). IOW, you would scale the dimensions of your current mapping mode (if your mapping mode is MM_ISOTROPIC or MM_ANISOTROPIC)...
Please, give more information, if you think you need more precise answers.
--
=====
Arman
|
|
|
|
|
Does this help?
"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
|
|
|
|
|
hai,
thank you for ur reply...
i will post my code...
BOOL CLcdDispDlg::OnInitDialog()
{
int i,j;
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
lWhiteBrush.CreateSolidBrush(crWhite);
lRedBrush.CreateSolidBrush(crRed);
//lGreenBrush.CreateSolidBrush(crGreen);
//lAmberBrush.CreateSolidBrush(crAmber);
//lBlueBrush.CreateSolidBrush(crBlue);
lYellowBrush.CreateSolidBrush(crYellow);
lGrayBrush.CreateSolidBrush(crGray);
lWhitePen.CreatePen(PS_SOLID,1,crWhite);
lGridPen.CreatePen(PS_SOLID,1,crGrid);
lBorderPen.CreatePen(PS_SOLID,1,crBorder);
lRedPen.CreatePen(PS_SOLID,1,crRed);
//lGreenPen.CreatePen(PS_SOLID,1,crGreen);
//lAmberPen.CreatePen(PS_SOLID,1,crAmber);
//lBluePen.CreatePen(PS_SOLID,1,crBlue);
lYellowPen.CreatePen(PS_SOLID,1,crYellow);
lGrayPen.CreatePen(PS_SOLID,1,crGray);
for (i=0;i<240; i++)
for (j=0;j<128; j++)
{
lcd[i][j][0]=i*pitchx;
lcd[i][j][1]=j*pitchy;
}
return TRUE; // return TRUE unless you set the focus to a control
}
void CLcdDispDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CLcdDispDlg::OnPaint()
{
int i,j;
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CPaintDC dc(this); // device context for painting
CRect lRect;
lRect.left=x-10;
lRect.right=x+dx+10;
lRect.top=y-10;
lRect.bottom=y+dy+10;
lOldBrush=dc.SelectObject(&lGrayBrush);
lOldPen=dc.SelectObject(&lGrayPen);
dc.Rectangle(lRect);
dc.MoveTo(x,y);
dc.LineTo(x+dx,y);
dc.LineTo(x+dx,y+dy);
dc.LineTo(x,y+dy);
dc.LineTo(x,y);
lOldPen=dc.SelectObject(&lYellowPen);
for (i=0;i<240;i++)
for (j=0;j<128;j++)
{
x=lcd[i][j][0];
dx=2;
y=lcd[i][j][1];
dy=2;
dc.MoveTo(x,y);
dc.LineTo(x+dx,y);
dc.LineTo(x+dx,y+dy);
dc.LineTo(x,y+dy);
dc.LineTo(x,y);
}
for(i=0;i<240;i++)
{
for(j=0;j<64;j++)
x=lcd[i][j][0];
dx=1;
y=lcd[i][j][1];
dy=1;
dc.MoveTo(x,y);
dc.LineTo(x+dx,y);
dc.LineTo(x+dx,y+dy);
dc.LineTo(x,y+dy);
dc.LineTo(x,y);
}
for(j=0;j<128;j++)
{
i=55;
x=lcd[i][j][0];
dx=1;
y=lcd[i][j][1];
dy=1;
dc.MoveTo(x,y);
dc.LineTo(x+dx,y);
dc.LineTo(x+dx,y+dy);
dc.LineTo(x,y+dy);
dc.LineTo(x,y);
}
lRect.left=lcd[i][j][0];
lRect.right=lcd[i][j][0];
lRect.top=lcd[i][j][1];
lRect.bottom=lcd[i][j][1];
dc.Ellipse(lRect);
CDialog::OnPaint();
}
}
void CLcdDispDlg::OnZoomin()
{
i want to add code here;
}
please give some idea..
i implemented so many mehods...
but it didnt work out..
thank you in advance...
rokini.k
|
|
|
|
|
hai friend,
thank you for ur reply..
But i am not using bitmap..
directly in onpaint() method i created lcd display screen.
i want to zoom this display..
rokini.k
|
|
|
|
|
Dear all
I add one lib file to my VC++ 6 project. and want to debug my project.
But I can not add debug information of lib file to debug information of my project.
I have the source code of lib file also.
If you know how I can remove this error please let me know.
Regards
Monhi
|
|
|
|
|
What happens when you try to debug ?
What error are you getting ?
|
|
|
|