Sign in to follow this  
Followers 0
Lecdev

KernelCommUDF - Communications Device Resource Management

3 posts in this topic

#1 ·  Posted (edited)

I got sick of having to include extra and large DLLs in order to do serial communications on com ports (which I actually do allot of)

So... I have written my own UDF which only requires kernel32.dll to manage communications resources, mainly for serial port communications but I did put the option to open parallel ports in there too (dont have anything to test that on but as far as I can tell it should work)

This should work on any windows from xp/server03 up until whenever microsoft stops using the kernel32 dll. (I think actually allot earlier  than xp but msdn is saying xp just cause they can)

With this udf you can create handles to the ports, open them, communicate with them, clear them, update their settings, refresh them, close them and list them showing which ports are in use.

If anybody finds something wrong with it let me know.

... It will console write errors and allot of debug info if @compiled = 0.

This is it --> KernelCommUDF.au3                         (v1.1, added a function)

Hope its helpfull. :)

Edited by Lecdev

Share this post


Link to post
Share on other sites



Well that uses some of the same kernel functions yes, but is just not nearly complete and was easier for me to start again than edit that one and then finish it.

with this one, full understandable control of port setup bits, serial and parallel, error checking, ascii code and ansi tranceiving, buffer que checking, support for comunicating null characters, available port listing, byte array support etc etc

heres a list of the functions;

; #CURRENT FUNCTIONS# ===============================================================================================================
;    _AddCommResourceChannel()
;    _CommResourceUpdateChannel()
;    _CommResourceReadASCII()
;    _CommResourceReadASCIIArray()
;    _CommResourceSendASCIIArray()
;    _CommResourceReadChar()
;    _CommResourceReadLine()
;    _CommResourceSendLine()
;    _CommResourceClearBuffer()
;    _RefreshCommResourceChannel()
;    _CommResourceBufferQues()
;    _CloseCommResourceChannel()
;    _CloseAllCommResourceChannels()
;    _LastErrorMessage()
;    _ListSerialPorts()
;    _ListParallelPorts()

and more to come in not too distant future as I myself I think will be needing event handling and some other functions for some of the stuff I have to do :think:

:)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0