Hello All,
All the APIs that I want to use for serial comms need a handle obtained from CreateFile. In Win95/98 CreateFiles only seems to apply to files so what do I use to get a handle.
I quote the platform SDK:-
CreateFile
The CreateFile function creates or opens a file, file stream, directory, physical disk, volume, console buffer, tape drive, communications resource, mailslot, or named pipe. The function returns a handle that can be used to access an object.
Windows Me/98/95: The file system restricts CreateFile to creating or opening files. You cannot create or open the objects that are identified in the first paragraph of this topic.
Regards Roger
CreateFile works for serial communications on Win95,98/Me. I have done it in the past.
I have an older PSDK (Feb 2001) and it does not list any restrictions for communication
devices on those Windows versions.
My February 2003 version of the PSDK list various restrictions for Windows 9x, but not for communication resources. This works OK under Windows 98SE:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
.data
hCom dd 0
.code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
invoke CreateFile, chr$("COM1"),
GENERIC_READ + GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL
mov hCom, eax
.IF eax == INVALID_HANDLE_VALUE
print "CreateFile failed",13,10
.ELSE
print "OK",13,10
.ENDIF
invoke CloseHandle, hCom
inkey "Press any key to exit..."
exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start
Roger,
Check the following site:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp
I have apps that use the SDK services exclusively, and they all work on 95/98/me/2000/xp.
You can use CreateFile for COMx and LPTx to access those resources!
hth,
farrier
Thank you for your help. I can now receive serial data - Next I must try transmiting it.
My SDK is from about 2005, perhaps by then Microsoft had become very pro-active in not suporting Win95
Regards Roger