|
Great Rajkumar,
You mentioned before,
--------------------
1. with _vfptr in that context i mean only one for Base * and Final * type for the instance of Final.
--------------------
You mean if foo in Base and Final are both virtual, and if we create an instance of Final and make a Final pointer points to the instance, and also make a Base pointer points to the same instance, then pointer of type Base and pointer of type Final points to the same vtable, right?
regards,
George
|
|
|
|
|
|
Thanks Rajkumar,
My question is answered.
regards,
George
|
|
|
|
|
Hi,
I m trying to load a bitmap image(jpeg/gif) in OnPaint()..
But there s a loss of color identified(already posted qn..)
got an idea to embedd a HTML snippet into my code with ..
How to do it in a proper way??
thanks in advance..
Gita
|
|
|
|
|
Gita.Bairavi wrote: load a bitmap image(jpeg/gif) in OnPaint
try using CImage
Gita.Bairavi wrote: an idea to embedd a HTML snippet into my code with ..
to display html page and thus by showing image, u need to host html browser control, in MFC helper classes like CHtmlView, CDHtmlDialog is available
|
|
|
|
|
Did you try with CImage class it has functions that you need? and for html you can use of CDhtmlDailog.
|
|
|
|
|
Hi all.
I'm having this problem and really not getting, what is happening behind the hood. Plzz help me out in this regard.
This is basic C concept.
void main ()
{
int i = 0;
++++i;
i++++;
}
In the above code, ++++i (Pre-Increment) works but i++++ (Post-Increment) doesn't work. What could be the reason?
Plzz explain in detail.
Any Help is appreciated.
|
|
|
|
|
Because left to righ operator associativity.
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
|
|
|
|
|
Click here[^]
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Don Box wrote: i++++; //DOESN'T WORK
The second pair of "++" needs an l-value to operator on, which "i++" is not.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
#include<iostream>
int main()
{
int i = 0;
while(i<5)
{
std::cout << i;
i++;
}
/*
while(i<5)
{
std::cout << i;
++i;
}
*/
std::cout << std::endl;
std::cin >> i;
return 0;
}
|
|
|
|
|
Hi all
how can we select the desired sound card through directshow?
I have installed two soundcards on my PC and I want to play the audio file on one of them.
I can able to play the file on the default card like this
<br />
WCHAR wFileName[MAX_PATH];<br />
MultiByteToWideChar(CP_ACP, 0, m_szFileName, -1, wFileName,MAX_PATH);<br />
hr = m_pGraph->RenderFile((LPCWSTR)wFileName, NULL);<br />
<br />
if(FAILED(hr))<br />
return FALSE;<br />
<br />
<br />
hr = m_pControl->Run();<br />
<br />
if(FAILED(hr))<br />
return;<br />
<br />
<br />
RenderFile can play the sound on the default soundcard. I want to enumerate the devices and then select the device of my own and then play the audio.
I would have enumerated if i could know that what CLSID argument should be passed into CreateClassEnumerator because i need devices when i pass CLSID_AudioRendererCategory it gives me 6 audio renderer values
how can i configure it to 2 sound devices rather than renderers
Can anybody help me, please ?
Jabeen
|
|
|
|
|
~Jabeen~ wrote: when i pass CLSID_AudioRendererCategory it gives me 6 audio renderer values
this is because there r 2 filter instances (DirectSound And Waveout) for each audio device (
Device 1 (WaveOut, DirectSound) +
Device 2 (WaveOut, DirectSound) +
default (selected Device (Device 1/2)) (waveout, DirectSound)
= 6
)
to select a particular renderer u may need to compare the friendly names of the enumerated monikers through BindToStorage() and create the filter instance using IMoniker::BindToObject(),
the friendly names are of the format
"The DirectSound instance has the friendly name "DirectSound: DeviceName," where DeviceName is the name of the device. The WaveOut instance has the friendly name DeviceName."
~Jabeen~ wrote: how can i configure it to 2 sound devices rather than renderers
above details gives the idea for doing in directshow.
|
|
|
|
|
when you render the desired file to the sound card you must add the
sound card filter to the graph then RenderFile() method automatically
connect to that particular sound card , other wise it will connect to the
default sound card
Rajesh
|
|
|
|
|
rajeshgupta1253 wrote: you must add the
sound card filter
how to do this is the question
|
|
|
|
|
repost as previous not displayed correctly
~Jabeen~ wrote: when i pass CLSID_AudioRendererCategory it gives me 6 audio renderer values
this is because there r 2 filter instances (DirectSound And Waveout) for each audio device (
Device 1 (WaveOut, DirectSound) +
Device 2 (WaveOut, DirectSound) +
default (selected Device (Device 1/2)) (waveout, DirectSound)
= 6
)
to select a particular renderer u may need to compare the friendly names of the enumerated monikers through BindToStorage() and create the filter instance using IMoniker::BindToObject(),
the friendly names are of the format
"The DirectSound instance has the friendly name "DirectSound: DeviceName,"
where DeviceName is the name of the device.
The WaveOut instance has the friendly name DeviceName."
~Jabeen~ wrote: how can i configure it to 2 sound devices rather than renderers
above details gives the idea for doing in directshow.
or check for DRVM_MAPPER_PREFERRED_SET in waveOutMessage
|
|
|
|
|
How do I convert CString to DWORD or CString to COLORREF?
For example: CString color = "0xFF00FF"
Thanks!
|
|
|
|
|
|
use strtol [^], for instance
char * p;
TCHAR * p;
CString sz=_T("0xFF00FF");
DWORD dw = _tcstol(sz,&p, 16);
COLORREF cr =_tcstol(sz,&p, 16);
Be aware that COLORREF value maybe set in way you don't expect, for instance
COLORREF cr1 =_tcstol(_T("0x1F00FF"),&p, 16);
COLORREF cr2 = RGB(0x1F, 0x00, 0xFF);
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
modified on Monday, February 11, 2008 3:46 AM
|
|
|
|
|
Instead of using char * p;
I used wchar_t *p;
Thank you so much for the help!
|
|
|
|
|
You're right, the proper one is
TCHAR * p;
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
|
|
|
|
|
Hi all,
I'm using the UltimateGrid attached to a view. The view has from previous work already the LButton-Down-Event handled. The handling involves the Document of my MFC application. The integrated Grid doesn't know about the document. Therefore the OnLClicked-Function is supposed to call the appropriate function of the view. I'm doing it using the following code:
---
CWnd* pParent = GetParent();
ASSERT(pParent);
NMHDR nmhdr;
nmhdr.code=NM_CLICK;
nmhdr.hwndFrom=m_hWnd;
nmhdr.idFrom=GetDlgCtrlID();
pParent->SendMessage(WM_NOTIFY, 0, (LPARAM)&nmhdr);
---
Catching the Event in the view's message map using ON_NOTIFY(NM_CLICK, 1234, OnLButtonDown)
Works in DEBUG Mode, crashes in Release Mode with an "privileged instruction"-exception.
Does anyone has an idea?
I very appreciate any help, Anna
|
|
|
|
|
Make sure you the signature of your handling function correct. Do a search for ON_NOTIFY, and you get:
afx_msg void memberFxn( NMHDR * pNotifyStruct, LRESULT * result );
Similarly, OnLButtonDown is a TERRIBLE name. It matches up with the handler for ON_WM_LBUTTONDOWN.
Because the ON_XXXX macro casts the 3rd parameter, it won't tell you you're using the wrong function signature, and you'll just crash. As debug mode has lots of NOPs about, the chances of crashing are much lower.
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
Hi Iain,
thanks a lot. I've seen this, but didn't quite understand. I thought I could go an easy way and use the original OnLButtonDown function. I can see now that is horrible nonsense. I created my own
afx_msg void OnLButtonDownFromGrid( NMHDR * pNotifyStruct, LRESULT * result ), implemented all the stuff from the old OnLButtonDown and IT WORKS!
Thanks again,
Anna
|
|
|
|
|
I created a very simple class (CLogFile) to enable me to trace events within my applications (It writes diagnostic messages to a hard disk file during exceution of the app) Admittedly, I have generally used this in the past with Dialog-based apps, but now I have included it in a Doc/View MDI app and have a peculiar problem.
I should explain that my CLogFile class is instantiated in the InitInstance function of the app, and a global pointer created pointing to the CLogFile object. In functions that I want to trace, I simply dereference the global pointer and thereby call the Add(CString szMsg) public member function to add the string to the file.
This all works fine in all locations in which I have used it to date, but, currently having a problem in OnDraw(), I tried using it there and got a 0xC0000005 access exception but (and this is the interesting bit) on the SECOND time through !! I get the same problem in OnPrepareDC(). I have now generated an vanilla (i.e. as initially produced by AppWizard) doc/view app and added the LogFile class, and get the same problem. It appears that the exception is being generated because the member variables in the CLogFile object have been corrupted. In an attempt to find the source of the corruption, I opened a memory window and displayed the area where the class members are located. The data is correct after exiting AfxWndProc() and then it enters (windows) assembler code. Still tracing, I get to a call where it won't step through to the target. Locating the target address, I find that the location is "mid-instruction". I have no doubt that this is then leading to the access exception. Can anybody give me a clue on how this corruption might be occuring ? I just can't understand why it works perfectly well in (supposedly) ALL other areas of the code, and yet fails in this way in these two functions. Any help/explanation would be greatly appreciated !
Doug
|
|
|
|