okay... anyone know if the .NET framework supplies any namespaces and classes that provide an easier way of enumerating modem devices into a list, and communicate with a remote server using serial communication, instead of me having to use TAPI and all sorts of goofy platform SDK stuff?
There's nothing in VB .NET to support serial communications.
MS has a sample application on MSDN, where they create a class that uses API. That class can easily be customized and used.
Try searching there.
Also, if you download and install VB .NET Resource Kit, you actually get a free RS232 control from SAX.
All you need to do, to download the resource kit is to register your version of VB. (All versions, incl. Standard)
Follow this link : http://msdn.microsoft.com/vbasic/vbrkit/
There is also a lot of other controls. You actually get controls worth 10 times more than VB .NET Standard itself.
Hope this is of any help to you.
Good luck.
I wish I could think of something witty to put in my sig...
Hmmmm, yes, communicating via the serial port won't be a problem I guess. This resource kit is huge. Takes a long time to download with my little 56k modem. heh.
I actually need to list the modems installed, and also detect which port they're connected to. I see rasapi32.dll has many to offer, but I can't seem to find a way in it, that can show me which port the modem is connected to. All this nifty configuration settings must be stored in the registry somewhere. And if it is, it must be a standardized location, though different for each OS version (9x, ME, NT4, 2K, XP, etc.)
You are right that it must be somewhere in the registry.
I don't know where though.
But if you have a modem installed, you could use the regedit to search for the modem name. Then you should find where modems are registered. Even better if you have more than one modem installed. Then you should be able to figure out the structure of the registry settings.
I did a similar search on a project where I needed to figure out which comm.ports where installed, so my user would be able to select between all available comm.ports
Hope this helps.
Good luck.
I wish I could think of something witty to put in my sig...
The information you need may be found at some places in the registry including HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class
Each class (Default) value represents the type of devices under that class, for example
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96E-E325-11CE-BFC1-08002BE10318}
represents Monitors in my machine. Ofcourse this is XP, I don't know about others, but should be more or less the same.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
Thanks Ken and Mike. I can detect the OS version with ease, and use the appropriate method. This one method will probably work for Win 2K, XP and up. Now we have to find the other one.
There is one other problem I just realized that I will have... I can't just assume that a user's modem will be connected via a COM port. What about those that use USB modems. Will I still be able to use serial communication? From what I've heard, USB uses "serial" transmission, but I guess it differs a bit from RS232. It looks in the end like I will have use the "goofy" stuff.
As in the article link posted earlier, it seems that the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96D-E325-11CE-BFC1-08002BE10318}IS exactly the location that the WMI class exploits when enumerating modem devices into a list in Win32 NT based systems (NT4, 2K, XP, Server 2003).
I don't have Windows 98 or ME. Can anyone with Win 98 or Win ME please tell me what values they can find under HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\Modem\0000? Is there any value like "AttachedTo"?
Wait ... I may be wrong about that PortSubClass. The same entry exists on Win32 NT systems. If this value is used on them, then why would they need two values for the same purpose? This value must be something else then.
However... If this value IS used to indicate the port number, then 0x02 probably indicates... COM3? 0x00 for COM1, 0x01 for COM2, etc. Or maybe it IS the port address? Highly unlikely. Or maybe the port address in the "subclass"?
In the event that this value is used to indicate the port number, I can test if it is serial by studying at the PortDriver entry. Perhaps, the modem configuration settings are always expressed in serial comm port expressions, except for the driver. And if the modem uses the USB port, then the OS might "bridge" these two differences by using some sort of "redirection" or something, if you know what I mean.
These are just questions and possibilities raised in my mind, because I don't know exactly how these things work. If anyone out there has the answers, wouldst thou care to lend a hand ??
Originally posted by Mike Hildner jovton, are you "delimiter" on microsoft.public.dotnet.language.vb? If not, then someone is asking the same questions you are
Like... wanting to find the registry entries for modem port on 98, and c# or vb.net code is most welcome... and something like... someone feels sorry for me, and has the same problem, thinking its pretty poor... and had a previous newsgroup post, something about www.sealevel.com, and something about an internal network with site called www.ionetworks.com, and something about a one handed man and a ken tucker?
Booted up that 98 machine again and started to look at the registry settings. I saw "DCB" and that stirred up old memories, but alas, as interesting it is, it has nothing to do with your port (AFAICT).
The system actually opens up a "file" when you open a com port, which needs your DBC struct and a file name - e.g. COM1. Made me think it must be stored elsewhere.
Now I'll get to the point. My "InfPath" name in the registry has as it's data "3COM3C~1.INF". My modem is on COM5. Open up this file and the only instance of COM5 I see says:
Hmmm, well... I have a Lucent Win Modem. But, my modem .inf file "mdmlt3.inf" contains absolutley nothing about any ports, and my modem is connected to COM3. *sigh*
Dang, that's too bad, thought we had something there. Wonder if there are any Win 98 groups around - probably starting to get off topic for VB.NET now. I know there are some Win 2000 groups out there - someone's gotta know how this is done.
Guess what... I succeeded, where it involves "serial port" based modems, and that includes internal modems. I still have to figure out USB stuff though.
And don't worry about going off topic. I'm developing a .NET class now for this. Let me try to explain how I figured this out.
Okay... first things first: To absolutely make sure that our chances are good at finding modems, we must install WMI 1.5 or later on all 98 and NT4 computers (I heard ME already has it), and also install any other .NET prerequisites, then .NET framework (duh.... ). Okay, with that said, let's begin.
I figured that external COM port connected modems, also exports a registry entry named: "AttachedTo". If this value is missing... then we have two options... Assume this is an internal modem, or, check to see if it is internal, and if not, then this modem is installed, but were not detected at startup, and is therefore either disconnected from the port, or powered off. Plainly said: The modem is not present at present . Right....
All modems under HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Class\\Modem export a "MatchingDeviceID" setting. With this info, we can go and look for additional settings on this device.
All we do now, is, check HKEY_LOCAL_MACHINE\\Enum\\PCI and HKEY_LOCAL_MACHINE\\Enum\\ISAPNP for ID's containing the MatchingDeviceID, and that includes subkeys and values. When a key is found, look for a value called "PORTNAME". And there you have it !!
The amount of explaining I need to do is too much. What I'll do is, I will attach my partly developed class here. If you get any ideas, or wish to help out, we'll all be most greatful.
P.S. Please excuse my coding style. I was a bit lazy and hasty.
Hope I don't double post here, little glitch the first time.
I don't have access to any USB modems, so can't help there. Wish I had thought of this before, but maybe a tool like regmon from Sysinternals might help. I've used it in the past, wish I had thought about it before pouring over the registry.
Anyway, Sysinternals has some really cool, free stuff.
And, I must say, I think what you're doing is very cool. I'm amazed at how .NET allows one to build (just about?) anything that is not built in. Kudos to you, friend, rock on.
Alright, here's the beta version, if I may call it that. I also updated the previous post's attachment.
It works a little different now. Now the class does not assume that the modem is internal, when it cannot find the "AttachedTo" property. It now looks for a port setting in both registry locations.
The reason USB bothers me is because of daisy chaining and serial communication. This class might even enumerate USB modems, but they apply "ports" differently than COM port modems, so it might incorrectly return "<Modem Not Present>" when it enumerates USB modems.
Can I ask someone with an ISA or USB modem to test this for me please? I only have an PCI and External modem on the COM port.