|
Never done it but using Google I found a programming manual for a specific USB device[^].
3.0 Overview
To communicate with USB IO Driver one must first enumerate the
device. The enumeration of the device returns a device name. This
device name is used to open the interface, using CreateFile(). Once
you have the handle from CreateFile() you can use DeviceIOControl()
to communicate to the USB IO Device and CloseHandle() to close it.
The hardest part is getting the device name the rest is simply. To send
commands to the USB IO device simply build a command packet and
submit it using the DeviceIOControl functions.
|
|
|
|
|
|
To complete what Led Mike said: in that specific case, when you want to communicate between your PC and a micro-controller, you should have received documentation from the supplier of the micro-controller. What you need to pass to the DeviceIOControl should be described there.
There is no way for us to tell you what you need to pass to the function because it is specific for the micro-controller you bought.
|
|
|
|
|
What about serial port (COM1) ?
Which API functions or MFC classes can be used for communication via serial port ?
plz help ....
Apurv
|
|
|
|
|
In fact you can often use the serial port or a USB to serial converter to communicate with such devices. Usually it turns out to be simpler. The (raw) communication API are CreateFile , WriteFile , and so on
(searching MSDN you can find complete examples about). You may also use the MSComm ActiveX control inside your MFC application.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Hello guys,
I've the following problem: I want to declare a variable and set its value in a windows form outside a function, but when I buid the the project, the following error occurs: "error C3845: only static data members can be initialized inside a ref class or value type".
Declaring the variables as static works but when I want to declare an array, that doesn't. It's not possible to declare the class as non-ref-class.
Does anyone have an idea how to manage this?
Thanks for your help, and best wishes.
|
|
|
|
|
Austrian_Programmer wrote: Declaring the variables as static works but when I want to declare an array, that doesn't.
How about showing us your code that is not working?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I strongly recommmend you move this post to the C# forum before toxcct gets hold of it...
Is that the sound a flame thrower warming up [duck]...
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Your code is managed or unmanaged?
|
|
|
|
|
Thanks for your help, I found a solution to the problem: I declare and define the variables in the InitializeComponents() function.
By the way, does anyone know a tutorial for visual c++ windows forms using the windows forms project type of VS.NET?
Thanks and best wishes.
|
|
|
|
|
I think you can find articles on the codeproject did you search?
|
|
|
|
|
Hello everyone,
Sorry that this question is related to another question I posted some time before because I have some new findings and self-analysis.
My question is why sometimes from perfmon on Windows, working set larger than virtual memory? I think virtual memory is the total size of memory (committed, reserved, shared, private) and working set is just the RAM touched by current process currently. Virtual memory should always larger than working set...
But, I write a simple program to show working set is larger than virtual memory from perfmon. The program is simple, just open a couple of memory map files and read from beginning to the end.
The only reason I could think of why working set sometimes is larger than virtual memory is, the OS memory management component may not reclaim some RAM consumed by current process even if the current process does not use the RAM. And keeping such RAM could improve performance if the process will use it in the future. But this point makes me confused because I think if it is true, such RAM does not have related virtual memory address, how could the current process utilize or even address (re-use to avoid hard page fault) it in the future?
thanks in advance,
George
|
|
|
|
|
Perhaps you have the wrong idea about the Virtual Memory figure in perfmon. Perhaps it only records memory that has actually been VirtualAlloc ed at some point without including directly heap allocated memory like that which I guess is used for the memory mapped files. The complete process memory map for a Win32 process, even pre .NET, is a complex beast with potentially multiple heaps, Virtual allocations in their various states, a stack per thread, a TLS block per thread, non paged pool, kernel object storage, COM CoTaskAlloc ed memory and whatever marshalling uses and some other wierd stuff that the C Runtime does way down in the bowls with functions like calloc .
Probably you should do some in depth research and the write an article for Code Project laying all this stuff out and relating it to what we see in perfmon.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Matthew Faithfull wrote: Probably you should do some in depth research and the write an article for Code Project laying all this stuff out and relating it to what we see in perfmon.
I think he collected material for many, many articles.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Hi CPallini,
Without you guys help, I can not collect so many information.
have a good weekend,
George
|
|
|
|
|
Thanks. But:
You gotta get an article out, you owe it to the people.
We're so happy we can hardly count.
Happy weekend to you.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
modified on Saturday, January 12, 2008 10:35:05 AM
|
|
|
|
|
Thanks for sharing your points, Matthew!
But I do not quite agree with you, since on Windows, from memory management concept point of view, virtual memory (either allocated) contains all the memory of the current process, and new/malloc eventually maps to locations in virtual memory space, right?
So, I am not sure whether you points -- memory allocated through VirtuaAlloc is on virtual memory, and memory allocated by new/malloc is not on virtual memory.
If I am wrong, please feel free to comment.
Any more ideas? Maybe we could write some simple programs to verify our ideas? Any ideas?
regards,
George
|
|
|
|
|
George,
What does any of this have to do with C++/MFC?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sure, DavidCrow.
I am studying why my application consumes too much memory on working set -- larger than virtual memory.
regards,
George
|
|
|
|
|
|
stop reposting again and again !
this is not a chat, its a forum. when you ask a question at midday, keep in mind that it's midnight at the other side of the earth.
so if you want relevant answers, BE PATIENT.
so abusing the forum is the best way to make people ignore you and your question.
if anyway you still don't get any answers, maybe it's because you don't ask it correctly...
read the posting guidelines then.
|
|
|
|
|
toxcct wrote: keep in mind that it's midnight at the other side of the earth.
probably still think the earth is flat.
|
|
|
|
|
so what ?
it isn't ??
|
|
|
|
|
|
CPallini wrote: I felt myself a very important person
welcome in the MVP club
|
|
|
|