|
How about formatting your code correctly AND using the <pre> tag?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
-> has higher precedence than a cast, you need parens around the cast so it's evaluated first:
((CTestView*) param)->SomeMethod();
--Mike--
Dunder-Mifflin, this is Pam.
|
|
|
|
|
HI all,
I am working on Non Overlapped serial I/O application.
I have only one thread to receive the data.For send i dont have any thread.
I just call Write file when i need to send .
My problem is, When I have my receive thread wait for an event using WaitCommEvent, it ties up the serial port. Then my sending function can't access the port with WriteFile. I knew waiting for a comm event would block the receiving thread but didn't expect that it would block use of the port.
Any suggestions on how to do non-overlapped communication, where the send fucntion can write while the receive thread waits for a comm event?
Regards,
Sunil Kumar
|
|
|
|
|
Try to open the port twice using CreateFile .
Use one handle for writing and another for reading from the port.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I dont think I can use CreateFile twice.
It is unable to create the second time.The handle is getting some undefined value,
when it is opened the second time.
Regards,
Sunil Kumar
|
|
|
|
|
You should be able to open more than once if you specify the FILE_SHARE_READ and FILE_SHARE_WRITE flags.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
«_Superman_» wrote: You should be able to open more than once if you specify the FILE_SHARE_READ and FILE_SHARE_WRITE flags.
You cannot do that with a communication resource (MSDN [^])
The CreateFile function can create a handle to a communications resource, such as the serial port COM1. For communications resources, the dwCreationDisposition parameter must be OPEN_EXISTING, the dwShareMode parameter must be zero (exclusive access), and the hTemplateFile parameter must be NULL. Read, write, or read/write access can be specified, and the handle can be opened for overlapped I/O.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
yeah, I am unable to open it twice even if I mention the shared attributes.
There is no other option for non overlapped I/O, if I have to WriteFile, when
my receive thread wait for an event using WaitCommEvent?
Regards,
Sunil Kumar
|
|
|
|
|
As workaround, you may use the same thread for both I/O.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Even If I have to send data in the same receive thread,
I am unable to do as WaitCommEvent never returns.
My code block is:
if (!SetCommMask( pc->hCommn, EV_RXCHAR))
{
}
for ( ; ; )
{
if (WaitCommEvent(pc->hCommn, &dwCommEvent, NULL))
{
do
{
if (ReadFile(pc->hCommn, &chRead, 1, &dwRead, NULL))
{
pc->CopyRx(chRead);
}
else
{
break;
}
}while(dwRead);
}
else
break;
}
Where can I call my send fucntion in this thread, if I have some data to send.
Please suggest.
Regards,
Sunil Kumar
|
|
|
|
|
I was wondering if DuplicateHandle[^] will work.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
You cannot do that with a communication resource (MSDN [^])
|
|
|
|
|
Have you read this?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
I already read the article.But I am trying using Non overlapped I/O.
If it is impossible to do using Non overlapped, i will shift to overlapped.
Regards,
Sunil Kumar
|
|
|
|
|
Hi all,
Anyone has the C source code for Sobel - edge detection filter for bitmap color image.
Pls support me the complete souce code.
|
|
|
|
|
|
thanx but i wana code in c not in cpp.
|
|
|
|
|
adichavan wrote: i wana code
if youz wana code youz gonna have to writez it or search for itz...
|
|
|
|
|
adichavan wrote: i wana code
Go Ahead!!!! who is stopping you..
|
|
|
|
|
i had write code in c i m new in image processing i stard studing it since last 1 month uptil now i read my image its header i displayed it & perform convlution with sobel operater the code is running but cant show the complit o/p if u dont want to help then live it OK i just want to compaire my code with other & dat cpp code i allready studied
|
|
|
|
|
rather i rhink u dont know anythink about image processing
|
|
|
|
|
There are 4,820,000 results when you google your subject. If you need more help i can give you a link have a look at it. [^]
|
|
|
|
|
Then remove the unwanted pp and go on...
You know C++ code maybe converted into C one.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I want to develop a tool .The function is when I drag a image from browser on it which can save image to my desktop or manger(rename ) the image.
with google and other's help,I gain the HGLOBAL data from clipboard with pDataObject->GetGlobalData (CF_DIB) and I also can get the URL of image.but when I want to save this image to my desktop and I find two way can do this:
1.Save the data of CF_DIB format
The problem is:
I gain a string of binary system from CF_DIB data, how can i save it as image without changed it? I try to save all of those image to my desktop as format of bmp,it's can do the work but seem not good for the image on the desktop often larger then the browser.so I think it's not a good mothod to do this.for I have to save file without change I should save the format of image sam as browsers' ,but with many format like gif,jpg and so on....so I want to find a easy way how can I save image without changed it.
2. Download the image
The problem is:
Many URL is not right which can not find the image correctly,may be need parse it.
So The last questions is which way should I select can better solve my problem ?
Thanks in advance for your help and sorry for my English.
notenking
|
|
|
|
|
For your first solution i would check out CxImage[^].
For your second i would try using WinInet[^].
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|