Solved

Main Volume OCX

Posted on 2004-08-27
10
480 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
Comment Utility
okay its coming up!
0
 
LVL 4

Expert Comment

by:Daniellus83
Comment Utility
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
Comment Utility
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
 
LVL 4

Expert Comment

by:Daniellus83
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 4

Accepted Solution

by:
Daniellus83 earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

728 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

13 Experts available now in Live!

Get 1:1 Help Now