Solved

Main Volume OCX

Posted on 2004-08-27
10
485 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 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