|
Exactly what are you trying to accomplish here? For DirectShow the whole Mp3 file isn't loaded into the buffer when you try to play it. If you have some Mp3 data in your application and would like to play this without writing to disk you would probably have to write your own source filter.
|
|
|
|
|
Yes, that is exactly what I needed. I have a buffer in memory and I know for sure it is in Mp3 format. Then I want to play it without saving to disk. Can you tell me more about the filter? Thanks!
|
|
|
|
|
You can get the DirectShow wizard to generate the boilerplate code for a push source filter and start from there. http://tmhare.mvps.org/downloads.htm[^] There is also a Bouncing Ball source filter sample in the SDK. Aside from that you would probably need to ask a more specific question.
|
|
|
|
|
if you want to play mp3 you can use MCI functions
whitesky
|
|
|
|
|
I'm not sure mci functions can play a buffer in Mp3 format. Surely, MCI functions are the best approach to play Mp3 files. But in my case, I'm not sure they work. Anyway, thanks for your response.
Regards,
|
|
|
|
|
The control I wanted to use (CWGraph from National Instruments) doesn't let the Cdialog on which it is placed,show up when the dll is run. What other options do I have to display some rapidly varying data dynamically on a form within a dll? VC6
Thanks,
sb
|
|
|
|
|
I would like call a function as soon as a dialog is open and visible, but i cannot find a way of telling when this is so.
The dialog is a simple CDialog and is run by using DoModal.
I have tried OnInitDialog amongst a number of other overrides but they all seem to be called just before the dialog is displayed.
Any help would be greatly appreciated.
Thanks
|
|
|
|
|
|
How do you advise doing this, because when i use postmessage with a WM_COMMAND message, the dialog isn't displayed until the handling function has ended?
-- modified at 17:28 Thursday 8th June, 2006
|
|
|
|
|
WM_COMMAND messages are specific to dialog controls and similar.
As Michael said you should use WM_APP.
In code it would look something like this the following:
for the dialog header file, define a message ID...
#define UWM_DOMYFIRSTHING (WM_APP + 1) and add a message handler as a member function...
LRESULT OnDoMyFirstThing( WPARAM wParam, LPARAM lParam );
in the implementation file add your message to the message map...
BEGIN_MESSAGE_MAP(CMyDialogClass, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_CLOSE()
ON_MESSAGE( UWM_DOMYFIRSTTHING, OnDoMyFirstThing )
END_MESSAGE_MAP()
and add your message handler implementation...
LRESULT CMyDialogClass::OnDoMyFirstThing( WPARAM wParam, LPARAM lParam )
{
}
Don't forget to post the message from the bottom of OnInitDialog()...
PostMessage( UWM_DOMYFIRSTTHING );
It's important that you use PostMessage instead of SendMessage, otherwise the message handler will be called before OnInitDialog() returns and the dialog won't be visible yet.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
Regarding CodeProject: "resistance is pointless; you will be assimilated"
-- modified at 19:04 Thursday 8th June, 2006: added <code> tags
|
|
|
|
|
I have done everything you have said above, and it still calls the message handler before OnInitDialog() returns, so the dialog is not visible.
Have you tried this yourself to see if it works, am i making a silly mistake somewhere?
This is my code:
#define UWM_DELETEFILE (WM_APP + 1)
LRESULT OnDeleteFile(WPARAM wParam, LPARAM lParam);
BEGIN_MESSAGE_MAP(CStatusDlg, CDialog)
ON_MESSAGE(UWM_DELETEFILE, OnDeleteFile)
END_MESSAGE_MAP()
BOOL CStatusDlg::OnInitDialog()
{
CDialog::OnInitDialog();
PostMessage(UWM_DELETEFILE );
return TRUE;
}
LRESULT CStatusDlg::OnDeleteFile(WPARAM wParam, LPARAM lParam)
{
}
|
|
|
|
|
What both I and Michael Dunn suggested is a common technique used when something has to be done when all dialog controls has been created and initialized. I thought this was your problem since it's quite common.
The last message handled when a dialog is created is usually WM_PAINT. Both WM_SIZE and WM_SHOWWINDOW are sent prior to WM_PAINT.
If it's imperative that your dialog is visible to the user there is no message handler you can override. You have to write code inside the message handler for WM_PAINT, OnPaint().
Like this:
void CShowDlg::OnPaint()
{
static BOOL bShown = FALSE;
if (IsIconic())
{
CPaintDC dc(this);
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
if( !bShown )
{
bShown = TRUE;
}
}
Sorry that I misunderstood your needs. :->
I just haven't encountered a initialization situation yet that actually requires the dialog to be visible and I can't figure out why this would be necessary. It's not necessarily wrong, I'm just curious.
--
Roger
It's supposed to be hard, otherwise anybody could do it!
Regarding CodeProject: "resistance is pointless; you will be assimilated"
|
|
|
|
|
Hello, that's still not quite what i want, maybe i'm going about it all wrong.
The dialog box has a text box inside, and i would like this to display text strings about the status of the program to the user. The whole process needs to be launched by pressing a button, which launches the form, and only then once the form and controls are visible can the program's main function begin as otherwise any realtime messages to the controls won't be visible. I know i could probably do this more efficiently using another thread but i thought it would be much more complex and error prone.
Is there a better way of doing this?
Thanks a lot for all your help btw.
|
|
|
|
|
depends
functions you've overriddened?
Kuphryn
|
|
|
|
|
I haven't overridden anything, that's the problem, i don't know what to override that would work the way i want it to?
Any suggestions?
Thanks
-- modified at 17:28 Thursday 8th June, 2006
|
|
|
|
|
override various functions and add message handlers
not easy determining best point in this case
Kuphryn
|
|
|
|
|
sschilachi wrote: I would like call a function as soon as a dialog is open and visible, but i cannot find a way of telling when this is so.
iS WM_SHOWWINDOW or WM_SIZE message of any help
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I don't think my query(on C) is directly related to this board..however i post it here cos of urgency...
I wrote:
--------------------------
#include<stdio.h>
void fun(int** x)
{
printf("%d",**x);
}
int main(void)
{
int a[2][2]={1,2,3,4};
fun(a);
return 0;
}
--------------------------
to get '0' as output and not '1',i.e.the 1st element in the array.
I ran this on TC 2.01.
Help me if this is buggy.
Thanx!
|
|
|
|
|
ramamaru wrote: to get '0' as output and not '1',i.e.the 1st element in the array.
How are you expecting to get '0' as an output. The array has four elements, none of which are '0'.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
first your initializing the array incorrectly
it should be [int a[2][2] = {{1,2},{3,4}};]
??to get '0' as output and not '1' you set the first element to 1 so what
are you asking there.
|
|
|
|
|
ramamaru wrote: to get '0' as output and not '1',i.e.the 1st element in the array.
but there is no zero In Array Inisialization List!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
oh my God..i told that i got 0 as output...and not 1...Why? Thatz it
|
|
|
|
|
In case you still need help:
I recommend reading this article which answered all my questions
on arrays in the past. Statically- and dynamically-allocated arrays
are stored differently - keep this in mind and it will help you to find
the solution to your problem.
Good luck, Sebastian
-------------------------------------------
My website: http://www.hartwork.org
|
|
|
|
|
how do i create a control in win32 application avoiding m_pCtrlSite error.
thnx
Kanchana
|
|
|
|
|
I'm not sure.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|