|
Did you coded for this,
May be WS_EX_TRANSPARENT style set to the window.
May be WM_ERASEBKGND and / or WM_PAINT handled but not doing anything or not passing to default window procedure.
|
|
|
|
|
Hi all,
I have created a Directshow filter for video playback. It runs fine in GraphEdit or by double clicking the video file but when I select the thumbnail view for the video file in explorer, explorer crashes giving the ASSERT error
Executable: explorer.exe Pid 328 Tid fc8. Module myFilter.ax, 5 objects left active! At line 317 of C:\DXSDK\Samples\C++\DirectShow\BaseClasses\dllentry.cpp
Continue? (Cancel to debug)
Can anybody suggest how this bug can be removed?
Thanks in Advance.
Regards,
Tahir
|
|
|
|
|
Did you try to use your debugger ?
|
|
|
|
|
mTahir wrote: explorer.exe Pid 328 Tid fc8. Module myFilter.ax, 5 objects left active! At line 317 of
It occurs if you acquired any interface and not releasing it, when the filter is about to destruct. The interface acquired in your filter may be other filters which might acquired other interfaces and your assert message shows 5 interfaces not released.
I think you must be able to get this error in graphedit also, stress test for different scenarios, like pause the graph and close the graphedit, insert and remove filters, close graphedit while running graph. The thumbnail might be in different state which you never tried in graphedit.
log the reference count of the interfaces while you acquire and release and check whether it matches. for all your pins and filters override the
"STDMETHODIMP_(ULONG) NonDelegatingAddRef();"
"STDMETHODIMP_(ULONG) NonDelegatingRelease();" so that you can log easily.
|
|
|
|
|
Raj thanks for your reply.
I will look into it. I will try 'log the reference count ' thing and will come back with the results soon.
Regards,
|
|
|
|
|
Below is the code snippet I wrote for displaying pixel values onto the screen in MFC. The pixel values are stored in buffer disp_frame. But nothing appears on screen. Could anyone debug this code.
void CBluetooth_decoderDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
int p=0,i=0,j=0,q=0;
// extern int disp_frame[50][144][176];
///////////////////////
BITMAPINFOHEADER bmi;
BITMAPINFO bm;
RGBQUAD rgbarray[256];
bmi.biSize = sizeof(BITMAPINFOHEADER);
bmi.biWidth = 176;
bmi.biHeight = 144;
bmi.biPlanes = 1;
bmi.biBitCount = 8;
bmi.biCompression = BI_RGB;
bmi.biSizeImage = 0;
bmi.biXPelsPerMeter = 0;
bmi.biYPelsPerMeter = 0;
bmi.biClrUsed = 0;
bmi.biClrImportant = 0;
bm.bmiHeader = bmi;
for (int color_index = 0; color_index < 256; color_index++)
{
rgbarray[color_index].rgbBlue = i;
rgbarray[color_index].rgbGreen = i;
rgbarray[color_index].rgbRed = i;
rgbarray[color_index].rgbReserved = 0;
}
bm.bmiColors[1] = rgbarray[0];
/////////////////////
CRect rcClient;
GetClientRect(rcClient); // See Note 1
rcClient.right=176;
rcClient.bottom=144;
CDC MemDC,*pDC;
CBitmap MemBitmap,*drawmem;
pDC = this->GetDC(); // Get Current DC
MemDC.CreateCompatibleDC(pDC);
CreateDIBSection(MemDC,bm,DIB_RGB_COLORS,disp_frame,NULL,0);
CBitmap *pOldBitmap =MemDC.SelectObject(&MemBitmap);
pDC->BitBlt(150,100,176,144,&MemDC,0,0,SRCCOPY);
MemDC.SelectObject(pOldBitmap);
ReleaseDC(pDC);
}
|
|
|
|
|
Have a look at CreateDIBSection documentation [^]. It states the 5th parameter (a pointer to a pointer) is an [out] one. It means you have to pass the address of a pointer and, on return, that pointer will contain the address of the allocated DIB section buffer, then you have to change the bit values of such buffer, according to disp_frame values, before selecting it into device context.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
rtant = 0;
bm.bmiHeader = bmi;
for (int color_index = 0; color_index < 256; color_index++)
{
rgbarray[color_index].rgbBlue = i;
rgbarray[color_index].rgbGreen = i;
rgbarray[color_index].rgbRed = i;
rgbarray[color_index].rgbReserved = 0;
}
bm.bmiColors[1] = rgbarray[0];
/////////////////////
CRect rcClient;
GetClientRect(rcClient); // See Note 1
rcClient.right=176;
rcClient.bottom=144;
CDC MemDC,*pDC;
CBitmap MemBitmap,*drawmem;
pDC = this->GetDC(); // Get Current DC
MemDC.CreateCompatibleDC(pDC);
CreateDIBSection(MemDC,bm,DIB_RGB_COLORS,disp_frame,NULL,0);
CBitmap *pOldBitmap =MemDC.SelectObject(&MemBitmap);
pDC->BitBlt(150,100,176,144,&MemDC,0,0,SRCCOPY);
MemDC.SelectObject(pOldBitmap);
ReleaseDC(pDC);
}
This was the piece of code which was posted previously. But the CreateDIBSection code
CreateDIBSection(MemDC,bm,DIB_RGB_COLORS,disp_frame,NULL,0); was having MemDC is a CDC type. But actually it should be HDC type. So I have rewritten the code as
HDC hDC;
hDC = CreateDC("DISPLAY",NULL,NULL,NULL);
HDC memDC = CreateCompatibleDC(hDC);
CreateDIBSection(hDC,bitmap,DIB_PAL_COLORS,ppbits,NULL,0);
HBITMAP memBM = CreateCompatibleBitmap(hDC,176,144);
SelectObject(memDC,memBM);
BitBlt(memDC,150,100,176,144,hDC,0,0,SRCCOPY);
But CreateDIBSection is creating exception. What could be the reason. Basically I could not get the difference between CDC and HDC. Could anyone give a clear solution to my problem. I am actually trying to display a grayscale image which exists as R=G=B values in memory.
|
|
|
|
|
Please surround code snippets with <pre> tags.
(1) What error message are you receiving?
(2) how did you define ppbits ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
The error message was Unhandled exception in decoder.exe(GDI32.dll): 0xc0000005 : Access Violation
the declaration for ppbits was void **ppbits.
Once this CreateDIBSection works i thought of filling ppbits with pixel values. That's why that particular piece of code is not available
|
|
|
|
|
jossion wrote: the declaration for ppbits was void **ppbits
The above is wrong.
You have to declare a pointer to void, for instance
void * pbits;
and then pass the address of the pointer (i.e. &pbits ) to CreateDIBSection :
CreateDIBSection(hDC,bitmap,DIB_PAL_COLORS, &pbits, NULL,0);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hello evry body, how is it possible to flash the icon of a certain frame window, in order to capture the attention of the user and see the asynchrounous event that happened and which relates to the frame whose icon is highlighted ?
Thank you in advance.
|
|
|
|
|
See FlashWindow()[^]
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Thank you thank you very much !
|
|
|
|
|
You're welcome.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I'd like to search the active window's client area for a given string and highlight it.
I've done this in VB using SelStart and SelLength.
I'm sure I've seen the same functionality available from a conventional Windows program, but can't remember what the win32 API calls are.
Does anyone know, or have tips on how to find out?
Thanks for the assist.
glyfyx
|
|
|
|
|
There is EM_SETSEL message though it works with edit boxes (or EM_EXSETSEL , with Rich Edit controls). AFAIK VB6 itself allows SelStart and SelLength only inside controls (i.e. they are TextBox methods).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Just a word of thanks - appreciated!
glyfyx
|
|
|
|
|
If this is a Win32 application without using MFC, create window as a child of the main window; use "edit" window class. You may want to subclass edit window but it is not necessary.
Use EM_* messages to tell edit window what to do. See MSDN for more information. EM_ messages are defined in WINUSER.H. Handle notification messages from control in a parent window, to see what control is doing. Notification code are also defined in WINUSER.H and are delivered as parameter of WM_COMMAND message.
For MFC application use CEdit class and call SetSel member function. Again, see MSDN for members reference. You can add notification handlers in a parent of edit control using Wizard.
JohnCz
MS C++ MVP
|
|
|
|
|
Thanks for taking time to provide such a complete answer - much appreciated!
glyfyx
|
|
|
|
|
You are very welcome. Glad to be of help.
JohnCz
MS C++ MVP
|
|
|
|
|
Hi
I want to insert the picture in the picture control in VC++ 6......
tell me how to do it
AbidBhat
|
|
|
|
|
Steps:
1) Add a .bmp image into resources,
2) Add a Picture Control onto the dialog template with the dialog editor,
3) Assign the resource ID of the image to the property of the Picture Control.
Maxwell Chen
|
|
|
|
|
|
If you want to insert bmp you can use of resource of program or for other foramts like jpg you can use of CImage class or GDI+.
|
|
|
|
|