|
Maybe when the image is first aquired you could create a CBitmap and us the SetBitmapBits method. Then in your OnDraw you could render the bitmap instead of processing the the array each time. Just a possiblity, don't know if it will work for you.
Also, for future you can use the <pre> or <code> tags for any code snippets. Or at least use the HTML encoding < rather than "less than"
|
|
|
|
|
Whats the easiest way to pass the Parameter BSTR pkMbtID to the stored procedure "Values(pkMbtID....."
Must i use crateparameter method or what.
STDMETHODIMP CMBT::ADDMBT(BSTR pkMbtID, BSTR MbtType)
_bstr_t ProcMBT (L"Alter proc sp_AdoTest"
L"as "
L"INSERT INTO MBT (pkMbtID, MbtType) Values Values(pkMbtID, MbtType)");
L"return");
/Bigge
|
|
|
|
|
Just use it. If your stored proc is expecting a varchar, or the like, a BSTR will work. This is COM after all.
|
|
|
|
|
if you are going to use the CreateParameter method via ADO then you will need to supply the value as a varaint. The best way to do this is to use the wrapper classes _variant_t and _bstr_t
e.g.
_variant_t vValue(_bstr_t("Hello"));
|
|
|
|
|
What is the easiest way to set tooltips for static-controls (or any other controls such as buttons etc.)?
thanks in advance
|
|
|
|
|
You will have to use the CToolTipCtrl class, see msdn for more info
|
|
|
|
|
I tried out
It works with buttons, but the tooltips do not seem to work in my static-controls
|
|
|
|
|
This is the first time I've ever had to do printing within the MFC framework. I have a CRichEditView that does not stop spewing out pages. I started debugging in OnPrint and I notice that the CRichEditView calls GetTextLength() to get the length of the text in the control, it then compares it to the amount of text printed PrintPage(), but those numbers never match. The return from GetTextLength is ALWAYS greater by a couple hundred bytes than the call from PrintPage. Has anyone else seen this problem? I tried doing my own pagination, but I never know when the end of the document is because of the seeminly erroneous return from either GetTextLength or PrintPage. Are the RTF formatting characters in the control being counted as characters in the GetTextLength call and PrintPage?
Any help is appreciated.
Bill
http://www.ratebeer.com
|
|
|
|
|
I write a program which used database and use Multi View in splitter window,
when I switch the view,I must check if the database is empty first.If so, how can I show a message,such as the database is empty ..
|
|
|
|
|
How about ....
AfxMessageBox("The Database is empty");
Some how, I don't think this is the answer you want, but thats how I read it
|
|
|
|
|
When should I show this message when I switch the view?
|
|
|
|
|
What about showing it when the view gets the focus ?
Or better showing it directly in the view. And disabeling any edit buttons handled
by the view.
In general ist much better to disable operations not possible at the moment, instead
of popping up message boxes all over the app.
The user hates to click them away and doesn't read the text in the message box
(Most usrers I know of)
|
|
|
|
|
I have a simple Win32 program that creates an overlapped window containing an edit control. Can somebody please tell me the correct way to set the focus on the edit control when the main application window is selected. I have tried to call SetFocus(hEdit) in response to the WM_ACTIVATEAPP message but this doesn't work.
Thanks for any information you can provide.
Steve.
|
|
|
|
|
Call SetFocus(hEdit) when the main window gets a WM_SETFOCUS.
Oliver
|
|
|
|
|
Hi Gurus
I'm facing a problem using a CListView derived class ( in report style ) in wich I need to draw a particular CHeaderCtrl element in a different color...
Any Idea ?
Thank's in advance )
New to MFC
|
|
|
|
|
Handle NM_CUSTOMDRAW sent from the header, and change the colors in response to that message.
--Mike--
http://home.inreach.com/mdunn/
Ford: How would you react if I said that I'm not from Guildford after all, but from a small planet somewhere in the vicinity of Betelguese?
Arthur: I don't know. Why, do you think it's the sort of thing you're likely to say?
|
|
|
|
|
Hi Mike,
Thank's for your answer
I've already tried it, but it still do not work, here's what I've done...
BEGIN_MESSAGE_MAP(CAgendaView, CListView)
//{{AFX_MSG_MAP(CAgendaView)
//}}AFX_MSG_MAP
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
END_MESSAGE_MAP()
/****************************************************************************
*
*
*
*
****************************************************************************/
void CAgendaView::OnCustomDraw( NMHDR* pNMHDR, LRESULT* pResult )
{
LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW )pNMHDR;
if( lplvcd->nmcd.dwDrawStage == CDDS_PREPAINT )
*pResult = CDRF_NOTIFYITEMDRAW;
else
{
if( lplvcd->nmcd.dwDrawStage == CDDS_ITEMPREPAINT )
{
if( lplvcd->nmcd.dwItemSpec == 2 )
{
lplvcd->clrText = RGB( 0, 0, 255 );
*pResult = CDRF_NEWFONT;
}
else
*pResult = CDRF_DODEFAULT;
}
else
*pResult = 0;
}
}
Thank's
Bernard
New to VC++
|
|
|
|
|
ON_NOTIFY_REFLECT will handle notifications from the list control, not the header. Change that to ON_NOTIFY(NM_CUSTOMDRAW, 0, OnHeaderCustomdraw) to handle WM_NOTIFY sent from the header to the list.
The reason is a control sends WM_NOTIFY to its parent, so the header sends WM_NOTIFY to the list control. The ID of a list header is always 0, so that's why you use 0 in the ON_NOTIFY macro.
--Mike--
http://home.inreach.com/mdunn/
Ford: How would you react if I said that I'm not from Guildford after all, but from a small planet somewhere in the vicinity of Betelguese?
Arthur: I don't know. Why, do you think it's the sort of thing you're likely to say?
|
|
|
|
|
Tank's Mike
I'm almost at it, but I still have a problem...
My function handles the NM_CUSTOMDRAW well, but even if I change the color ( lplvcd->clrText = RGB( 0, 0, 255 ); ), the HeaderCtrl still paint's my foreground in black.
New to VC++
|
|
|
|
|
You don't use NMLVCUSTOMDRAW with a header, it's just a plain NMCUSTOMDRAW. Here's a snippet that works:
BEGIN_MESSAGE_MAP(CNewListCtrl, CListCtrl)
ON_NOTIFY(NM_CUSTOMDRAW, 0, OnHdrCustomdraw)
END_MESSAGE_MAP()
void CNewListCtrl::OnHdrCustomdraw(NMHDR* pNMHDR, LRESULT* pResult)
{
NMCUSTOMDRAW* pNMCD = (NMCUSTOMDRAW*) pNMHDR;
*pResult = CDRF_DODEFAULT;
switch ( pNMCD->dwDrawStage )
{
case CDDS_PREPAINT:
*pResult = CDRF_NOTIFYITEMDRAW;
break;
case CDDS_ITEMPREPAINT:
::SetTextColor ( pNMCD->hdc, RGB(0,0,255) );
break;
}
} Where CNewListCtrl is derived from CListCtrl.
--Mike--
http://home.inreach.com/mdunn/
Ford: How would you react if I said that I'm not from Guildford after all, but from a small planet somewhere in the vicinity of Betelguese?
Arthur: I don't know. Why, do you think it's the sort of thing you're likely to say?
|
|
|
|
|
Thank's Mike, you're a genious
Hello chérie, was it written in the stars, that we were supposed to fraternize ( Pepé Le Pew )
|
|
|
|
|
Is there a way to use a toolbar button to activate a hyperlink in a new window???
Thank-you
Sincerely,
RAH
|
|
|
|
|
If you have the hyperlink, call ShellExecute with the "open" verb and the url to show. Or if you have the IWebBrowser2 object you can call the IWebBrowser2::Navigate with a Target of "_BLANK" which will open it in a new window.
Cheers,
-Erik
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My thoughts are my own and reflect on no other.
|
|
|
|
|
I really need somebody to help me!!! HOW can I change the text color from a CRichEditCtrl
I've tried everything but I can't !!!
|
|
|
|
|
Look at SetCharFormat in the CRichEditView class. In the CRichEditCtrl class you have a little more flexibility as you can use the SetDefaultCharFormat, SetSelectionCharFormat or SetParaFormat for character, selected text or current paragraph respectively. To actually set the color, look at the crTextColor member in the CHARFORMAT structure.
http://www.ratebeer.com
|
|
|
|