问题
I am new to windows programming but have programming experience on linux platform.
Anybody can please clarify the following.
I need to install a modem in windows xp through c program or batch script. Modem i have is a serial modem.Whenever i connect the modem that is coming as a serial port.I have to install that modem using windows standard medem driver(Modem.sys).That i have done through control panel item "phone and modem" . But i want to do that installation using c program or batch script. Can anybody please give some suggestions? Or is that possible to create dial up connection without installation to connect to gprs network ?
回答1:
Perhaps the MSDN article How To Programmatically Install Modem Drivers which includes rhis call to runDll32.exe can help
rundll32.exe shell32.dll,Control_RunDLL modem.cpl,Modems, noui inf=c:\MyModem.INF sect=MyModem
The article is very old and references Windows NT version 4.0 but then again I'm not convinced you not a time traveler asking this question from the late 90's
回答2:
Look at this page : http://support2.microsoft.com/default.aspx?scid=kb;EN-US;Q304294
I encountered the same problem as you did, and I've succeeded with this solution on win7 64bit system. You should download source files from this page and compile it with WDK (I use WDK7.1) . Attention, the original source is compiled by DDK, and it will failed linking under WDK. So you should add one line to file 'SOURCES':
USE_MSVCRT = 1
When build passes, you'll get an executable 'mdminst.exe'. Then you could install any modem you want by CLI:
C:\> mdminst <modem-inf-file> <COM port> <HardwareID>
Ex. to install an standard 33600bps modem on COM1, the command is:
mdminst c:\windows\inf\mdmgen.inf COM1 mdmgen336
来源:https://stackoverflow.com/questions/7688048/how-to-install-standard-modem-in-windows-xp