|
Yeah, testing and tweaking a piece of system software all day will do that to you.
|
|
|
|
|
I'm sorry i'll never do it again , i'm a new member in that forum .
|
|
|
|
|
|
Hi i need to make an audio player application which contain a sound spectrum Vu Meter , i've used this function for play pause and stop :
<DllImport("winmm.dll")> _
Private Shared Function mciSendString(ByVal strCommand As String, ByVal strReturn As StringBuilder, ByVal iReturnLength As Integer, ByVal hwndCallback As IntPtr) As Long
End Function
I Need to capture the sound from the sound card then apply FFT (Fast Fourier Transform) , the FFT function is like this :
Private Sub FFTAudio(ByVal RealIn() As Integer, ByVal RealOut() As Single)
please someone can help me , appreciate it
|
|
|
|
|
What exactly do you need help with? You haven't said.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I need help to show the sound spectrum of the audio file being played by the application
|
|
|
|
|
Why can't some people protect the beautiful nature?? ![Confused | :confused:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_confused.gif)
|
|
|
|
|
This is not the forum for a question like that.
|
|
|
|
|
Lakmali Perera wrote:
Why can't some people protect the beautiful nature??
..and which movie inspired this programming question?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Lakmali Perera wrote: beautiful nature Is that a new phrase for the Visual Basic Ecosystem?
|
|
|
|
|
Why do i get the error - "Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic", when I try to pass a String array from vb6 to a class:Property string array in vb.net?
This is the vb6 code:
Option Explicit
Private Sub btnTest_Click()
Dim strTest(4) As String
strTest(1) = "abc"
strTest(2) = "def"
strTest(3) = "ghi"
strTest(4) = "jkl"
On Error GoTo err1
Dim clsTest As ComTest.clsValues
Set clsTest = New ComTest.clsValues
clsTest.SingleString = "this is my string"
clsTest.stringArray = strTest
MsgBox "Single string = " & clsTest.SingleString, vbInformation, "Test"
Dim x As Integer
For x = 0 To UBound(clsTest.StringArray)
MsgBox "Multi string 2 = " & clsTest.StringArray(x), vbInformation, "Test"
Next x
Exit Sub
: err1
MsgBox "Error: " & Err.Number & vbCrLf & Err.Description, vbCritical, "btnTest_Click"
On Error Resume Next
End Sub
This is the vb.net class
Imports System.Runtime.InteropServices
<ComClass(clsValues.ClassId, clsValues.InterfaceId, clsValues.EventsId)> _
Public Class clsValues
#Region "COM GUIDs"
Public Const ClassId As String = "095dc64d-141f-46f9-9af2-1c5e633b459b"
Public Const InterfaceId As String = "86ec1f14-1ef4-446d-9172-b92cf260cd16"
Public Const EventsId As String = "1605e412-8b11-4ee0-a34c-9ec04464737f"
#End Region
Public Sub New()
MyBase.New()
End Sub
Private mSingleString As String
Public Property SingleString() As String
Get
Return mSingleString
End Get
Set(ByVal value As String)
mSingleString = value
End Set
End Property
Private mStringArray() As String
Public Property StringArray() As <MarshalAs(UnmanagedType.SafeArray, safearraysubtype:=VarEnum.VT_BSTR)> String()
Get
Return mStringArray
End Get
Set(<MarshalAs(UnmanagedType.SafeArray, safearraysubtype:=VarEnum.VT_BSTR)> ByVal value As String())
mStringArray = value
End Set
End Property
End Class
The class has been compiled and the .tlb has been registered.
The class has been referenced in vb6.
Error on clsTest.StringArray(x) in vb6 when trying to run project
modified 3-Mar-14 10:14am.
|
|
|
|
|
You don't seem to be setting the StringArray property anywhere. You also have a line which doesn't look like it should compile:
clsTest strTest
Is this a typo in your question?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you for the reply
It is a typo but this is where the error occurs, see error message at top of message after correction.
|
|
|
|
|
I suspect the problem is that the array needs to be passed ByRef , which isn't supported in property setters. Try replacing the property setter with a method:
Public Property StringArray() As <MarshalAs(UnmanagedType.SafeArray, safearraysubtype:=VarEnum.VT_BSTR)> String()
Get
Return mStringArray
End Get
End Property
Public Sub SetStringArray(<MarshalAs(UnmanagedType.SafeArray, safearraysubtype:=VarEnum.VT_BSTR)> ByRef value As String())
mStringArray = value
End Sub
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I read setting the parameter ByRef and not ByVal would work but wasn't sure how to set it up.
A little tweaking and the vb.net code looks like this:
<ComClass(clsValues.ClassId, clsValues.InterfaceId, clsValues.EventsId)> _
Public Class clsValues
#Region "COM GUIDs"
Public Const ClassId As String = "095dc64d-141f-46f9-9af2-1c5e633b459b"
Public Const InterfaceId As String = "86ec1f14-1ef4-446d-9172-b92cf260cd16"
Public Const EventsId As String = "1605e412-8b11-4ee0-a34c-9ec04464737f"
#End Region
Public Sub New()
MyBase.New()
End Sub
Private mSingleString As String
Public Property SingleString() As String
Get
Return mSingleString
End Get
Set(ByVal value As String)
mSingleString = value
End Set
End Property
Private mStringArray As String()
Public Function StringArray() As <MarshalAs(UnmanagedType.SafeArray, safearraysubtype:=VarEnum.VT_BSTR)> String()
Return mStringArray.ToArray
End Function
Public Function StringArray(i As Short) As String
Return mStringArray(i)
End Function
Public Sub SetStringArray(<MarshalAs(UnmanagedType.SafeArray, safearraysubtype:=VarEnum.VT_BSTR)> ByRef value As String())
mStringArray = value
End Sub
End Class
The final vb6 code looks like this:
Option Explicit
Private Sub btnTest_Click()
Dim x As Integer
Dim strTest(4) As String
strTest(1) = "abc"
strTest(2) = "def"
strTest(3) = "ghi"
strTest(4) = "jkl"
On Error GoTo err1
Dim clsTest As comtest.clsValues
Set clsTest = New comtest.clsValues
clsTest.SingleString = "this is my string"
clsTest.SetStringArray strTest
MsgBox "Single string = " & clsTest.SingleString, vbInformation, "Test"
For x = 1 To UBound(clsTest.StringArray)
MsgBox "Multi string " & x & " = " & clsTest.StringArray_2(x), vbInformation, "Test"
Next x
Exit Sub
err1:
MsgBox "Error: " & Err.Number & vbCrLf & Err.Description, vbCritical, "btnTest_Click"
On Error Resume Next
End Sub
Thank you for the help - Mark this one as solved ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
how to display an mp3 file in a folder using listview, ...
|
|
|
|
|
ApRian AnThye wrote:
how to display an mp3 file in a folder using listview, ... ..open the VS IDE, start a new (WinForm) project. Throw a ListView on your Form1 and add below code;
Public Sub New()
InitializeComponent()
For Each item In IO.Directory.EnumerateFiles("D:\Documents\Music", "*.mp3")
ListView1.Items.Add(item)
Next
End Sub
You'd need to "uncomment" the last two commented lines if you want it to presented as a details-view.
If this is not what you meant, then you'll have to explain what you mean with "display".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
how can i make my client automatically logout when their session time is out?
|
|
|
|
|
Because the web is a disconnected medium you have to keep track of it on the client side using a timer. It is not a simple thing to do. I would search google for some samples because there is too much code to explain it fully here.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi everyone,
I need help with the following issues:
I have a SQL table namely
tddocument:
Fileid_PK int
Filename varchar(100)
Extension varchar(50)
Content_document varbinary(MAX)
PDF_doc image Checked
File_location varchar(100)
Case_reportID_FK int
A dataset : tdDocument_dataset
A Vb_form name (Save_PDF_Document)
I put all items from the table on the form as controls.
I put a browse button on the form. here is the code under the button:
Dim openfd As New System.Windows.Forms.OpenFileDialog
Dim ms As New IO.MemoryStream
openfd.InitialDirectory = "C:\"
openfd.Title = "Open a PDF file"
openfd.Filter = "PDF files|*.pdf"
openfd.ShowDialog()
File_locationTextBox.Text = openfd.FileName
Me.PDF_docPictureBox.ImageLocation = openfd.FileName
Save_button to save. Here is the code:
Try
Me.Case_reportID_FKLabel1.Text = Me.Case_reportID_PKLabel1.Text
' SavePDFtoSQL()
Me.Validate()
Me.Table_DocumentBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.Document_DataSet)
Catch ex As Exception
MsgBox(My.Settings.ERROR_msg, vbCritical, "Erreur")
End Try
When I look at the table record from SQL I see the PDF_doc with a <Binary Data> record. meaning something saved.
Now I Have a data grid view(View_DocumentDataGridView)
I double click on it to open another form namely (Frm_PDF_Viewer)so I read the PDF file associates with the grid as follow:
If frm Is Nothing Then
frm = New FrmPDF_Viewer()
frm.Text = "RAPPORT D'ENQUÊTE"
frm.ID = Int(Me.View_DocumentDataGridView.Item(0, IndexRows).Value)
frm.modification = 1
frm.access_level = Me.access_level
frm.User_ID = Me.User_ID
frm.Usergroup = Me.Usergroup
frm.ShowDialog()
End If
when the form FrmPDF_Viewer open under the load I have this:
Try
Me.Fileid_PKLabel1.Text = ID
Me.View_DocumentTableAdapter.FillByfileid_PK(Me.View_Document_DataSet.View_Document, Me.Fileid_PKLabel1.Text)
AxAcroPDF1.LoadFile(OpenFileDialog1.FileName("Me.File_locationLabel1.Text"))
AxAcroPDF1.Show()
Catch ex As Exception
MsgBox(My.Settings.ERROR_msg, vbCritical, "Erreur")
End Try
No luck...I tried so many different ways..
NOTE: what i want to accomplish to upload a pdf, save pdf into a table. showing the record a a grid..double click on the grid to open a form to show all the record including any images or pdf files.
I hope I am clear on this...
thanks for your help and assistance.
|
|
|
|
|
waner michaud wrote:
AxAcroPDF1.LoadFile(OpenFileDialog1.FileName("Me.File_locationLabel1.Text")) That looks like a string, not like the value of "Me.File_locationLabel1.Text". Further, I'd be expecting to see you read it from a binary data record.
There's quite some examples on saving a binary blob; it works the same regardless of type, doesn't matter much whether it's images, PDF or anything else.
waner michaud wrote: No luck...I tried so many different ways.. Find a specific example (here on CodeProject) and gimme an exception - that'd be something that we could work from
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hey guys,
I am having a simple problem, when I add the "Threading.Thread.Sleep(5000)" line to the load event of my splash screen (at the end of the load event) it sleeps before the splash screen is fully initialized (The copyright, version number and what not) leaving big white boxes on my splash screen. I have tried adding this line to the end of the initialization code of SplashScreen 1, but that did the same thing. What am I missing?
(Basically, I want my splash screen to show for 5 seconds after loading everything).
Imports System
Public NotInheritable Class SplashScreen1
Private Sub SplashScreen1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If My.Application.Info.Title <> "" Then
SplashScreenForm.Text = My.Application.Info.Title
Else
SplashScreenForm.Text = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
End If
Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor)
Copyright.Text = My.Application.Info.Copyright
Copyright.Show()
Me.Show()
Me.Focus()
Threading.Thread.Sleep(5000)
Me.WindowState = FormWindowState.Minimized
Me.Visible = False
MenuEditorForm.Show()
MenuEditorForm.TopMost = True
End Sub
End Class
|
|
|
|
|
You can't put the Sleep in there, at all.
What you're doing is hanging the UI thread with the Sleep. The UI thread is waiting for your Load event code to finish executing before it can get back to processing the message pump. The message pump is going to have WM_PAINT messages in it waiting to be processed so your form can paint itself.
|
|
|
|
|
Thanks! Can I have it call a function that has sleep in it?
|
|
|
|
|
No because you're still on the UI thread.
The "work" should be done on a sperate thread to leave the UI thread to, well, update UI things. Look into awaiting Tasks[^] or using a BackgroundWorker[^] to move the "work" off of the UI thread.
|
|
|
|