Solved

Volume Manipulation in C++

Posted on 2001-08-04
6
314 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
Comment Utility
>> 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
Comment Utility
If you are not using MFC, then you probably want to use waveOutSetVolume().
0
 

Author Comment

by:ganesanas
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 22

Expert Comment

by:nietod
Comment Utility
>> 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
Comment Utility
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
Comment Utility
>> 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

772 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

10 Experts available now in Live!

Get 1:1 Help Now