|
You can use CreateFile to open the com port and write to it as you would write to a file
Here is a Link to a wonderfull sample on serial communication with sample code
Hope it helps
Mttty Sample[^]
Data arrival can be handled as an event , so that you know whenever data arrives on com port
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
you simply use
CreateFile (.....) and WriteFile(....)
(one of the parameters will be your COM port)
read the MSDN for the correct parameters....
hope this helps ya
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi:
In my programme,I use some classes in a dll.When I try to compile it, VC give out such errors:
error C2487: 'classCWinAppEx' : member of dll interface class may not be declared with dll interface
error C2487: 'classCMyMenu' : member of dll interface class may not be declared with dll interface
(CWinAppEx and CMyMenu are declare and implemented in the dll)
and all these errors are point to the line "DECLARE_DYNAMIC( CWinAppEx )" or "DECLARE_DYNAMIC( CMyMenu )". I look up this error in MSDN, but didn't find the solution.Could anyone give me some idea?
Thanks
Benben
|
|
|
|
|
try to use __declspec(dllexport) while declare class
Exa:
#define EXT_CLASS __declspec(dllexport)
class EXT_CLASS ClassA : public X
{
...
};
|
|
|
|
|
Thanks.I have used this macro in the dll. And thses errors only occour when I try to compile one certain file(when I compile the other files, VC doesn't give out these errors).
Thanks
Benben
|
|
|
|
|
and I find that these errors only occur when the cpp files in EXE project have such line:
#undef AFX_DATA
#define AFX_DATA AFX_DATA_EXPORT
Maybe it conflict with the static functions or something else in the dll.How to resolve this problem? Could anyone give some idea?
Thanks
Benben
|
|
|
|
|
hey ppl i've been getting this wierd error when i try to add an event to the the activeX control as soon as i hit the add event button it says "Error adding a(n) event to the associated class" anybody know how to correct this?
thanks
|
|
|
|
|
hello all,
I need help.
I have three NIC (Network Interface Card) in same Machine (PC) they connected to network with same subnet mask and gateway address
how to get the second or next IP address with Visual C++ ?
thank u
Tripey
|
|
|
|
|
You will have to enumerate all devices here is a link for some sample code hope that helps
Click ME[^]
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
How I can put my icon on Pushbuttons.
|
|
|
|
|
Here is a link to an article on codeproject might come in handy
Click ME[^]
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
Here's another article:
http://www.flounder.com/bitmapbutton.htm
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Does anyone know of an algorithm to calculate a complementary text color given a background color? By this I mean a text color so that the text can easily be read. I've scoured the Web but have not come up with anything useful.
I have low vision, and have difficulty reading the text on some of the controls being developed in my company where the text and background color don't contrast enough. If colors are hard-coded, there will always be some color scheme for which this will not work.
Any suggestions will be much appreciated.
Mihaly Zsadanyi
|
|
|
|
|
IMO all controls should use the system colours for their backgounds and text, that way the user can choose whatever colour they are most comfortable with. Use COLOR_WINDOW or COLOR_3DFACE for backgrounds, and COLOR_WINDOWTEXT or COLOR_BTNTEXT for foregrounds. Any other combinations may look cool, but are disrepectful of the end user.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I'm using Visual C++ to program an application that reading from a .txt file at some time interval, let's say 10 seconds.How can i do this? Please help me. Thank you.
|
|
|
|
|
You have to Set a timer via . SetTimer function
then in the Timeout Handler Read the txt file (use CFile )
if you have a Dialog based Application
then in OnInitDialog
SetTimer(1,10000,NULL);
add handler for WM_TIMER event (via Class Wizard)
..... OnTimer(UINT nIDEvent)
{
}
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
Hi,
I need to use USB to interface between a hardware and PC. What command/tool should I use? Any sample code?
|
|
|
|
|
I don't realy know USB,but I think the hardware should provide that tool or the driver lib.
Thanks
Benben
|
|
|
|
|
Hi,
What is the difference between using CClientDC to draw graph and using CDC?
|
|
|
|
|
basicly nothing. The only difference is that CClientDC calls GetDC() on the supplied window in it's constructor, and calls ReleaseDC() in it's destructor. It just saves you some typing and debugging time.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I had create a SDI with database. How do I maximize the dialog permanently?
I drawed some pictures on the dialog. When I maximize the dialog, there's a assertion error. What should I do?
|
|
|
|
|
|
hi,
I want to convert the string '\device\harddiskvolume1\windows\..' to the path 'c:\windows\..'
I get that string from the registry. I can replace the string
'\device\harddiskvolume1' to c:
'\device\harddiskvolume2' to d:
etc.
But I doubt there is a much better way using some API.
Can anyone please help ?
regards
hari
Hari Krishnan
|
|
|
|
|
How can i get the path of my dll on disk from within that dll?? Like.. a program loads my dll as a plugin but the dll itself doesnt care where it is. Is there a way to get the path to the dll from within the dll code?
Thanks
Kuniva
--------------------------------------------
|
|
|
|
|
Kuniva wrote:
but the dll itself doesnt care where it is
I wouldnt say that was 'accurate' .. there's a set path windows uses to locate dll's .. from memory, its (very roughly), assuming NT for the moment
1) The directory the calling exe was loaded from
2) C:\winnt
3) C:\winnt\system32
4) The Contents of the PATH Environment variable
so the dll has to be 'somewhere useful' .... so you could use the file find functions ... checking that the above list was accurate, of course ...
As far as I recall, the info isnt stored 'within' a dll... The only other way may be to enumerate processes and maybe the process stack shows where it was loaded from - www.sysinternals.com has some tools that may demonstrate this .. but thats way complex !!!
Most 'plugin' factories to use a better word should have a configurable parameter that says, 'my plugins are in here' and not assume they are anywhere, imho ..
hth
|
|
|
|