Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Volume Manipulation in C++

Posted on 2001-08-04
6
317 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Compile GLUT with Visual Studio 2015 1 172
Error C2678: binary '!=': no operator found... 4 58
Safe conversion? 4 72
gdb doesn't stop on breakpoint 2 94
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…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

856 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