Click here to Skip to main content
14,765,861 members
Home » Discussions » Visual Basic
   

Visual Basic

 
AnswerRe: Visual Basic 2010 : Creating a list and searching it efficiently using a binary file Pin
Eddy Vluggen4-May-12 0:58
professionalEddy Vluggen4-May-12 0:58 
Question[Solved] Run Application in 64-bit mode Pin
Brandon-X120002-May-12 14:43
MemberBrandon-X120002-May-12 14:43 
AnswerRe: Run Application in 64-bit mode Pin
Peter_in_27802-May-12 14:59
professionalPeter_in_27802-May-12 14:59 
GeneralRe: Run Application in 64-bit mode Pin
Brandon-X120003-May-12 3:48
MemberBrandon-X120003-May-12 3:48 
GeneralRe: Run Application in 64-bit mode Pin
Brandon-X120003-May-12 3:57
MemberBrandon-X120003-May-12 3:57 
GeneralRe: Run Application in 64-bit mode Pin
Peter_in_27803-May-12 13:11
professionalPeter_in_27803-May-12 13:11 
GeneralRe: Run Application in 64-bit mode Pin
Brandon-X120004-May-12 10:18
MemberBrandon-X120004-May-12 10:18 
QuestionProblem using a fixed length string in a structure used as a parameter to a Win32API call Pin
dmt19401-May-12 10:29
Memberdmt19401-May-12 10:29 
Imports System.Runtime.InteropServices
Public Class Form1
Public Const MAXPNAMELEN = 32 ' max product name length (including NULL)
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _
Structure MIDIINCAPS 'Structure def copied from win32api.txt
Dim wMid As Int16
Dim wPid As Int16
Dim vVersion As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=MAXPNAMELEN)> _
Dim szPname As String 'win32api.txt def is String*MAXPNAMELEN
End Structure
Declare Function midiInGetNumDevs Lib "winmm.dll" () As Long
Declare Function midiInGetDevCaps Lib "winmm.dll" Alias "midiInGetDevCapsA" _
(ByVal uDeviceID As Int32, ByVal lpCaps As MIDIINCAPS, ByVal uSize As Int32) As Int32
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim retval As Int32
Dim NumMidiInDevices As Int32
Dim DevCounter As Int32
Dim devicecaps As New MIDIINCAPS
NumMidiInDevices = midiInGetNumDevs()
For DevCounter = 0 To NumMidiInDevices - 1
retval = midiInGetDevCaps(DevCounter, devicecaps, Len(devicecaps)) ' Runtime error msg here
'=======================================================================
'A call to PInvoke function 'MidiInCapTest!MidiInCapTest.Form1::midiInGetDevCaps' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
'========================================================================
Next DevCounter
End Sub
'============================================================================
'I have tried <VBFixedString(MAXPNAMELEN)> instead of Marshall as, in the sructure plus countless tries at int16, int32 etc for the other parameters in the API call,in a fruitless attempt to outwit the known inconsistencies between winapi32.txt data types & .NET but to no avail.

'Can anyone help

End Class
AnswerRe: Problem using a fixed length string in a structure used as a parameter to a Win32API call Pin
Dave Doknjas1-May-12 15:13
MemberDave Doknjas1-May-12 15:13 
GeneralRe: Problem using a fixed length string in a structure used as a parameter to a Win32API call Pin
dmt19402-May-12 7:52
Memberdmt19402-May-12 7:52 
AnswerRe: Problem using a fixed length string in a structure used as a parameter to a Win32API call Pin
Luc Pattyn1-May-12 15:20
sitebuilderLuc Pattyn1-May-12 15:20 
GeneralRe: Problem using a fixed length string in a structure used as a parameter to a Win32API call Pin
dmt19402-May-12 8:52
Memberdmt19402-May-12 8:52 
QuestionNumber comparisons in VBScript Pin
vanikanc30-Apr-12 10:56
Membervanikanc30-Apr-12 10:56 
AnswerRe: Number comparisons in VBScript Pin
Dave Kreskowiak30-Apr-12 14:18
mveDave Kreskowiak30-Apr-12 14:18 
GeneralRe: Number comparisons in VBScript Pin
vanikanc30-Apr-12 15:33
Membervanikanc30-Apr-12 15:33 
AnswerRe: Number comparisons in VBScript Pin
Midnight Ahri30-Apr-12 16:38
MemberMidnight Ahri30-Apr-12 16:38 
GeneralRe: Number comparisons in VBScript Pin
Dave Kreskowiak30-Apr-12 17:04
mveDave Kreskowiak30-Apr-12 17:04 
GeneralRe: Number comparisons in VBScript Pin
vanikanc1-May-12 3:34
Membervanikanc1-May-12 3:34 
GeneralRe: Number comparisons in VBScript Pin
Dave Kreskowiak1-May-12 5:03
mveDave Kreskowiak1-May-12 5:03 
GeneralRe: Number comparisons in VBScript Pin
vanikanc1-May-12 7:35
Membervanikanc1-May-12 7:35 
Questionwhy I lose data after chnage the code or add code Pin
romo2228-Apr-12 14:44
Memberromo2228-Apr-12 14:44 
AnswerRe: why I lose data after chnage the code or add code Pin
Wes Aday28-Apr-12 15:33
professionalWes Aday28-Apr-12 15:33 
JokeRe: why I lose data after chnage the code or add code Pin
Richard MacCutchan28-Apr-12 22:37
mveRichard MacCutchan28-Apr-12 22:37 
GeneralRe: why I lose data after chnage the code or add code Pin
Wes Aday29-Apr-12 3:19
professionalWes Aday29-Apr-12 3:19 
GeneralRe: why I lose data after chnage the code or add code Pin
romo2229-Apr-12 1:06
Memberromo2229-Apr-12 1:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.