Solved

Volume Manipulation in C++

Posted on 2001-08-04
6
318 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

685 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