|
I think you can use GetCommModemStatus[^]. I think I was wrong, you have to check for the DSR (Data Set Ready) line, not the DSR (I always mix them).
|
|
|
|
|
Is there any other alternative..?..i have tried used GetCommModemStatus function..its returning false..even if..the instrument is switched on..
|
|
|
|
|
Did you pass the correct handle ? After the port has been opened ?
RockyJames wrote: Is there any other alternative..?..
Yes, as I said previously: send something to which your device is supposed to answer. If you don't receive an answer, then the device is not connected or switched off.
|
|
|
|
|
yeah i have sent..correct handle..i have opened port it in OVERLAPPED MODE..i am using WaitForSingleObject function..when i write data ..its able to write..when i start reading the data..it is getting stucked..at WaitForSingleObject function..
|
|
|
|
|
thank`s for u r support..issuse is closed..i have done..with the commtimeout....
|
|
|
|
|
As Cedric Moonen already said, you can check the DSR signal.
In addition you should raise the RTS (Request To Send) signal and check for the reply from the device, CTS (Clear To Send). If you get a transition from Off to On in the CTS line, you can be pretty sure the device is powered on.
For the serial communication, i suggest you use a serial commuinications library, the are some good ones here at CP.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
hi friend ,can u be more clear.. before ReadFile..i want to know whether system is ON or OFF..can u pls suggest..me the function names to use..
thanks in before
James
|
|
|
|
|
Hello.
The problem with detecting serial devices is that the serial port very often can have a random status when the serial port is unconnected.
I.e. the DSR signal can be in it's "On"-position even when the serial port isn't even connected! (It depends on the hardware).
The only reliable way of detecting if:
1.
There *is* a device conncted.
2.
The device is powered on.
is to catch a transition on one (or more) status lines. An easy way is to ask the device if the PC (Data Terminal) may send data to the DS (Data Set).
If the DS raises it's Clear To Send signal, then the PC(DT) may send data to it.
Check out MSDN for the documentation, http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/dcb_str.asp[^]
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
thank`s for u r support..issuse is closed..i have done..with the commtimeout....
|
|
|
|
|
How to set a font to application menu; say I've a CFont object & a CMenu ptr..?
Thanks in advance
--
======
Arman
|
|
|
|
|
if you have a derived CMenu class you can change your font on WM_DRAWITEM
|
|
|
|
|
free library (or code) in C++.
|
|
|
|
|
By 'free' do you mean "other peoples hard work so I can be lazy"? or free as in "I don't want to pay even the the author would like a small donation"?
|
|
|
|
|
Just tell me where, pay or free library. I'll consider that I should pay or not later.
|
|
|
|
|
what is source code for email system in Java script
|
|
|
|
|
please don't feed the troll.
Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
My son's PDA is an M249 SAW.
My other son commutes in an M1A2 Abrams
|
|
|
|
|
Why don't you ask someone who knows? This is the Visual C++ / MFC discussion board, in case you haven't noticed.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
This is a VC++ forum.wrong
|
|
|
|
|
Hello
Can anyone give me a little short description of the different shortings in visual C++,
And maby give me an example of what they are?
ATL, CLR, GENERAL, SMART DEVICE, WIN 32 APPLICATION..
Thanks for answer
Regards
|
|
|
|
|
shortings ?
Where did this list come from ?
ATL is the Active Template Library, for COM
CLR is the .NET framework, C++/CLI apps
When the General talks, you better listen to him
A smart device is a device that is smart, such as a scientific calculator, or a handheld windows device.
Win32 is what all our apps really are, a Win32 app would be an app that doesn't use the CLR, or MFC, it uses the Win32 API directly.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: shortings ?
When you are longing for something, that means you really want it. When you are shorting for something, I guess that means you don't really want it.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi Christian
Thanks for the replay
The reason why i need this information is that i am a chiptuner, that program my own software for car,
and now im going to make software that communicate with the cars mcu..
The language it self is one thing im reading on at moment, but my problem is mostley to know when to use the different settings in visual studio.
The normal standard communication protocoll in car is KWP2000,
I have seen that, many of these communication interfaces that i have uses dll, but i guess i can start building a win32app, that can communicate through an usb-interface, to cars mcu?
Any suggestion where to start?
Regards
Frank
|
|
|
|
|
If you want an app running on your PC, which then talks to the car via some communication protocol, you may want to look at using MFC. However, even C# is probably OK on the PC side, the key thing is getting the software right on the car end, which will probably be in C.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
oki, so then i maby use the mfcapp or mfcdll?
REGARDS
Frank
|
|
|
|
|
If you want to write a windows application, then MFC is easier than Win32. A dll is not a program, it's a library. If you want a program that runs, you need to create an exe.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|