|
No offense, but how about asking in the Nullsoft forums?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
IMediaControl :: GetState() errors in DirectShow???
------------------------------------------------
Hi All,
I want to use GetState() method of IMediaControl. But could not able declare its 2nd argument correctly. Here is my code:
HRESULT hr;
hr = pMC->Run();
if (hr == S_FALSE)
{
FILTER_STATE filterState; // or _FilterState filterState; ????????
hr = pMC->GetState(1000, (FILTER_STATE)filterState);
if (hr == S_OK)
{
...
}
}
It gives following error:
error C2664: 'GetState' : cannot convert parameter 2 from 'enum _FilterState' to 'long *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast.
If I declare a pointer "FILTER_STATE *filterState;", it gives this error:
error C2440: 'type cast' : cannot convert from 'enum _FilterState *' to 'enum _FilterState'.
There is no context in which this conversion is possible.
----------------- More queries --------------------------
1. Run() is returning "S_FALSE". What can be reasons of it? (RenderFile() is returning "VFW_S_AUDIO_NOT_RENDERED").
2. Value of HRESULT is long (262744 in returned by RenderFile()). How can I display its error string (i.e. VFW_S_AUDIO........)?
Thanx in advance.
Regards,
Saurabh
|
|
|
|
|
HRESULT GetState(
LONG msTimeout,
OAFilterState *pfs
);
Parameters
msTimeout
[in] Duration of the time-out, in milliseconds, or INFINITE to specify an infinite time-out.
pfs
[out] Pointer to a variable that receives a member of the FILTER_STATE enumeration.
you have to pass a POINTER as the second parameter...
please read the documentation more carefully before you are posting here!
|
|
|
|
|
This is my code:
<br />
void CUltraShareDlg::pasa_el_foco(CWnd* pWnd)<br />
{<br />
CPoint cursor;<br />
CPoint punto;<br />
CRect rectangulo;<br />
CPoint punto1;<br />
CPoint punto2;<br />
<br />
<br />
for (int i = 0; i < crear_ventana_servidores.m_servidores.GetItemCount(); i++)<br />
{<br />
GetCursorPos(&cursor);<br />
<br />
crear_ventana_servidores.m_servidores.GetSubItemRect( i, 2, LVIR_LABEL, rectangulo);<br />
<br />
if (PtInRect(rectangulo, cursor)!=0)<br />
{<br />
<br />
MessageBox("I did it !!");<br />
}<br />
<br />
}<br />
<br />
pWnd->SetFocus();<br />
<br />
}<br />
The PtInRect() function is never !=0, I don't know how to know if the point is into the rectangle, I'm having lots of problems because of this... please help me...
Thanks in advance.
MaestroProgramador.Com
I didn't fail hundred times, I found hundred ways that didn't work.
No fallé cien veces, encontré cien maneras de que no funcionara.
|
|
|
|
|
GetCursorPos() is screen coordination.
includeh10
|
|
|
|
|
Should I call ScreenToClient before calling PtInRect ?? Thanks in advance.
MaestroProgramador.Com
I didn't fail hundred times, I found hundred ways that didn't work.
No fallé cien veces, encontré cien maneras de que no funcionara.
|
|
|
|
|
Rafael Fernández López wrote:
//ScreenToClient(&cursor);
for (int i = 0; i < crear_ventana_servidores.m_servidores.GetItemCount(); i++)
{
GetCursorPos(&cursor);
Do this:
GetCursorPos(&cursor);
crear_ventana_servidores.m_servidores.ScreenToClient(&cursor);
for (int i = 0; i < crear_ventana_servidores.m_servidores.GetItemCount(); i++)
{
..
}
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Thank you very much, it worked.
Rafael Fernández López.
I didn't fail hundred times, I found hundred ways that didn't work.
No fallé cien veces, encontré cien maneras de que no funcionara.
|
|
|
|
|
I've created my main window as a modeless dialog box and I'm not sure if I've used the messages for exiting the dialog box correct, this is my dialog box procedure:
BOOL CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
switch(message)
{
case WM_INITDIALOG:
ShowWindow(hWnd, SW_SHOW);
return TRUE;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
break;
case WM_CLOSE:
DestroyWindow(hWnd);
return FALSE;
case WM_DESTROY:
PostQuitMessage(0);
return TRUE;
}
return FALSE;
}
Why I'm curious is because I'veseen some examples in MSDN that call DestroyWindow() in the WM_DESTROY message handler itselft. But that is when they've created a modeless child dialog box, I'm creating a modeless main dialog box.
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
PostQuitMessage(0) means to exit the app at the point.
if need "exit", it is correct, otherwise not.
includeh10
|
|
|
|
|
Hi,
I thourougly tested my class in debug mode and it worked great. I went on and made a release build and it failed. Well, I went further and started debugging the release mode through a program database. There are tons and tons of errors, but I'm starting at the start
I want to approach this from the beginning, perhaps that will improve my understanding of the change to release build as well (yes I've read the interesting artical "Surviving the release build").
Alright, here we go:
string strTest1;<br />
string strTest2;<br />
<br />
if (strTest1.BufferSize() != 64)<br />
MessageBox(NULL, _T("Error 1"), NULL, 0);<br />
if (strTest2.BufferSize() != 64)<br />
MessageBox(NULL, _T("Error 2"), NULL, 0);
The above code goes wrong already. What happens is that the first buffersize is wrong. If I just use one string and check the buffersize it is correct. Somehow the variable containing the buffersize is being changed, well lets take a look at the code behind it:
CString::CString(int nAlloc) : m_szBuffer(NULL), m_nBytes(0), m_nLen(0) { Alloc(nAlloc); }<br />
<br />
int CString::BufferSize() const throw() { return m_nBytes; }<br />
<br />
void CString::Alloc(int nSize) throw()<br />
{<br />
int nAlloc;<br />
<br />
if (nLen <= 64)<br />
nAlloc = 64;<br />
else if (nLen <= 128)<br />
nAlloc = 128;<br />
else if (nLen <= 256)<br />
nAlloc = 256;<br />
else if (nLen <= 512)<br />
nAlloc = 512;<br />
else<br />
nAlloc = ((nSize / 64) + 1) * 64;<br />
<br />
m_szBuffer = (LPTSTR)(operator new(m_nBytes = nAlloc));<br />
<br />
m_szBuffer[0] = '\0';<br />
}
Oh in case someone would like to know what its declared like:
namespace Weltevreden<br />
{<br />
class CString<br />
{<br />
public:<br />
CString(int nAlloc = 0) throw();<br />
<br />
private:<br />
int m_nBytes;<br />
<br />
void Alloc(int nSize) throw();<br />
};<br />
}
As you can see that is all that gets called. I have stepped through the entire alloc process and saw for myself that the m_nBytes variable got assigned to 64. Still somehow when I call BufferSize() the variable is different. How is this possible?
For your information, I've turned of all optimization settings I could find. I tried to have the settings as close to the debug settings as possible.
Thanks for your help, I hope answering this question will help me fight the rest of the bugs myself
Luuk
|
|
|
|
|
I was able to track the bug to the test project. When I created a branch new test project in which I run the same tests as in the other I get no errors at all. Yet my question remains how is it possible that a member variable gets corrupted this way?
|
|
|
|
|
hi,
how to check printer is switched on or not. any printer.
any one help to me.
thanks in advance.
Murali.M
There is always one more bug...........
|
|
|
|
|
Hi,
In MFC,I have created a dialog with ID,IDD_ADVANCED.
When i created class for this dialog and included the statement : enum { IDD = IDD_ADVANCED }.
When i compile i get errors as "
'IDD_ADVANCED': undeclared identifier
expected constant expression
Pls help what the problem is.
Thnks in advance
ram
|
|
|
|
|
check resource.h in included in ur class header file.
Murali.M
There is always one more bugs.......
|
|
|
|
|
My W-98 laptop crashed and required a full restore. After the restore I downloaded (from M/S) and installed MDAC 2.8, but when I attempt to establish an ODBC connection with the M/S Access driver, I get an error that a dll (odbctl.dll) won't load.
Any help greatly appreciated!
Dick
|
|
|
|
|
is this really a question for the Visual C++ forum?
Don't try it, just do it!
|
|
|
|
|
Hi all,
I get cursor position through this:
<br />
CRect my_rectangle;<br />
POINT my_point;<br />
<br />
mylistobject.GetSubItemRect( 1, 2, LVIR_LABEL, my_rectangle );<br />
GetCursorPos(&my_point);<br />
if ( my_rectangle.PtInRect(my_point)==TRUE )<br />
}<br />
MessageBox("I got it !!!");<br />
}<br />
I'm not able to get to the MessageBox function because something went wrong... I don't know how to know if a point from GetCursorPos is into a Rectangle.
Thanks in advance.
MaestroProgramador.Com
Researching today for the future.
Investigando hoy, para el futuro.
|
|
|
|
|
From memory GetCursorPos() returns the point in screen coordinates and GetSubItemRect() is in client coordinates, so you need to convert one to the other. See ScreenToClient() and ClientToScreen().
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Thank you so much... I didn't notice that point !!!!
MaestroProgramador.Com
I didn't fail hundred times, I found hundred ways that didn't work.
No fallé cien veces, encontré cien maneras de que no funcionara.
|
|
|
|
|
hi can someone tell me exactly what a shallow copy
does it or is it a refrence
is it good or bad to use
|
|
|
|
|
Say you have a structure that looks like this:
struct
{
int x ;
char* p ;
} ;
If you copy an instance of this structure, the int will copy fine since it is a simple data type but the char* pointer causes problems.
If you just copy the value of p over (a shallow copy), you will have two instances of your structure that have a pointer to the same string. This causes problems when cleaning up - who has responsibility for free'ing the string? You don't want to do it twice.
A deep copy does an intelligent copy - it will make copies of the structure's data members where necessary. In this case, it will allocate a new block of memory and copy the string data over.
"Sucks less" isn't progress - Kent Beck [^]
Awasu 1.1.3 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
bhangie wrote:
what a shallow copy does
The copy is shallow when only the pointer is copied:
void ShallowCopy(int* a)
{
int* b;
b = a;
}
The copy is deep when the value at which the pointer points is copied:
void DeepCopy(int* a)
{
int* b;
*b = *a;
}
bhangie wrote:
is it good or bad to use
Depends on the situation. If a shallow copy is deleted, the original pointer no longer points to the expected data, which of course can be disasterous.
That's one reason to implement copy constructors in C++, to ensure member pointers are copied correctly.
--
Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. (Douglas Adams)
|
|
|
|
|
Hello All,
I am new to this Forum and need some details. I plan to Study C++ , can anyone suggest a good book to get a good working Knowledge of teh Language.
I am Studying in a College, and staying in a Hostel, so my resources are limited, I can access a Computer terminal 24 Hrs, but won't have access to Visual C++, Can anyone suggest the next best alternative, that is free for Download and can help me in my Objective ????
I know that this section might not be the best place to ask this query, But i need advice immediately. I'd be grateful if anyone can pass on any info regarding this. Looking forward to hearing from you all.
Regards,
Ajit
|
|
|
|
|