|
Hi everybody.
I'm writing a CD PLAYER, (with my own class), using the MCI COMMANDS
with the SendString function.
Everything goes well, but I have two problems.
First: How can I detect when an AudioCD is insert?.
Right now, I have a member function in my class called IsCDInsert()
and with a WM_TIMER message in my dialog, (the method wake up every second),
I can do that, but I think that this is not the right way.
Maybe the question could it be: How can I make my cd player the default player?.
Second: I have, (for example), a slider control in my dialog, and I like to control
the CD Volume with it. How can I link that control with the sistem volume function?.
I have see the MCIWndGetVolume() function, but I dont have a MCI window, and the
function waveOutSetVolume() but I think that it's only for wave files.
Well, thank you very much.
Sorry about my english.
Demian
|
|
|
|
|
"First: How can I detect when an AudioCD is insert?"
Call API function GetVolumeInformation(...). If after call succeeds lpVolumeNameBuffer variable is "Audio CD", CD is insert.
You can read description of this function here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/getvolumeinformation.asp
If you need to know if CD-ROM is present and how many CD-ROMs, call GetDriveType(...) (in case of CD-ROM it returns DRIVE_CDROM).
Sincerely, WiB
|
|
|
|
|
Thank you very much WiB.
Regards from Argentina.
Demian.
|
|
|
|
|
We have an application that is basically just a three-line loop... one is a 1-second sleep, the other two check to see if a process is running and start it if it isn't. We've noticed a lot of page faults in this application. I'm guessing its because the code is being paged out during the sleep, then paged back in when it starts up again. Can anyone suggest how to prevent this?
|
|
|
|
|
Use VirtualLock on the function address. It works only on NT and requires high priveles - usually administrator/system account.
If you only need to see if process died, you can wait on the process handle.
|
|
|
|
|
Hi all,
I'm using a CHtmlView in my app which displays a web page containing an embedded mpg video.
Is there anyway to control which plugin IE uses to play the movie?
(Ideally only for my app, rather than changing the users system wide settings)
The reason I need to do this is because I want the video to be played in a forward then backwards loop (so called ping-pong or palindrome mode). It seems that this functionality is only provided by QuickTime not the inbuilt media player or real player for example.
I plan to install QuickTime at the same time as my app, but I am worried if the user installs another playback plug-in afterwards it will break the playback of my video in my app.
Any suggestions to control the mime types or is there a way to choose the plugin in the html itself?
--
The Obliterator
|
|
|
|
|
Hello,
I need to use template functions, but as it seems that they must be declared and defined in the same file, I've placed them in the header file.
After doing this I've noticed two problems:
1. I can't use breakpoints there.
2. I can't see the functions in the class wizard.
Any advice? mostly on the first topic, I can live with the second one... but I need to be sure that the pointers passed as parameters are the right ones and I need to be able to debug that functions...
Thank you in advance.
|
|
|
|
|
Having just knocked up a quick test application, I have no problem with setting the breakpoints in the header file.
I would guess that maybe the debug information is incorrect for your project (I presume you've tried a full rebuild?) or you have some strange compiler settings that are causing problems, but beyond that I don't see any reason why you can't set breakpoints.
Sorry I can't assist you any further than that.
--
Ian Darling
|
|
|
|
|
The functions are template based declared in this way:
template<class T> inline long WriteSomeData(CString csNameOfTheVar, T TemplateParam, int iPort)
{
...
} this declaration is placed as a member of one class.
then, I can't place a breakpoint and make it work right.
Any idea?
|
|
|
|
|
Nothing looks amiss to me. My first reaction told me it was the inline, but I seriously doubt that's the problem (although I do doubt the usefulness of that inline in this context
--
Ian Darling
|
|
|
|
|
Hello,
Ian Darling wrote:
I do doubt the usefulness of that inline in this context
Why do you doubt that?
I use that function from some others a lot of times and if I have not misunderstood the inline modifier, it's purpose is to give more velocity to the program by not calling the inline function but adding the inline function code at the place where the inline function call is.
Then the pourpose it's clear, isn't it?
|
|
|
|
|
If you include the body of a function inside the class definition, then it is the same as if you qualify it with inline . That is,
class A
{
int f(){cout<<1<<;}
}; is equivalent to
class A
{
inline int f();
};
...
int A::f()
{
cout<<1;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello,
First of all thank you for your answer, it has explained me other thing that I didn't know, but after removing the inline , it makes the more or less the same:
1. I can't debug the function properly (some times I can debug it (the compiler stops at the breakpoint) and sometimes not and the function is being called (I'm sure about that last part)).
2. The functions involved (there are various functions placed in the header file) continue without appearing in the ClassView...
Could you tell me what's happening?
As always, thank you in advance...
|
|
|
|
|
1. I think this is a problem with the debugger and template member functions (I've experienced similar strange things in the past). One way (not tested myself) to make sure the debugger always stops is as follows:
template<typename T> void CMyClass::Whatever()
{
DebuggerStopper();
...
}
void CMyClass::DebuggerStopper()
{
} 2. The class viewer is crap, I don't know any fix for that.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Well, thank you, I've tested it and it worked OK, I'll be able to detect errors in those functions now.
Talking about the other thing... I think I'll be able to live with it... moreover when I'll place that code inside a DLL for further use of it.
as always, thank you very much.
|
|
|
|
|
inline might be your culprit...
-=jarl=-
|
|
|
|
|
Hello,
First of all thank you for your answer, but after removing the inline, it makes the same:
1. I can't debug the function properly (some times I can debug it (the compiler stops at the breakpoint) and sometimes not and the function is being called (I'm sure about that last part)).
2. The funtions involved (there are various functions placed in the header file) continue without appearing in the ClassView...
thank you in advance...
|
|
|
|
|
HI guys
I'm really newbie coding printing and I have the following doubt.
I'm doing calculations and depending of the result I have to print or not.
If the result is 0 the page doesn't have to be printed in any other case yes.
But if I'm not wrong , the number of pages has to be fixed in OnPreparePrinting and then... what do you suggest to me to do to avoid print blank pages when the result is 0.
I hope do you understand my question.
Best Regards and thank you.
Doctor pi
|
|
|
|
|
From MSDN:
Another example is the case in which the length of the document is not known until it is printed. In this situation, the view class tests for the end of the document each time a page is printed. When the end is reached, the view class sets the m_bContinuePrinting member of CPrintInfo to FALSE; this informs the framework to stop the print loop
Look up the CPrintInfo structure for additional info.
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
How can I simulate a toolbar press, not just the PressButton function since this does not call the function, but the actuall calling of the function related to the toolbar button.
Cheers
Asim
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
Can you not just send yourself the correct WM_COMMAND message?
AfxGetApp()->SendMessage(WM_COMMAND, ID_TOOLBAR_BUTTON, 0);
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
Thanks...
Just figured that one out for myself.. i was using AfxGetApp()->SendMessage(ID_TOOLBAR_BUTTON, 0, 0);
and wondering why it wasn't working?!?!?!?
Thanks again...
Asim.
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
Dear all,
I have written a program and try to run it but get this Dos
screen and message
" Program too big to fit into meemory"
Anybody pls help!!!
thanks you
|
|
|
|
|
what do you do in the program?
[]D [] []D []
|
|
|
|
|
Operating sytem? (Dos 3.1?)
How big is your program?
Do you have any global static arrays?
|
|
|
|