|
The simplest way to do this would be to add the "Windows Media Player" to your ToolBox, then drag and drop the control onto your form. You could then set it up to drop the user interface and then just tell it which file to play.
Player.uiMode[^] from the Windows Media Player 10 SDK docs.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
'first of all you have to import a called QuartzTypeLib
'declear globle variables
Dim bAudio As IBasicAudio
Dim bvideo As IBasicVideo
Dim mEvent As IMediaEvent
Dim vdoWindow As IVideoWindow
Dim mCtrl As IMediaControl
Dim mpos As IMediaPosition
Public Const WS_VISIBLE = &H10000000
'call remove media to remove oldloded media
********************************************************
Public Sub RemoveMedia()
Try
DisableCtrl()
If Not mCtrl Is Nothing Then
mCtrl.Stop()
End If
If Not vdoWindow Is Nothing Then
'vdoWindow.Owner = Nothing
End If
If Not bAudio Is Nothing Then
bAudio = Nothing
End If
If Not bvideo Is Nothing Then
bvideo = Nothing
End If
If Not mCtrl Is Nothing Then
mCtrl = Nothing
End If
If Not vdoWindow Is Nothing Then
vdoWindow = Nothing
End If
If Not mpos Is Nothing Then
mpos = Nothing
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
*********************************************************
call loadMedia to load new media file to be plaed prove file name and path as string in the function
**********************************************************
Public Sub LoadMedia(ByVal data As String)
On Error GoTo OpenFileError
mCtrl = New FilgraphManager
Call mCtrl.RenderFile(data)
bAudio = mCtrl
bAudio.Volume = 0 'Loudest
bAudio.Balance = 0 'Centered
bvideo = mCtrl
vdoWindow = mCtrl
vdoWindow.WindowStyle = WS_VISIBLE 'WS_VISIBLE = &H10000000
vdoWindow.Top = 0
vdoWindow.Left = 0
vdoWindow.Width = mainWindow.Width
vdoWindow.Height = mainWindow.Height
vdoWindow.Owner = mainWindow.Handle.ToInt64
mEvent = mCtrl
mpos = mCtrl
mpos.Rate = 1 'Normal forward playback speed
Me.panMedia.Text = "File Loaded"
PosBar.Maximum = mpos.Duration
EnableCtrl()
SetTotalTime()
Exit Sub
OpenFileError:
Err.Clear()
Resume Next
End Sub
********************************************************
user myCtrl.Play(),myCtrl.Stop(),myCtrl.Pause() to play stop and pause.and take only picture box as the window to play the file here "mainWindow" variable is the nmae of the picture box.:cool:
Get back 2 me
|
|
|
|
|
Hello all,
I am stuck wih a problem. I have created Splash Screen(Form1) after a interval of time (Using Timer) I nee to show Login Form (Form2).
I used this code to show form 2 but This is not working
Pivate sub Timer1_Tick(byval sender as <blabla>, byval e as <balbla>)<blabla>
If Timer1.Interval = 100 then
Dim f as new form2
f.showDialog
End if
End sub
but this is not working. It will show the Form2 but it wont close the form1
So can any one slve this problem
I even tried f.show, f.hide it will close the whole application. I want the Form2 to be active.
Waiting for your reply...
Cheer's
Santhosh
santhosh nataraj
|
|
|
|
|
hi there,
just simply close the form1 before showing form2
<< >>
|
|
|
|
|
Can't do that. Since Form1 is his startup form, it'll close his entire application.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Search the articles here for Splash Screen. YOu'll come up with lots of examples on how to do it.
Basically, you can't make a splash screen your startup form. Closing it will close your entire application since you just shutdown your app's message pump. What you can do is launch two applications, the first being the Splash form and the second being your main form for your application. You'll see what I mean in the examples you find.
Now, for you login screen. You're main form has to check to see if it's login user ID and have been authenticated by whatever means your using. If not, your main form then puts up a login form that authenticates the user's credentials. Once the login form returns contorl to the main form, your main form then checks again to see if the login was sucessfull, and if so, just continues on it's way. If not, that's up to you. You can put up a warning that the user has limited functionality, or you could just quit, ...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello All!
I have a problem regarding desktop application in vb.net...
Actually I have a formA that hasa a textbox...such that when the textbox gets the focus It calls FormB......
Problem is that when the formB is closed It gets the focus back to the textbox on FormA which in turns call FornB and so on...
i am making the FormB Model...
So my question is that is there any possibility that from FormB I can set the focus to any other control on FormA.......
It is to be noted that i am not closing FormA...
Thanx in Advance!
_mubashir
|
|
|
|
|
The problem is that you cannot set focus to a control that is not active and since FormA is not active at the time FormB is about to close (where you would want to set focus to another control on FormA) it can't be done. You'd also need to expose FormA's controls etc. to FormB to go down this path anyway and that is not a best practice.
What I suggest is that you set a global (to FormA) variable in the textbox's GotFocus() event before you show FormB and you conditionally show FormB only when this variable is False. This will prevent the infinite loop.
...Steve
|
|
|
|
|
Thanx Steve.... I have already done this as you said by setting the global variable........
But I was thinking may be this can happen....
Anyways......Thanx
_mubashir
|
|
|
|
|
can anyone help me to implement a genetic algorithm to solve the TSP for tours of length 20, 50 and 100 using one of chromosome recombination and mutation operators in VB.need help....
|
|
|
|
|
|
|
I am working on a custom GroupBox control (called GroupCheckBox) that has a checkbox for enabling and disbling the child controls it contains. The way I have my GroupCheckBox control setup is by using a combination of controls. It inherits from the GroupBox control, and a CheckBox control exists within it. I am trying to create two properties on the GroupCheckBox control to handle Checked and CheckState properties similar to the CheckBox control. These properties look like so in VB code:
<br />
Public Class GroupCheckBox<br />
Inherits System.Windows.Forms.GroupBox<br />
<br />
Friend WithEvents checkBox As System.Windows.Forms.CheckBox<br />
'omitted irrelevant code...<br />
<Category("Appearance")> _<br />
Public Property Checked() As Boolean<br />
Get<br />
Return Me.checkBox.Checked<br />
End Get<br />
Set(ByVal Value As Boolean)<br />
EnableGroup(Value)<br />
Me.checkBox.Checked = Value <br />
End Set<br />
End Property<br />
<br />
<Browsable(True), EditorBrowsable(EditorBrowsableState.Always), Category("Appearance")> _<br />
Public Property CheckState() As CheckState<br />
Get<br />
Return Me.checkBox.CheckState<br />
End Get<br />
Set(ByVal Value As CheckState)<br />
Me.checkBox.CheckState = Value <br />
End Set<br />
End Property<br />
<br />
End Class<br />
Unfortunately, whenever I change one of the properties, like let's say I change Checked to false, the CheckState property is not in synch with it and doesn't change in the design view. This doesn't happen when you use a CheckBox control, the two properties are in synch and match their values accordingly. I think the problem lies within the form designer not being updated in my code. Is there some way to tell the form designer to update the other property when it's corresponding value is changed? I'm guessing this can be done by using something within either the System.ComponentModel or System.ComponentModel.Design namespaces. BTW, I am using VB.NET on Visual Studio .NET 2003.
|
|
|
|
|
does anybody have the vaguest idea why this gives a runtime system error?
<br />
imports System<br />
Imports Microsoft.Win32<br />
Imports System.Data<br />
Imports System.Data.SqlTypes<br />
imports System.Data.Odbc<br />
<br />
dim DBConnection as new OdbcConnection("DSN=XYZ")<br />
DBConnection.Open()<br />
and yes there is a system dsn called XYZ that works from the odbc control panel thingy
thnx
:/
"there is no spoon" biz stuff about me
|
|
|
|
|
Try wrapping the code in a Try..Catch block and inspect the exception message directly. It may be that your DSN connection is attempting to use a trusted connection when one does not exist so you may need to provide more parameters in the connection string.
Try
Dim DBConnection As New OdbcConnection("DSN=XYZ")
DBConnection.Open()
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
...Steve
-- modified at 20:36 Thursday 22nd September, 2005
|
|
|
|
|
does anybody know how to enumerate the available odbc connections from a vb.net app? i cant find any docs on it in msdn
thnx
"there is no spoon" biz stuff about me
|
|
|
|
|
I don't know how to do this in managed code. The only way I know how to do it is to use the old ODBC API. The function SQLDataSources() should do the trick.
MSDN information[^]
I found an example how to use it in VB.Net.
http://www.vbcity.com/forums/faq.asp?fid=8&cat=General#TID1391[^]
I hope this helps.
-- modified at 16:50 Thursday 22nd September, 2005
<edit>
Actually, that code example that I linked above looks more like VB6. Sorry about that, but I'm sure it'll give you the idea.
|
|
|
|
|
thnx a lot joshua ... i think the example was in vb6 and i dont know enough of .net to convert all the external ref calls yet so i went with reading the registry directly *clunk clunk*
<br />
dim rk as RegistryKey = registry.LocalMachine.OpenSubKey("Software")<br />
rk = rk.OpenSubKey("ODBC")<br />
rk = rk.OpenSubKey("ODBC.INI")<br />
rk = rk.OpenSubKey("ODBC Data Sources")<br />
dim names as String() = rk.GetValueNames()<br />
*sigh* vb is _so_ elegant no?
"there is no spoon" biz stuff about me
|
|
|
|
|
I don't know if there is a better way to do this in VB.NET.
There are registry keys that contain ODBC info of various and sundry sorts, in Win 2K:
HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ODBC Data Sources
and identical keys unders the various HKEY_USERS nodes
Also
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI
In VB6 you could use a COM dll named "ODBCTool.dll" to enumerate all ODBC drivers installed, enumerate all DSN connections configured, and create a new DSN connection.
Not sure if MS provides the inter-ops for this DLL for NET.
|
|
|
|
|
|
I just imported ODBCTool into NET no problem. It is very simple to use, especially if you might need to create a DSN - you don't have to write all that code to add reg entries.
If I understand MS policy correctly, you can import a typelib that has no vendor PIA as long as you don't make any of it's methods publicly available from your application. Internal use is allowed.
And if I don't understand MS policy correctly, well, I'm not a dumbass - they should make it understandable to a reasonably non-dumbass person - so f*** 'em.
|
|
|
|
|
A VB script done in excel as a macro was handed off to me to see if i can save the contents of the UI (labels & texts) into a pdf file without having to store them in a database or storage system. First off, I've never used VB and absolutely not familiar with the syntax. Lastly, I've never done anything like this without having to store data in some way (database or flat).
Can anyone help me? Thanks.
Sincerely,
Jason C. Ranin
Software Quality Assurance
|
|
|
|
|
First of all, you can interface VB (and C#) with Excel, and you can find plenty of examples on how to do this. So I will not attempt to address that, since if you don't know VB you are going to be spending lots of time with that part to begin with.
Now, for the PDF part. I have many, many words in my vocabulary to describe working with the PDF format. And when I am actually in the process of working with PDF, I use them all, constantly, strung together in novel creative ways. For the sake of the forum let me just summarize as "major hassle".
There is an open source library that is invaluable when working with PDF's although depsite the fact that I consider it essential, working with this library can also be described as "major hassle".
Although the library, and most of the documentation is for C#, you can use it in VB.NET as well. (Despite some arrogant misconceptions otherwise, C# and VB.NET are really the same thing).
You'll find a lot more examples of interfacing to Excel in VB. You'll find working with the PDF library just damn difficult no matter which way you go. Assuming you do not know either VB.NET or C#, the choice is really up to you.
Let me say in no uncertain terms, this project was handed off to you for GOOD reason. It could take you months to figure it all out.
I strongly, strongly, strongly advise you to punt if it is at all possible. Really. Punt! Punt! Punt! If you can't punt, find a shady doctor that writes shady 'scripts and tell him you need speed and valium. Both in large quantities.
You can find the PDF lib here:
http://itextsharp.sourceforge.net/[^]
I feel for you.
|
|
|
|
|
hello friends,
i have a ? for you. how we record our sound in vb6.0.
help me out.
|
|
|
|
|
You'd find a couple dozen examples of this, using a few different methods, by typing "vb6 record sound" into Google. Or, just click this[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|