⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wpw_wapi_serial_95.html

📁 VC programing
💻 HTML
字号:
<HTML>
<HR><A NAME=WINAPI_MY_WAY>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: How do I learn to program the serials program?</H4><PRE>

efj@winternet.com (Ed Jensen) writes:

>: Take a look at the "OpenComm", "ReadComm", "WriteComm" and "CloseComm"
>: APIs.

>: Chris

>This answer is a good start, but a little oversimplified...  There are a
>number of known bugs in the Windows 3.x implementation of communications.


I do this in the laziest way:

1) Open the cross reference database for WinSDK with my ixfwin program.

	*** You might have to <a href="../ixfw/ixfw.html">download </A>my program and build the database first.

	*** check my .sig for URL link to the ixfwin program.
	
2) Search for OpenComm, ReadComm, WriteComm, CloseComm identifiers.
	*** You should find them in the tty sample source files.
	
3) I browse the source code and find out how tty program uses these
   API, what's their parameters, how they are initialized, etc.
   
4) Understand how the tty program works and implement the similar thing
   in you program.  I usually copy and paste some code from SDK sample to 
   my program.

5) I finished adding RS232 class object to one of mine early project in 
   3 days with this methods, without knowing a thing about RS232 before.
   
   
-Tony Lee
Author of "Interactive Cross Reference for Win16/WinNT": A program that
lets you find any functions, macros, variables, etc in hundreds of files
instantly and interactively. http://www.kudonet.com/~ixfwin/ixfw/ixfw.html

I also organize useful Q&A from comp.os.ms-windows.programming.* in 
http://www.kudonet.com/~ixfwin/winprog_faqs/winprog_faqs.html

</PRE>


<HR><A NAME=WINAPI_SERAIL></A>
<H4>Serial Communications</H4>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<PRE>
Chris G Abbott <Chris@ruatha.demon.co.uk> wrote:
>
> Q: Is there a special way to access the serial ports from ms-windows
>    programs. I believe there is already a driver installed (the control
>    panel has a setup for them), so I would not have thought I would need
>    to setup an interrupt handler.
> 
>    Anyway, if there is a special way, I would like to know.
> 
> PS.  Using MS Windows 3.11 & Visual C++ V1.5
> 
> -- 
> God Bless
> 
> Chris Abbott
> ============================================================================
Yes, you must use the Comm API's of Windows.  They include OpenComm,
CloseComm, BuildCommDCB, WriteComm, ReadComm, SetCommState, FlushComm,
GetCommError, et cetera.
Eric Vanhove
evohnave@pixi.com
</PRE>


<HR><A NAME=WINAPI_COMMNOTIFY></A>
<H4>Subject: WM_COMMNOTIFY with no type</H4>
<PRE>
On Fri, 16 Jun 1995 00:16:18 GMT, bg283@FreeNet.Carleton.CA (Tadeusz Szocik) said in article <DA8or6.DLq@freenet.carleton.ca>:
>My app is receiving WM-COMMNOTIFY messages, with no type set; so they
>aren't of notify-status CN_EVENT, CN_RECEIVE or CN_TRANSMIT. This is
>immediately after some data is sent to the PC; a CN_RECEIVE message
>arrives, followed by about 10 of these funny messages with notify-status '0'.

This is a bug in the 3.1 comm driver.  You can ignore these messages.  For 
more information, see KB article Q101420.  This is on the MSDN-I CD, or you 
can find it on gopher:\\gopher.microsoft.com


--
Robert Mashlan             R2M Software Company           Programmer for Hire
mailto:rmashlan@r2m.com    http://www.csn.net/~rmashlan     PGP key available
Resources for Windows Developers    -     http://www.csn.net/~rmashlan/windev
Windows Developers FAQ    -    http://www.csn.net/~rmashlan/win-developer-FAQ
</PRE>




<HR><A NAME=WINAPI_MISC_XMODEM>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: Source for XModem protocol</H4><PRE>
Tore Nestenius <dt93tn@pt.hk-r.se> writes:

>I am in desperate need of a X-Modem source(Pascal, C or C++) or 
>as a DLL.

>Please email me if you know any good one.




Greenleaf, for very many years, has been shipping a communications library
which supports XMODEM and some Kermit, I think.  I've certainly used their 
XMODEM implementation.  I found it robust and efficient.

.B ekiM

<HR>

>   Tore Nestenius <dt93tn@pt.hk-r.se> writes:
>  I am in desperate need of a X-Modem source(Pascal, C or C++) or 
>  as a DLL.
>>>>


Check out the SilverWare Windows Communications Tool Kit.  Supports X/Y/Z modem ans is 
compatible with over 11 different languages.  Complete documentation for all the languages.
 
SilverWare Inc. phone number is (214) 247-0131

Good Luck.

</PRE>

<HR><A NAME=WINAPI_SERIAL_RING_DETECT>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: Ring Detect in Win16</H4><PRE>
In article <mcohan.803624206@crash.cts.com>,
   mcohan@crash.cts.com (Max Cohan) wrote:
>I need to access the 'Ring Detect' bit when talking to
>a probe connected to a serial port...
>
>Win32 provides a couple of ways to do this quite nicely
>(In fact, suprisingly well) However I need it to work
>under straight 16-bit windows... How in the world do
>I do this using plain Windows 3.1 functions?

This is a semi-documented "feature" of Win 3.1.  You have to peek at a byte 
in memory that contains a copy of the UART status register.  You find it 
using SetCommEventMask():

  char FAR * modem_status_register;
  modem_status_register = (char FAR *) SetCommEventMask(handle, 0);
  modem_status_register += 35;

You can now use modem_status_register to get the UART status.  The event bits 
match the EV_ constants -- EV_RING for the ring indicator, for instance.


      /
  /  *  /  Alan Hamilton
 *     *   alanh@primenet.com
</PRE>


<HR><A NAME=WINAPI_SERIAL_Modem_DETECT>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: How to detect if the modem is on a serial port?</H4><PRE>
>>To detect presence, open a port, and send AT. The modem must respond OK 
>>in the second.

The modem must respond 'OK' _or_ '0'!  Modems can be configured to answer with digit codes 
instead of alpha ones.

(I worked with a modem that wouldn't change to alpha codes and that's when I learned how many 
programs insist on them... Don't make that mistake)
</PRE> 

</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -