|
With a help of VxD or Kernel Mode Device Driver, you can monitor any messages for debug output. Grab exellent utility at;
http://www.sysinternals.com/ntw2k/freeware/debugview.shtml
Utility looks like single binary but they embedded device drivers for Win9x and NT/Win2k. (They are kind of an alien, not human.)
reiko
|
|
|
|
|
As the other comments stated, you probably want to do it using by debug events.
But since it's in the same app, just blast a new address into the jump table for OutputDebugString (it's in the IMPORT section of your PE (at runtime). If you also wan't to "steal" GetProcAddress() usage you'll have to patch the first few bytes of OutputDebugString() to be a "jmp X", where X is the address of your (stdcall!) replacement function. Either way, you would have to know some IA32 assembly to know what's going on.
|
|
|
|
|
Hello, I'm new to dealing with graphical user interfaces and currently I am working on a program that would need to display an acquired image onto the screen. The image is an array of unsigned char buffer containing the RGB values. Would anyone know how I may display it effeciently in my view? Currently, I am doing a nested for loop inside OnDraw() and I don't believe this is the correct way.
Don't laugh , but here's what I've got--
BYTE R, G, B;
for (unsigned long y=0; y "less than" imageHeight; y++)
{
for (unsigned long x=0; x "less than" imageWidth; x++)
{
R = imageBuffer[(y*imageWidth*3)+(x*3)];
G = imageBuffer[(y*imageWidth*3)+(x*3)+1];
B = imageBuffer[(y*imageWidth*3)+(x*3)+2];
cDC->SetPixel(x, y, RGB(R,G,B));
}
}
Thanks in advance!
Jerry
|
|
|
|
|
the quickest way to do this is to create a DIB from your RGB buffer.
a DIB is a rather complex data structure that holds a Device Independent Bitmap.
but, to make a 24-bit DIB out of an RGB buffer you need to do the following:
1. allocate enough memory for the DIB. this is a BITMAPINFOHEADER plus the pixels. pixels in a 24-bit DIB are 3 bytes per pixel with 1-3 bytes at the end of each row so that the number of bytes in a row is multiple of 4.
2. fill in the member of the BITMAPINFOHEADER struct
3. copy the RGB pixels into the DIB so that the DIB is vertically flipped compared to the RGB buffer and R and B are swapped.
4. call StretchDIBits.
if you want a working sample of all this, see JpegFile. this is a JPG read/write class that deals with RGB images (from/to JPG) and DIBs (for display).
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
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 )
|
|
|
|