Solved

Volume Manipulation in C++

Posted on 2001-08-04
6
315 Views
Last Modified: 2008-02-01
Hi,
Is it possible to use windows.h
in the MFC application in visual C++ 6.0

I have tried it does't work...
the following message is displayed as error

fatal error Windows.h already included MFC apps must not
#include windows.h

or can i manipulate volume(mute,incr,decr, etc) with out
using MFC

Asganesan
0
Comment
Question by:ganesanas
  • 4
  • 2
6 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 6351356
>> Is it possible to use windows.h
USE it yes
INCLUDE it no.

Windows.h is already included for you.  But certainly you can use the windows API functions and other items defined in windows.h in an MFC application.

>> can i manipulate volume(mute,incr,decr, etc)
>> with out using MFC
I don't understand!  Are you using MFC or not?
You can do it with or without MFC.  But what is your program using?
0
 
LVL 22

Expert Comment

by:nietod
ID: 6351358
If you are not using MFC, then you probably want to use waveOutSetVolume().
0
 

Author Comment

by:ganesanas
ID: 6356681
Thanks nietod....

My  doubt is whether an application that is
developed using MFC(which has include files such as
#include <afx.h>
#include <afxwin.h>
#include <afxext.h>          
#include <afxdtctl.h>            
#include <afxcmn.h> )


can include windows.h  ....?


when I included windows.h I received the
error message fatal error:
windows.h aleready included:
MFC apps must not #include <windows.h>


my question is whether windows.h and mfc include files
co-exist in same cpp??

I experienced this problem because already i have written
an application without MFC which is using windows.h

now have developed an module with mfc support
I want to integrate both that why the question....



0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 22

Expert Comment

by:nietod
ID: 6356967
>> My  doubt is whether an application
>> that is developed using MFC
If you are painting a picture, when does it have to be a bowl of fruit and when does it have to be portrait?

If you want to use MFC, use it.  If you don't don't.  You never have to use it.  The only time you couldn't use it woudl be if you are writting portable programs, i.e. standard C++ programs, not windows GUI programs.

First you have to decide if you want to us eMFC or not for an application.  if so, it incudes <windows.h> so you shoudln't.  if not, and if you need <windows.h> include it.

>> my question is whether windows.h and
>> mfc include files
>> co-exist in same cpp??
MFC includes windows.h for you.  For some reason--I don't know why--it prevents you from doing so again.  But that is n't important.  Since it includes windows.h you have all the contents of windows.h available to you in an MFC application.   If you aren't using MFC, then you need to include windows.h.   In either case you have windows.h's information included.

>> now have developed an module with mfc support
As far as I know, you can't just write a little MFC module to an application.  The application has to be an MFC application.  MFC will impose a strict core design to your application.  it defines the program entry point (WinMain()), it defines the central logic on the application (message loop and other core features.)   You then need to customize the application for your needs by addign clases and procedures to the MFC basic desing.   you can't just merge this into an already existing application.
0
 

Author Comment

by:ganesanas
ID: 6361057
Mr.nietod ,
Thanks....

what I can infer from your reply...
is that code using MFC  can't be included in an
application that doesn't support MFC.. am I right?



further can u suggest ;

how to play wave file @ varying speed ( slow, medium,faster)
something like slow motion and fast forward in video...
a piece of code will be of great use...
regards....
Asganesan

0
 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 6361118
>> is that code using MFC  can't be
>> included in an application that
>> doesn't support MFC.. am I right?
Not without redisigning that application to be an MFC application.

I don't know enough about windows audio to really answer that. (I don't know that it is even possible using the built-in windows functions).  If you have questiosn about windows programming, it is best to ask them on the windows topic area.  This topic area is really for the C++ language, not for windows.  The fact that you are programming in C++ has little or no effect on the answer that you are looking for, since the way you use the windows API has nearly nothing to do with the langauge you use.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now