|
I have a program that plays multiple WAVS at the same time. What I cant figure out how to do is adjust the volume levels and panning for each individual WAV during playback. The only info Ive found is about changing the master WAV device volume. Can someone shed some light on how I can change the volumes and pans of individual WAV files (all of which are playing through the main WAV device output)?
Thanks!
Emil
|
|
|
|
|
I think you should look into using the directxsound stuff.. sounds like your limited without it. No pun intended!
Lata
|
|
|
|
|
I have a dialog that maintains a color swatch that is set/modified through MFC's CColorDialog.
It works ok, but when I want to initialize the color swatch in the OnInitDialog(), my color swatch is just the default (black) color I assigned during creation.
Also, when I pop-up the CColorDialog or move anything over my parent dialog, the color-swatch color is lost (resorts back to default black color).
How do I repaint the color swatch in OnInitDialog() and how do I keep my color swatch from loosing its color when other windows move over (repaint) the are it occupies?
Thank you much!
Johnny
Here are some details:
The color swatch is a picture control, Rect property, with IDC_MODEL_COLOR as its name.
I use this fn to update the swatch when CColorDialog returns (IDOK)
// update the color swatch with the RGB color value
void CGraphicsParameters::SetModelColorSwatch(COLORREF rgbColor)
{
CBrush swatch;
swatch.CreateSolidBrush(rgbColor);
CClientDC dc(this);
dc.FillRect(&m_ModelColorSwatch, &swatch);
}
I also call this fn from within OnInitDialog() -- that's when I noticed the problem.
Please help.
Thank you
|
|
|
|
|
You should be painting the colour swatch in OnPaint.
"Pretending to guide me, you led me astray,
And I don't want to fall into your kind of ways." "Melt", Front 242
|
|
|
|
|
Hi Daniel,
I modified my dialog's code to trap the WM_PAINT messages in OnPaint(), but I am still having problems initializing my dialog and the strange case when I do this to my MODELESS dialog:
1) place another window (dialog) object over my Color Swatch client area
keeping it over my Color Swatch
2) Set focus to my dialog with the Color Swatch -- don't move
3) Without moving either dialogs, toggle focus between the two
** the color swatch resorts back to the default (black) color.
Would you know what is going on and what I need to do?
Thanks.
Johnny
Here is what I have now:
//////////////////////////////////////////////////////
// CGraphicsParameters dialog -- .H
class CGraphicsParameters : public CDialog
{
// Other stuff left out for brevety
private:
// use to display colors as a sample swatch on the dialog
COLORREF m_ModelColor;
CRect m_ModelColorSwatch;
// Construction
public:
// use to display colors as a sample swatch on the dialog
void SetModelColorSwatch(COLORREF rgbColor);
}
//////////////////////////////////////////////////////
// CGraphicsParameters dialog -- .CPP
BOOL CGraphicsParameters::OnInitDialog()
{
CDialog::OnInitDialog();
// other dialog initialization goes here
// Initialize the color swatch rectangles - for later painting
// Calculate true location of the color swatch
// Get a pointer to CWnd
CWnd* pModelColor = GetDlgItem(IDC_MODEL_COLOR);
// Find its location on screen
pModelColor->GetWindowRect(&m_ModelColorSwatch);
// Store client coordinates
ScreenToClient(&m_ModelColorSwatch);
m_ModelColorSwatch.DeflateRect(2, 2, 1, 1); // for the sunken control setting
SetModelColorSwatch(m_ModelColor);
return TRUE;
}
void CGraphicsParameters::OnPaint()
{
SetModelColorSwatch(m_ModelColor);
CDialog::OnPaint();
}
// update the color swatch with the RGB color value
void CGraphicsParameters::SetModelColorSwatch(COLORREF rgbColor)
{
CBrush swatch;
swatch.CreateSolidBrush(rgbColor);
CClientDC dc(this);
dc.FillRect(&m_ModelColorSwatch, &swatch);
}
|
|
|
|
|
I did a quick test using the same code as you have here and it worked, so I suggest looking to see if m_ModelColor is set to black somewhere.
"Pretending to guide me, you led me astray,
And I don't want to fall into your kind of ways." "Melt", Front 242
|
|
|
|
|
Hi!
I have a VC++ application which works by itself. I need to convert it into a DLL so that i can call it from VB. I created a new win32 dll and added the source files and the header files to the project. THe application consists of many classes and has a main funciton as starting point. I used the _stdcall calling convention before the main function and declared the function prototype in a header file. The dll compiled without any errors.But when i try to call the dll form VB the runtime error 453 The function not found in the specified dll file pops up
I am a beginner in the VC++ and have very little knowledge of the language.
can u please suggest any solution to the above problem
Thanx
|
|
|
|
|
What you really wan't to do is to convert it into a Active-X control, trust me.
"You can stand all night at a redlight anywhere in town, hailing Marys left and right but none of them slow down. I've seen the best of men go past. I don't wanna be the last..."
|
|
|
|
|
Did you export your function by typing
extern "C" __declspec(dllexport) MyExportedFunction( );
?
|
|
|
|
|
I have used the _stdcall convention since from the help file i reckoned that _stdcall convention is compatible with VB 6
|
|
|
|
|
I had used the _stdcall convention since it is compatible with vb so i need to use the 'c' extern too?
|
|
|
|
|
Hmmm, seems like I read over the VB stuff. So I try it again
You do right in using the _stdcall convention. But the fact is that _stdcall leads to an exported function name that differs from your declared one.
So if your function is declared as
int __stdcall func (int a, double b),
the decorated name is _func@12 (12 is the number of bytes in the argument list).
Thus you either call it that way or you declare an alias in the EXPORT section of your .def file:
...
EXPORT
Func = _func@12
...
Then you can use the name Func in your VB app.
|
|
|
|
|
Hy there,
i'me looking for infos like tutorials and workshop on programming plug-ins for the internet explorer. How can I access to the favorites and how can i make a button with my functionality? These questions should be answered through the tutorial.
Thanks and regards
boa
|
|
|
|
|
|
boaconstrictor wrote:
i'me looking for infos like tutorials and workshop on programming plug-ins for the internet explorer.
<windir>\Program Files\Microsoft SDK\Samples\web\bits
This is a pretty cool example using BITS (background downloading). You need XP to run BITS, however, this code is a IE Plugin, so it could help you.
Good luck.
R.Bischoff | C++
.NET, Kommst du mit?
|
|
|
|
|
|
I've written a browser helper object that passes the HWND and IWebBrowser2* of an IE window to my dialog-based MFC app.
I need to use the IWebBrowser2* in my app, but doing so would (and does) cause an access violation. How can I use the information I have to create a valid IWebBrowser2* that still references the same instance of IE??
- KH
|
|
|
|
|
khan2000 wrote:
How can I use the information I have to create a valid IWebBrowser2* that still references the same instance of IE??
You can't, you're trying to pass a pointer between two processes (IE and your MFC app). Each process has its own memory space, and cannot see memory in other processes via a simple pointer.
You'll need to create your own communication system between the BHO and the dialog, and have the dialog tell the BHO what IWebBrowser2 methods to call.
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
You can use the marshalling feature of the COM. It's not a piece of cake, but it works, when you do it correctly. The trick is in two functions:
CoMarshalInterface and
CoUnmarshalInterface
I never did it interprocess, so you have to make your own research, but the princip is following - in app 1, in your case the browser helper object you will create the IStream* through function CreateStreamOnHGlobal . This IStream* you should pass to the CoMarshalInterface with your IWebBrowser2* . After succesfull call, you will have all required marshalling properties stored in a global memory stream.
Look for the GlobalAlloc();GlobalLock();GetHGlobalFromStream() etc functions for description how to work with that kind of shared memory and how to pass it between process boundaries.
Then in second process you'll get somehow the IStream* back, put it to the CoUnmarshalInterface to retrieve the IWebBrowser2* back.
So hope this helps and let the force be with you...
|
|
|
|
|
Hello everyone! I recently came upon a very helpful article on this site which detailed the use of stacked dialog pages to create a netscape-like prefrences design. After working around with the code for a little while, I got exactly the results I needed, except for one thing: I do not know how to access a control within one of the stacked pages from the main dialog.
Let me explain: what I intend to do is automatically set focus to a control within each of the property pages as the user selects the name of the page from a list box. For example, they may select temperature (It's a conversion program), and then the temperature pane will appear within a little frame I've created. However, when I try to set focus to a control within that pane, I have trouble. The problem only occurs when I try to access controls inside the pane from the main dialog. Does anyone have any idea on how I might be able to get this working? Thanks.
Btw, I've provided a link to a screenshot of my program, so you can get an idea of what I'm going for. I've also included a link to the page where I found the excellent tutorial on stacked dialogs.
Screenshot of my program[^]
Stacked Dialog Tutorial[^]
"Ignorance is the sin of the many, whereas knowledge is the salvation of few."
Aanidaani
|
|
|
|
|
In the list box 'selection changed' handler, have it tell the dialog handler for the frame containing the control you're interested in to set the focus to a particular item. It goes like this: list box -> frame dialog handler -> set focus.
Software Zen: delete this;
|
|
|
|
|
Thanks for the tip. Unfortunately I had some problems using your method, but I did find an answer that works in my case. What I did was change the OnShowWindow message handler for all my panes and, depending on each pane, I changed the focus to the input box I needed. This way, just before the window is drawn, the input box gets focus, and I can do the whole thing within the pane's class itself, instead of externally. Thanks again.
"Ignorance is the sin of the many, whereas knowledge is the salvation of few."
Aanidaani
|
|
|
|
|
Is it possible to create a modeless dialog that does not
pop itself or owning application above all desktop windows ?
I tried following, but didn't work:
D->initiallyHidden=1;
D->Create(IDD,0);
D->SetWindowPos(NULL,0,0,0,0,
SWP_SHOWWINDOW|SWP_NOOWNERZORDER|SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE);
I got some success with:
CWnd *w=GetForegroundWindow();
D->Create(...)
if(w)w->SetForegroundWindow();
but it makes dialogs parent application flicker.
|
|
|
|
|
My first thought is to use ShowWindow() instead of SetWindowPos() and play around with the parameter (SW_SHOWNOACTIVATE looks like the right one). You need to turn off the Visible style in the dialog resource, otherwise it will automatically be shown during the Create() call.
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I'm reading MSDN but am not really sure whats happening:
dbName = "";
size=128;
LPSTR psz = dbName.GetBuffer(size);
SO does this mean that I've fixed things so that I can copy somethig less than 128 bytes into dbName? SO if I just did dbName = "aaaaaaaaaaaaaaaaa" directly who takes care of the fact that dbName was zero bytes long ("" emoty) before?
When is one method better than another? Or --- when it is necessary to do the GetBuffer strategy?
|
|
|
|