|
Your problem is passing a pointer by value. You want to modify the pointer in the calling function so you have to pass the POINTER BY REFERENCE
change like this
MyFunc(char* pBuf1, char** ppBuf2, int nSize1, int& nSize2)
{
ASSERT(*ppBuf2==0); // Make sure caller hasn't allocated memory
*ppBuf2 = new char[SOMENUMBER];
// Fill previously allocated buffer with valid data
// ...
}
int nSize = 0; // Size of buffer allocated by functions belowchar
*pOut = NULL; // So function doesn't ASSERT
MyFunc(pOrg, &pOut, 100, nSize);
delete[] pOut; // Delete memory allocated by function
|
|
|
|
|
Hello
I have an app that plays a wav file to attract the users attention. The customer would like to have different sounds for different situations.
Rather than add a dialog box that allows the user to select a wav file I would like my application and its events to appear in the Sounds and Multimedia control panel applet and allow the user to select from the list of souns available.
I have found some settings in the registry under HKEY_CURRENT_USER\AppEvents\Schemees
that looks promising. Is it just a matter of figuring out what these are for and adding keys for my app or is there a set of API functions to do it.
Also, at runtime how do I ask windows to play the sound assosiated with this event?
If you could just point me to the general area in MSDN I should be right. I just cant find it
Thanks
Josh
|
|
|
|
|
You could find some info here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwue/html/ch11f.asp[^]
Basically, you have to create a registry key HKCU/AppEvents/EventLabels/<MyEvent> , with the default value set as a description. Then you have to associate this event with your application, by creating the registry key HKCU/AppEvents/Schemes/Apps/<MyApp>/<MyEvent>
To programmatically associate a sound file to this event for this application, create the registry key HKCU/AppEvents/Schemes/Apps/<MyApp>/<MyEvent>/.Current and set the default value to the path of the sound file.
To play it in your application, just call
sndPlaySound(_T("<MyEvent>"), SND_APPLICATION | SND_ALIAS | SND_SYNC | SND_NODEFAULT);
Or course, replace <MyApp> and <MyEvent> by your specific values.
HTH,
K.
A quoi rêvent les personnes qui nous font vivre ce monde ?
|
|
|
|
|
Briefly, how is the association between the executable and <myapp> made?
Steve S
|
|
|
|
|
I'm not sure to understand your question.
The register key "HKCU/AppEvents/Schemes/Apps/<myapp>/<myevent>" makes the connection between the event and the application.
A quoi rêvent les personnes qui nous font vivre ce monde ?
|
|
|
|
|
|
My pleasure
A quoi rêvent les personnes qui nous font vivre ce monde ?
|
|
|
|
|
I think what I meant (!) was how do I identify my application?
If it's the module name 'MSDEV', for instance, that would mean I can't have two apps with the same EXE name that have associated (but different) sounds, if they have events in common.
Steve S
|
|
|
|
|
If you have two apps with the same name, there are not 2 applications but 2 instances of the same application. So, these instances share the same registry values, and share also the sound events.
A quoi rêvent les personnes qui nous font vivre ce monde ?
|
|
|
|
|
KaЯl wrote:
If you have two apps with the same name, there are not 2 applications but 2 instances of the same application.
Not necessarily. The name in the registry is only the module name, not a FQN, so I could have
C:\Program Files\AardvarkSoftware\CTLMGR.EXE
and
C:\Program Files\ZebraSoft\CTLMGR.EXE
which are distinct applications, rather than instances of the application.
However, I take your point, it answers my question, and my suspicion was right.
Thanks
Steve S
|
|
|
|
|
Ok, I get your point. That's true it may be a problem, but I never faced it for the moment. In this case, the events names should be specific enough to avoid confusion.
A quoi rêvent les personnes qui nous font vivre ce monde ?
|
|
|
|
|
a socket generally has a listener and receiver
can a socket be used to communicate with > 1 receiver?
Bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|
Sure it can be done.
This is the concept where the multiple client acces the an single server.
Shanmuga Sundar.V
|
|
|
|
|
As you say, a single socket has only one listener and one receiver. To get multiple receivers you will need to do broadcasts using datagram sockets.
|
|
|
|
|
coolo
one of the blokes here at work says its possible to do a TCP broadcast (as opposed to a UDP multicast which i can do)
to the local subnet, just have the last section of the IP as 255for our clas of network.
eg. 192.168.0.255
What else do i need to set up to get it going?
regards
bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|
bryce wrote:
one of the blokes here at work says its possible to do a TCP broadcast (as opposed to a UDP multicast which i can do)
Sorry for being blunt, but the bloke at work is full of shite. TCP is a point to point protocol. It can't handle anything but exactly two parties.
--
He is the painkiller. This is the painkiller!
|
|
|
|
|
Depends what you're trying to do.
The conventional technique is to 'listen' on a common socket, when a client tries to communicate the 'accept' function returns the handle to a new socket that is used to hold the the conversation with that client. Thus a server can wait for a connection from multiple clients. But the conversation with each client is one-to-one on a dedicated socket.
Broadcasting or multi-casting to multiple clients is somewhat different.
|
|
|
|
|
What is the easiest way to connect to an Access DB from a ISO standard C module?
|
|
|
|
|
|
Hi,
I have a program that uses MFC. I made an install project for my program and I installed it on another computer.
When I tryed to run my program it said that it needed MFC70D.dll. After I copied this file in the program dir the error message said the program needed MSVCP70D.dll and after this it was MSVCR70.dll.
I added this files to the instalation program. But now when I try to install on the other computer there is an warning in the installation process:
"Module C:\...\MFC70D.DLL failed to register. HRESULT -2137024769. Contact your support personnel."
(Exit instalation / Try again / Continue) If I hit Continue all works fine.
Why is this? What is the proper way to also install this files needed by my program?
Thanks
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
Your installer is set to self-register MFC70D.DLL. It doesn't need to be registered, because it contains no COM classes, and hence it doesn't export the DllRegisterServer entry point.
You shouldn't be shipping a debug version of MFC with your software. Build a Release version of your software, then ship MFC70.DLL, MSVCP70.DLL and MSVCR70.DLL.
If you're using a Windows Installer-derived installation product, use the merge modules supplied with Visual Studio .NET. You need VC_MFC.MSM (MFC70.DLL and MFC70U.DLL), VC_CRT.MSM (MSVCR70.DLL) and VC_STL.MSM (MSVCP70.DLL), which are installed to C:\Program Files\Common Files\Merge Modules. If the tool has an option to check MSMs for DLLs added to an installation, enable the option and point it to this directory.
|
|
|
|
|
i have a main dialog containing 3 child dialogs. I created a COpenglclass in main dialog such that any image visualization will take place in the main dialog. But i do not know how to detect that if any child dialogs are accessed only then will my drawing code in the COpengl class take in data from the child dialog and show the relevant image. need help on this urgently
|
|
|
|
|
Is it possible just to use the child's msg when it receives focus or something along those lines and then react and do whatever you want.
|
|
|
|
|
thanx for replying. i am considering alternative or setting state flags but i not sure how to code that in child dialog and view class's Onpaint().can you illustrate?
|
|
|
|
|
Apparently I am missing the appropriate reference material to solve this problem and my attempts to google an answer has been an exercise in frustration. It doesn't help that there seems to be no strict consensious on if seperate output channels are 'channels', 'voices' or some other thing I can't think of. The only reference I have found is a link to a dll that allows you to use up to 8, but there is no source for the dll itself or explaination of how it works...
Basically, a friend of mine has a program that uses C++ with MFC and currently everytime an event happens in it and a sound is played, it halts whatever previous sound was playing and starts the new one. Now games don't do this and other programs seem to be able to play a wav/mp3, etc. without interrupting something already active. I need to know how to:
a) find out how many real voices/channels are available.
b) figure out which ones are not in use.
c) replay the next sound on an unused channel, instead of interrupting something that may not be finished playing.
I haven't a clue how to do any of this, nor a sufficiently decent explaination of how you can do this, despite most cards now having anything from 8 to 96 seperate outputs for overlapping sound. Most simply ignore this issue in favor of the 'Here is how to play one sound, good luck trying to play more' type of examples. It is quite frustrating and I am now at the point where I don't even know where to continue looking.
As a preference, I would prefer an option that doesn't necessarilly depend on DirectSound or the like, which may in some rare cases not exist on a computer that is normally still able to run the program this feature is to be included in. Please help!! :.(
|
|
|
|