|
Thanks for advice. I will have to look into the TAPI. I would prefer to work in VB or VB.NET. The application is really supposed to be a GUI that let the operator here voice mail and exercise the options in the voice mail. I do not think we are going to be supporting any sort of database. We are dialing the voice mailbox, sending the tones through the phone line, for example if the option is press 2 for "To Reply to this Message" the user could click a button for reply and the software would send the tone for two. I think we can get by with only supporting windows 2000 or XP.
|
|
|
|
|
|
THANKS! I have never seen that gotdotnet site before, I think I may start spending some time there. I think TAPI is definetly the way to go, (assuming I have a modem that supports TAPI). Does anyone know of any good books or websites that detail the TAPI functions?
|
|
|
|
|
Ok, I am halfway done for implementing my telephony application and I encountered a major problem. I am using a ZOOM USB Modem and was stunned to learn that it is half duplex. When I dial the phone, and the voice mail answers I can set tones and transmit voice, but I cannot hear what is going on at the other end. How do I switch from a send state to listening state?
|
|
|
|
|
In vb6 there was a drive list box & a dirlistbox showing familiar drive & folder structure in tree form, not so in vb.net
I need users to select a folder, then I will get all files in that folder to an array,
theopen file & save file dialog boxes are visually what I want but not their functionality, ie I dont want user to open a file or save a file, just get them to select a folder for which I can save the folder name & get it's files
thanks fo nay constructive help/suggestions
44Class
|
|
|
|
|
|
Check this link. A good example of using dirListBox, DriveListBox in VB .NET. Very easy to implement. Cheers
http://www.dotnetjunkies.net/tutorials.aspx?tutorialid=392
Zulfikar Ali
|
|
|
|
|
I was reading the latest MSDN article that talks about VB.NET performance issues and saw the following paragraph:
Object Collections and Object Arrays
When you have a set of related objects that you handle similarly, you can put them in an array of objects, or you can create a collection with the objects as members. The following considerations can help you choose between these schemes:
* An array of objects is faster if you always traverse it sequentially. For random access, an array can be slightly faster.
* Insertions and deletions in a collection are equally fast regardless of the position of the elements. Insertions and deletions in an array are only possible at the end of the array.
* If the number of objects in the set changes significantly over the lifetime of the set, it is much less complicated, and therefore faster, to use a collection.
I am bugged by the first bullet point here... Sounds very wrong to me...
|
|
|
|
|
Ray Cassick wrote:
An array of objects is faster if you always traverse it sequentially. For random access, an array can be slightly faster.
Evidently an array is faster either way.
I'm thinking the Collection will be faster for random access, but I wouldn't swear to that.
Paul
|
|
|
|
|
Ray Cassick wrote:
An array of objects is faster if you always traverse it sequentially. For random access, an array can be slightly faster.
Correction:
Collections are usually implemented using linked lists. Both linked lists and arrays provide fast sequential access. But for random access, arrays are faster.
"In an organization, each person rises to the level of his own incompetence." Peter's Principle
|
|
|
|
|
Hi,
I write a small class to access to database. This class is refered in two project which are in the same solution.
In Project2, I call a class in Project1 which contain a method that need in parameter my DBClass.
All was ok still this week. Now everytime I compile the solution, I get the following error :
error BC30311: Value of type 'InfoDB.DataAccess' cannot be converted to 'InfoDB.DataAccess'.
Where should be the matter ?
Thx for help.
Sybux
|
|
|
|
|
Try first coping this file elsewhere (thru' windows explorer) then delete it from your project and add it.
Just give it a try.
|
|
|
|
|
I've already try this. I even deleted all file named as my DLL and it's still not working
|
|
|
|
|
Hi,
I'm having a problem for the first time: I open visual studio .net and the start page is shown, then, if I click any of the links that need an internet connection, I get this message: "This feature requires that you have connected to the internet previously or are currently online". Which is impossible, because I have a cable connection, so... I'm always online....
This problem start happening when I tried one of those "Speed Up Your Computer and Internet Connection" programs (you know, just to see how it works)... the name of the software is "Dr. Salman's Windows Power Tools 4.0".
I've been checking and unchecking for some days now, but I just can't get it to work right!
Thanks...
|
|
|
|
|
I have declared 'NetServerEnum' function in module as follows;
Public Declare Function NetServerEnum Lib "netapi32.dll" ( _
ByVal servername As String, _
ByVal level As Integer, _
ByRef buffer As Integer, _
ByRef prefmaxlen As Integer, _
ByVal entriesread As Integer, _
ByVal totalentries As Integer, _
ByVal servertype As Integer, _
ByVal domain As String, _
ByVal resumehandle As Integer) As Integer
when i call it, i get an error saying
"Object reference not set to an instance of an object."
Can anyone help me out?
Thanks in advance.
|
|
|
|
|
The error message usually means that the declaration is wrong, i.e. passing arguments ByVal instead of ByRef.
The C++ declaration is:
NET_API_STATUS NetServerEnum(
LPCWSTR servername,
DWORD level,
LPBYTE* bufptr,
DWORD prefmaxlen,
LPDWORD entriesread,
LPDWORD totalentries,
DWORD servertype,
LPCWSTR domain,
LPDWORD resume_handle
);
In VB.NET, this translates to:
Public Declare Function NetServerEnum Lib "netapi32" ( _
ByVal ServerName As IntPtr, _
ByVal Level As Integer, _
ByRef Buffer As IntPtr, _
ByVal PrefMaxLen As Integer, _
ByRef EntriesRead As Integer, _
ByRef TotalEntries As Integer, _
ByVal ServerType As Integer, _
<MarshalAs(UnmanagedType.LPWStr)> _
ByVal Domain As String, _
ByVal ResumeHandle As IntPtr _
) As Integer
You then call it as:
...
Dim EntriesRead As Integer = 0
Dim TotalEntries As Integer = 0
Dim Buffer As IntPtr = IntPtr.Zero
Dim nRes As Integer = NetServerEnum( _
IntPtr.Zero, _
Level, _
Buffer, _
-1, _
EntriesRead, _
TotalEntries, _
ServerType, _
DomainName, _
IntPtr.Zero _
)
Try
'Do some stuff here
...
Finally
'Clean up buffer
If Not(Buffer.Equals(IntPtr.Zero)) Then
NetApiBufferFree(Buffer)
End If
End Try
|
|
|
|
|
Thanks it works fine.
what do i need to do to use netapi32.dll in win9x/NT.
More help please.
Thanks.
|
|
|
|
|
NB: Please post any responses to the forum, so that other users get the chance to answer them!
Vipul Bhatt wrote:
Thanks a lot.
It worked.
Can you please tell me how i point to next memory location as
TempBufPtr = TempBufPtr + SIZE_SI_101
gives me an compile time error saying datatype conversion error where
TempBufPtr As IntPtr AND
Public Const SIZE_SI_101 = 24
Thanks in advance.
Also where can i find info about these API functions as i was unable to find the correct declaration info.
THANKS ONCE AGAIN.
To move an IntPtr in VB.NET, you need to re-create it:
TempBufPtr = New IntPtr(TempBufPtr.ToInt32() + SI_SIZE_101)
The best place to find information about any API is MSDN:
http://msdn.microsoft.com/[^]
Also, take a look at this article, which makes extensive use of the NetServerEnum function:
http://www.codeproject.com/csharp/ServerComboBox.asp[^]
|
|
|
|
|
Thanks Richard. Great help.
Can U pls. tell me how can i use the RtlMoveMemory in VB.NET and also do i need to convert pointer to string later. If yes please tell how do i do that.
I tried using marshal.PtrToStringUni but in vain.
hope i will get similar response as earlier.
Thanks in advance.
|
|
|
|
|
Vipul Bhatt wrote:
tell me how can i use the RtlMoveMemory in VB.NET
Don't! For most cases, using the MarshalAs and StructLayout attributes will be sufficient. In cases when these don't work, the Marshal class provides functions to convert between managed types and IntPtr s.
For example:
Imports System.Runtime.InteropServices
'
Public Enum PlatformID
DOS = 300
OS2 = 400
NT = 500
OSF = 600
VMS = 700
End Enum
'
<Flags> _
Public Enum ServerType
None = &H00000000
Workstation = &H00000001
Server = &H00000002
SQLServer = &H00000004
DomainController = &H00000008
DomainBackupController = &H00000010
TimeSource = &H00000020
AFP = &H00000040
Novell = &H00000080
DomainMember = &H00000100
PrintQueue = &H00000200
Dialin = &H00000400
Xenix = &H00000800
Unix = Xenix
NT = &H00001000
WFW = &H00002000
MFPN = &H00004000
NTServer = &H00008000
PotentialBrowser = &H00010000
BackupBrowser = 0x00020000
MasterBrowser = &H00040000
DomainMaster = &H00080000
OSF = &H00100000
VMS = &H00200000
Windows = &H00400000
DFS = &H00800000
ClusterNT = &H01000000
TerminalServer = &H02000000
DCE = &H10000000
AlternateXPort = &H20000000
ListOnly = &H40000000
DomainEnum = &H80000000
All = &HFFFFFFFF
End Enum
'
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> _
Public Structure SERVER_INFO_101
'
Public dwPlatformID As PlatformID
'
<MarshalAs(UnmanagedType.LPWStr)> _
Public lpszServerName As String
'
Public dwVersionMajor As Integer
Public dwVersionMinor As Integer
'
Public dwType As ServerType
'
<MarshalAs(UnmanagedType.LPWStr)> _
Public lpszComment As String
End Structure
In this case, fields of type DWORD map to Integer s, or Enum s based on Integer (the default). Fields of type LPWSTR map to String s with the MarshalAs(UnmanagedType.LPWStr) attribute.
Then, assuming TempBufPtr is an IntPtr pointing to the current item, you can use:
Imports System.Runtime.InteropServices
...
Dim tS As Type = GetType(SERVER_INFO_101)
Dim currentItem As SERVER_INFO_101
currentItem = DirectCast(Marshal.PtrToStructure(TempBufPtr, tS), tS)
Dim ServerName As String = currentItem.lpszServerName
No need to call RtlMoveMemory , no need to convert pointers to strings!
For more information on marshalling between managed and unmanaged code, have a look at http://msdn.microsoft.com/library/en-us/cpguide/html/cpconmarshalingdatawithplatforminvoke.asp[^]
|
|
|
|
|
It worked
A BIG THANKS RICHARDS.
Great help.
God bless you.
|
|
|
|
|
Thanks Richard,
only one change required:
currentItem = DirectCast(Marshal.PtrToStructure(TempBufPtr, tS), tS)
Just replace tS with Object as below
currentItem = DirectCast(Marshal.PtrToStructure(TempBufPtr, tS), Object)
A big thanks to you.
|
|
|
|
|
A VB code snippet that uses RegEnumKeyEx runs OK on Win'98 (the function returns ERROR_SUCCESS) but fails on WinXP! Any ideas?
Thanks in advance,
Stefan B.
|
|
|
|
|
Try this, it works on WinXP:
Const ERROR_NO_MORE_ITEMS = 259&
Const HKEY_CURRENT_CONFIG = &H80000005
Const HKEY_LOCAL_MACHINE = &H80000002
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, ByVal lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As Any) As Long
Private Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Private Sub Form_Load()
Dim hKey As Long, Cnt As Long, sName As String, sData As String, Ret As Long, RetData As Long
Const BUFFER_SIZE As Long = 255
'Set the forms graphics mode to persistent
Me.AutoRedraw = True
Me.Print "RegEnumKeyEx"
Ret = BUFFER_SIZE
'Open the registry key
If RegOpenKey(HKEY_LOCAL_MACHINE, "Hardware", hKey) = 0 Then
'Create a buffer
sName = Space(BUFFER_SIZE)
'Enumerate the keys
<font color="red">
While RegEnumKeyEx(hKey, Cnt, sName, Ret, ByVal 0&, vbNullString, ByVal 0&, ByVal 0&) <> ERROR_NO_MORE_ITEMS
'Show the enumerated key
Me.Print " " + Left$(sName, Ret)
'prepare for the next key
Cnt = Cnt + 1
sName = Space(BUFFER_SIZE)
Ret = BUFFER_SIZE
Wend
</font>
'close the registry key
RegCloseKey hKey
Else
Me.Print " Error while calling RegOpenKey"
End If
Me.Print vbCrLf + "RegEnumValue"
Cnt = 0
'Open a registry key
If RegOpenKey(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion", hKey) = 0 Then
'initialize
sName = Space(BUFFER_SIZE)
sData = Space(BUFFER_SIZE)
Ret = BUFFER_SIZE
RetData = BUFFER_SIZE
'enumerate the values
While RegEnumValue(hKey, Cnt, sName, Ret, 0, ByVal 0&, ByVal sData, RetData) <> ERROR_NO_MORE_ITEMS
'show data
If RetData > 0 Then Me.Print " " + Left$(sName, Ret) + "=" + Left$(sData, RetData - 1)
'prepare for next value
Cnt = Cnt + 1
sName = Space(BUFFER_SIZE)
sData = Space(BUFFER_SIZE)
Ret = BUFFER_SIZE
RetData = BUFFER_SIZE
Wend
'Close the registry key
RegCloseKey hKey
Else
Me.Print " Error while calling RegOpenKey"
End If
End Sub
Nick Parker
The goal of Computer Science is to build something that will last at least until we've finished building it. - Unknown
|
|
|
|
|
Many, many thanks!!!!
It's (almost) tha same code snippet I have played with, but I insisted to open HKEY_LOCAL_MACHINE\Enum (as in APIGuide's example), subkey that doesn't exist in WinXP, and when I noticed that, I forgot to restore some other unsuccesfull hacks
best regards,
stefan b.
|
|
|
|
|