Solved

Main Volume OCX

Posted on 2004-08-27
10
484 Views
Last Modified: 2008-01-09



Well u r right that i want to control  to adjust the volume of microphone.
I read the artcile which  have given in
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21084780.html#11912087

I jsut want to change the slider bar in the  Volume bar same  as  in sndvol32.exe .
I need the slider control similar to that only.

Pls if possible  help me out. I really need it urgenlty
0
Comment
Question by:rajender123
  • 6
  • 2
10 Comments
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11915001
okay its coming up!
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11916381
Hello, rajender123.... I kept my word... after some programming:

http://www.danieltrommel.com/download/SetPlaybackVolume.zip

I hope this is what you want. I've included a sample project because the Slider (like in sndvol32.exe) isn't VERY difficult to make in VB6 but easy in VB.NET. I also changed the OCX so you can call a sub "SetVolumeMain()" and "SetVolumeMic" ...

Succes!!
0
 

Author Comment

by:rajender123
ID: 11919401
Hi  daniell

well thanks  for  your help. I tried using the s ame OCX with two slider controls but i ma not able to run since as soon as i complie and run the program  and then i try to move the sldier it is showing me this error:-

"Object reference not set to an instance of an object."


can u tell me wht i have to do to use this OCX.

although i have added the ocx propelry in my code.Pls do let me know

0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 4

Expert Comment

by:Daniellus83
ID: 11920677
Hello;

>> First of all:
 
   Did you try to build the FULL ORIGINAL project (without changing!) from the website above? Did it work?

>> The problem you asked about in your last post;

   Is it about the original project OR did you tried to make your own by copying the OCX to your own directory?
0
 
LVL 4

Accepted Solution

by:
Daniellus83 earned 500 total points
ID: 11920700
To use the SetVolumePlayback2.ocx in a new (your own) project; you have to do this:

---------------------------------------------------------------------------------------------------------------

1) Start your VB.NET 2003,...

2) Create a new project

3) Select on the TOOLBOX (left on you .net 2003 interface) the section "My User Controls..."

4) Press now with your Right-mouse-button on the empty gray area on the toolbox and...

5) choose Add/Remove Items

6) In the new opened window choose the SECOND tabsheet "COM Components"

7) Press the button "Browse" and open the OCX file  "SetVolumePlayback2.ocx"

8) Now you should see a new icon appear on you Toolbox > My User Control > "Volume" (could be named different!)

9) Add this component to your Form

Now have I implemented nothing graphical on the OCX thing.... you just have to name it:

10) Select the added component and name it "MyVolume" (or so)

11) Now in your code you will be able to call these functions:

            MyVolume.SetVolumMain( value )

      and
           
            MyVolume.SetVolumMic( value )

     where 'value' is supposed to be a value between 0 and 65536
---------------------------------------------------------------------------------------------------------------

Get it? You just have to name (!) the added OCX component, and than you can set both volumes via that name!

Daniël
0
 

Author Comment

by:rajender123
ID: 12237097
Dear daneil

Its agian me for asking some more details  about the volume...
It is working fine.. but  each and very time i load my form the slider moves to the initial value.. although the microphone volume in the task bar has chnaged.

How the volume control be set to that value which we have chnaged last time..
why is it moved each and every time to zero..
can u pls help me out
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 12243020
First off all; I feel a little disappointed it had to come to a forced points accept!!


I think I understand what you mean...

The 'problem' is that the Volume slide is ONLY made to SET the volume. If you had ASK for it, I had included a GETVOLUME method wich would retrieve the current volume and set the Volumebar so...

So it is set to zero because it doesn't retrieve (would be the GETVOLUME method...) the current Volume, it is set to the initial value of the bar itself; zero.

Daniël
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 12243044
You could solve the problem by storing the last volume settings of your application in a configuration file (on exit?), and when you open the program again, you would read the config-file again and set the volume.

ONE BIG advantage of this is: when the Volume is changed by another application, you would restore always the last (correct) volume setting!

Daniël
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 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