|
godspeed123 wrote: Is it possible to set the buffer size and stuff after we have started the directshow graph
See Dynamic Format Changes in DirectShow[^]
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I have got a list view control with the LVS_ICON style. The icons that I use are 64px by 64px. They work fine and are displayed correctly, however, if one of the items is selected, then a blue semi-transparent selection rectangle covers the image. How would I get rid of this, or make it so that the blue selection rectangle only covers the white area of the icon image?
I'm writing in plain C/C++, so no MFC
Thanks for your help!
--PerspX
|
|
|
|
|
if you set the LVS_EX_BORDERSELECT extended style, you can make only the border of the items highlighted instead of the whole item during seelction.
nave
|
|
|
|
|
I create a SDI appication and split the main frame to rows and columns using CreatStatic()and CreateView() for each of the splitter frame. It works fine. In One of the pane frame, I display the graphic rectangle and text using FillSolidRect(), and DrawText(), and these rectangles and text need to redraw every time to update system status. To do that, I call InvalidateRect(NULL,FALSE) in OnDraw() to redraw this window frame. It is working fine also. But some how by calling InvalidateRect(NULL,FALSE) all of my modal dialogs in my application doesn't work any longer causing my application to hang ( no response from any buttons in toolsbar). If I commented InvalidateRect(NULL,FALSE) all of my modal dialogs work but then the graphic rectangles and text no longer redraw and update. Help!!!!
|
|
|
|
|
As before i have problem when i try to exam a string that i had took it from a file
The problem (via debug) i detected it was that it doesnt get the last letter of this string
the LineRead (buffer) is correct contains all the letters but when i do LineRead.GetAt(LineRead.GetLength() - 1) it return me nothing
As a result when i create .exe and run it throw me windows error (and when i try to detect the problem ) it throw me an exception
my workspace[^]
input text file[^](you select it via Select bottun)
|
|
|
|
|
Immunity18 wrote: the LineRead (buffer) is correct contains all the letters...
How are you verifying this?
For future reference, you do not need to include PCH, NCB, TXT, OPT, APS, CLW, or PLG files when archiving a project. Those files, as well as the Debug and Release folders, get rebuilt.
"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
|
|
|
|
|
By the way you teach me DEbug and see the values on each variable
|
|
|
|
|
Ok, then can you show a relevant code snippet?
"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
|
|
|
|
|
void CBayesDlg::OnCalc()
{
int nStart;
UpdateData(TRUE);
nStart = 1;
if (nStart ==1)
{
ReadFileII();
}
UpdateData(TRUE);
}
void CBayesDlg::ReadFileII()
{
double rn = 0;
double ry = 0;
CString FilePathName;
CString LineRead ;
const int sz =100;
char buf[sz];
int rCount = 0;
CString str;
FilePathName = m_FilePath;
ifstream FileText(FilePathName);
while(FileText.get(buf,sz))
{
FileText.get();
LineRead = (LPCSTR) buf;
Compare ( LineRead,rCount);
rCount = rCount +1;
}
int a=0,b=0,c=0,d=0,e=0,n=0,y = 0;
for (int i = 0 ; i < (rCount) ; i++)
{
if ( m_Array[i][5]== "N" || m_Array[i][5] =="n")
{
n = n +1;
if ( m_Array[i][0] == m_A)
{
a = a+1;
}
else if ( m_Array[i][1] == m_B)
{
b = b+1;
}
else if (m_Array[i][2] == m_C)
{
c = c +1;
}
else if (m_Array[i][3] == m_D)
{
d = d +1;
}
else if (m_Array[i][4] ==m_E)
{
e = e +1;
}
}
}
if ( rCount && n != 0 )
{
rn = (double) (n/rCount)*(a/n)*(b/n)*(c/n)*(d/n)*(e/n);
}
else
{
rn = 0;
}
if ( rn > ry)
{
m_R = "NO";
}
else if (ry > rn)
{
m_R = "YES";
}
FileText.close;
}
void CBayesDlg::Compare(CString line, int y)
{
int v = 0;
CString word;
CString tab = "\t";
int x = line.GetLength();
for (int i = 0 ; i < x ; i ++ )
{
if ( i==0)
{
word = line.GetAt(i);
}
else if ( i>0 )
{
if ( line.GetAt(i) != tab)
{
word = word + line.GetAt(i);
}
else if (line.GetAt(i) == tab)
{
m_Array[y][v] = word;
word.Empty();
v = v +1;
}
}
else if (i == (x -1))
{
m_Array[y][5] = line.GetAt(i);
}
}
}
-- modified at 8:56 Wednesday 30th May, 2007
|
|
|
|
|
What exactly is your project doing with the text file? I'd like to step through your code, but I need to know what to expect for that to do any good.
"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
|
|
|
|
|
omg i think i found it :/
i have inside for 3 if
if (i ==0)
{}
if (i>0)
{}
if( i== (x-1))
{}
x-1 >0 so i had to put the 3rd if inside 2nd
i correct it and now my program works
1 whole week trying to fingure out. So i will have to watch about that false in the other 2 project
I think that's the problem I hope you agree with me David or i have to dive deeper !
|
|
|
|
|
Immunity18 wrote: I hope you agree with me David or i have to dive deeper !
I wouldn't know without stepping through it myself. After looking at your code, however, I did find several places that need attention.
"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
|
|
|
|
|
could you printscreen and mark them on paint ? and give me a link so i could look on that ?
|
|
|
|
|
hm and something else
when i debug how i move the for () loop?
i mean it so me variables for i = 0 how i make it to move and show me the variables for i = 1?
|
|
|
|
|
Immunity18 wrote: i mean it so me variables for i = 0 how i make it to move and show me the variables for i = 1?
F10 = step over
F11 = step into
Shift+F11 = step out
Ctrl+F10 = run to cursor
"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
|
|
|
|
|
thanks
|
|
|
|
|
I wonder, how do I change the name of my main dialog window when my MFC program is running? (from the program itself)
I'm working on a Dialog based MFC application in vc6.0)
thanks!
//Johannes
|
|
|
|
|
Hi
You can use SetWindowText("New Title");
Regards
The Best Religion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Thanks Zainu!
That works perfectly!
//Johannes
|
|
|
|
|
Hi,
I am using the CPushSource Filter as a step to get my filter working, I have the Pushsource working nicely.
I have a camera that requires a callback in which it sends all the images to, I simply want to take this data and transfer it to the filter but I want to do it using a callback or any other method that is efficient.
Is there any way of doing this?
Thanks in advance
|
|
|
|
|
You should be able to add a callback function to your filter module just like you would anywhere
else.
If you aren't connecting to the camera within the filter, then you can add a method to your
filter class which returns the address of the callback. Once you obtain an interface to
the filter (when creating the graph) you can use that interface instance to call the
method.
I hope that make sense,
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi Mark,
Thanks for the response, so when I get the callback in the filter, how does one trigger the FillBuffer routine that talks to the output pin, is there anyway to redirect the callback data to it?
|
|
|
|
|
The source pin is derived from CSourceStream so it has its own thread that is looping calling
FillBuffer().
The easiest solution based on the code you have would be to keep a copy of the current frame from
the camera (given to the filter through the callback) and every time your FillBuffer override
is called, copy the newest frame into the passed sample buffer and set the sample time.
The only real problem with this solution is 2 threads doing the job of one - a bit innefficient
especially with resources for the extra thread. The plus side to this solution is it's easiest
to code.
A more robust solution would be to do something closer to a capture filter. Using the existing
CSource/CSourceStream classes it's relatively easy to override a few methods to not use the
CAMThread base of CSourceStream. The CSourceStream::Active/CSourceStream::Inactive overrides
are where the thread creation/destruction occurs. CSourceStream::ThreadProc and
CSourceStream::DoBufferProcessingLoop are the methods relevant to the FillBuffer call so there
you'll find the necessary calls for obtaining/releasing sample buffers and making the delivery
calls. Those you'd want to do in your callback.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi Mark,
Thanks for the response, so if I understood you correct, in my callback I do the following:
void callback(.... ) {
InActivate();
//copy the byte array to the proper pData
DoBufferProcessingLoop();
Activate();
}
Did I get that right?
|
|
|
|
|
DoBufferProcessingLoop() is already running so you definitely don't want to call it. It is
called by the threadproc, so it is running on the sample-push thread.
I was speaking of overriding Active() and Inactive(), and in the overrides, don't create the
thread at all. Then, in your callback, do the processing that DoBufferProcessingLoop() does
on each iteration of its loop - get a sample buffer from the allocator, fill the sample with
data, set the sample's time, and send it on downstream.
So, instead of using CSourceStream for your pin class, derive a class from CSourceStream and do
the overrides. Then you're essentially using the benifits of CSourceStream without the built-in
thread (CSourceStream is derived from CAMThread).
Take a look at the source code for CSourceStream in the DirectShow base classes and you'll see
what I'm referring to (I think it's source.cpp/.h).
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|