You can't communicate with a LED using the serial port (a LED doesn't 'communicate'). You probably meant that you communicate with some kind of harware (like a microcontroler) that will switch your LED on or off.
Well, then just send some specific packet on the link that your microcontroller can recognize.
Where are you stuck exactly ? Because it is really vague...
Oooopzzzz. I just started to do some research regarding this to gather some knowledge about controlling LEDs using software. I understood by your answer that i should need some extra hardware(Microcontroller) to control LED.
Then I must go and find something about microcontroller and controlling LED first. Anyway thanx a lot for your information. Atleast i got some idea abt this.
Do you have any idea about this without microcontroller. ( that means jus with common electronic items such as breadboards, resistors, capacitors and transistors.)
Maybe what you could do is use one of the control line of the serial port (like CTS, but you need to check which one you could use) and then connect your LED with a resistor between this line and the ground.
But, I don't think this is the most appropriate forum to discuss about that because it is not in fact a programming question...
I believe that you can do it using the parallel port using 24 volts that you should make available from your code in one of the port pins.
We have here working something like that but in that case we make an alarm to sound and we have used a relay and some cables, but only the parallel port. If we are capable to make an alarm to sound, I'm sure that you'll be able to enlight a led.
You can connect LED's to some of the pins of the parallell printer port. You will need to use serial resistors, though. Else, chances are that you will break either the printer driver circuitry (in the computer), or the LEDs themself.
You can use inpout32 (search for it) to control the individual pins of the parallell port.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
If you are willing to use the parallel port for driving of the LED, as Kahan has suggested, then here's a good article that might help: "Parallel port interfacing made easy: Simple circuits and programs to show how to use PC parallel port output capabilities" at http://www.epanorama.net/circuits/parallel_output.html[^]
Note that under current Windows OSs, the outportb() function is no longer usable, and indeed all functions that directly access the port are not usable. You will need a prot driver, as noted in the cited article.
In my application I am trying to copy an html page from one temp location to another location specified by user.
I am using CopyFile() API to copy html pages.
But I need to explicitly carryout the image copying along with the .html page copying.
I also tried using SHFileOperation API but it also doesn't support implicite copying of images.
Is there any other API which copies all the images from particular html pages implicitly when I copy that html page?
As I know there isnt any API for that .
you should search for image function in the html file , and find the image adresses and copy them near the html file , then you should change the adresses in the file to new addresses (related addresses) . Then you can copy them wherever you want . It will take time to do that ...but if you want to write the program you should spend time .
In general, it is best if you can avoid using TerminateThread because that will really kill the thread (so you won't be able to do clean-up tasks or things like that). What you'll have probably is a kind of loop (while something is true, you continue processing). So, what you could do is set this variable to false in the other thread.
You should call TerminateThread only if you know exactly what the target thread is doing, and you control all of the code that the target thread could possibly be running at the time of the termination. For example, TerminateThread can result in the following problems:
:If the target thread owns a critical section, the critical section will not be released.
:If the target thread is allocating memory from the heap, the heap lock will not be released.
:If the target thread is executing certain kernel32 calls when it is terminated, the kernel32 state for the thread's process could be inconsistent.
:If the target thread is manipulating the global state of a shared DLL, the state of the DLL could be destroyed, affecting other users of the DLL.
So you can either wait until all the threads finish execution or return from the thread function when some condition is violated.
Somethings seem HARD to do, until we know how to do them. _AnShUmAn_
you didn't get it.
his project certainly doesn't define UNICODE, so his CString is actually CStringA (ansi string - char*).
but he assigns a wide characters string into an ansi string; and wide string contain \0 bytes into some characters, that's why he sees only the first one...
BTW, see my other reply to have a working solution for this pb
PostThreadMessage(...) is the correct way to end a UI-thread, you're right about that.
It usually desired and considered good practice to wait on the thread handle to make sure that the thread has finished and delete the CWinThread object afterwards.
The articles I linked to in my previous post will show you how.
However, this requires that you keep track of all threads in some kind of container, e.g. std::vector.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
Last Visit: 31-Dec-99 19:00 Last Update: 8-Dec-16 5:01