|
Yeah you right "playing movie in directshow "
-------------
Did you see Lounge forum "Why a career in computer programming sucks"? what do you think?
|
|
|
|
|
WhiteSky wrote: Did you see Lounge forum "Why a career in computer programming sucks"? what do you think?
Yes. I pretty much disagree with all 10 points. I personally haven't experienced any of those
I love to code. So much so, way back when, I did it on paper for a couple years before I could
afford my first PC. I did it as a hobby when I was in a completely different profession.
I guess if anyone relates to those items, they probably ARE in the wrong profession.
Cheers!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I cant imagine I leave programming also I think best enjoy write code and find problems so I agree with you and I think programming is a nice work.
|
|
|
|
|
WhiteSky wrote: I cant imagine I leave programming
Especially to be a database administrator!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery wrote: Especially to be a database administrator
Well said
|
|
|
|
|
I have a class whose base calss is CListCtrl,I want to make one list to draw every thing by itself,so I also wrote a CMyHeaderCtrl and CMyScrollbar class.
I modified the list's style to Owner draw,in the function ::OnPaint()I used these code lines to make it draw it items:
const MSG* msg=GetCurrentMessage();<br />
DefWindowProc(msg->message,msg->wParam,msg->lParam);
but where would be a assert occur.
somebody would tell me why?
Thanks.
BestRegards
|
|
|
|
|
kcynic wrote: but where would be a assert occur.
somebody would tell me why?
Not without more information. 99.99% of the time the ASSERT() statement itself will tell you exactly what is wrong.
Darker than a black steer's tookus on a moonless praire night
Within you lies the power for good, use it!!!
|
|
|
|
|
what is a virtual key code for number keys.
Like VK_TAB for tab .
for 0 - 9 what is a key code.
|
|
|
|
|
|
|
Hi all,
i have made a worker thread ,that worker thread is called from a function every time a condition is met.So i have several instances of same thread running at same time.So i want to know that if i want to close all instances of that thread, single AfxEndThread will close the threads or i have to use some other method.
thanks in advance
|
|
|
|
|
my problem got solved using TerminateThread. but the new problem is when thread is not running and the function calls TerminateThread it gives debug asserstion failed error. i have also tried using:
if(::GetExitCodeThread(CloseTh->m_hThread,0))
::TerminateThread(CloseTh->m_hThread,0);
but it also gives debug assertion failed may be i m not using it correctly.
Can annybody help me in this
thanks in advance
|
|
|
|
|
No. Never use TerminateThread unless there is a strong reason for that. TerminateThread simply makes the system to kill the thread whereas the thread never gets known about its death.
--
=====
Arman
|
|
|
|
|
|
Actually no need to use AfxEndThread at all. The proper way to exit a thread is to inform it about that. Which in turn will return from the controlling function.
Please see this article[^]. It describes the way how to do what you wonder now.
Sortly, here you have a synchronization issue. Prepare an event which would be listened by all the threads. Then inside some other thread [I guess a UI thread] you would pulse the event and thus let the threads to exit properly.
--
=====
Arman
|
|
|
|
|
I head a derived class from CHeaderCtrl.
But I don't know why it would be draw well only when I click the header.
If I click out of the header's area, it would disappear!
Why?
|
|
|
|
|
|
Thanks,
I will have a try now.And if you would like to tell me how to change the height of the listitems?
|
|
|
|
|
|
I have an urgent question. I'm developing an application for a uni assignment which communicates with a vehicle CAN bus adapter with an FTDI chip, and I only have access to the car for another 2h. I'm trying to read data from the FTDI buffer, but what's returned is in what looks to be the extended character set (basically jibberish), not the standard which I am expecting. I'm spooling it to a csv file using Char::ToString(). My code for FT_read (defined within the driver .dll, http://www.ftdichip.com/Support/Knowledgebase/index.html?programmingguides.htm under Programming guides, D2XX,Classic Interface Functions), is as below:
if(FT_Read(handle, received_buffer, byte_count, &num_bytes_received) != FT_OK)
{
MessageBox::Show("Error: Read Failed"); //unable to open device
//Close_FTDI();
return 0; //Error
}
else
{
return 1; //Success
//debug_output_txt->AppendText(received_buffer); //output received characters
}
where received_buffer is char received_buffer[256], and byte count and num_bytes_received are DWORD(unsigned long).
I just read on the ftdi site pasted above, that the data type for the received_buffer should be lpvoid - which is typedef void * lpvoid. I'm not that good with pointers, so could this be where I'm going wrong? Although, my code is almost a direct copy of their example.
Any idea guys?
Sorry about the lack of structure in my post - I'm a tad on edge at the moment.
Cheers
John
|
|
|
|
|
Not seeing all your code, all I can do is guess.
Did you initialize recieve_buffer before calling FT_Read() ?
Is FT_Read() timing out or was it successful? - According to the docs you provided timeout and success return the same value.
what is the value of byte_count and num_bytes_read both before and after the call to FT_Read() ?
Darker than a black steer's tookus on a moonless praire night
Within you lies the power for good, use it!!!
|
|
|
|
|
Yes receive_buffer is initialised before calling FT_Read (global), FT_Read was successful - byte_count and num_bytes_read return the same values after the read. Some more code is below (is there any way to do attachments?)
//typedefs
typedef unsigned long DWORD;
typedef void * LPVOID;
//globals
char received_buffer [256];
DWORD byte_count = 0;
int Buffer_Count()
{
if(FT_GetQueueStatus(handle, &byte_count) != FT_OK)
{
//MessageBox::Show("Error: Failed to read queue"); //unable to open device
//Close_FTDI();
return 0;
}
else
//MessageBox::Show(byte_count.ToString()); //DEBUG - how many is in the queue?
return 1;
} // END: int Buffer_Count()
int Buffer_Read()
{
DWORD num_bytes_received;
if(Buffer_Count() == 1) // get number of bytes stored in buffer and ensure success
{
if(byte_count > 0)
{
if(FT_Read(handle, received_buffer, byte_count, &num_bytes_received) != FT_OK)
{
MessageBox::Show("Error: Read Failed"); //unable to open device
Close_FTDI();
return 0; //Error
}
else
{
return 1; //Success
//debug_output_txt->AppendText(received_buffer); //output received characters
}
}
else return 2; //No new data
}
else
return 0; //Buffer Count Error
} // END: void Buffer_Read()
I think I may have found the problem, but can't try it until the car comes back in an hour or so. FT_Read wants a pointer to the array ->(LPVOID)received_buffer (then subsequent elements addressed (LPVOID)received_buffer++ I assume), but i'm passing received_buffer, which is different???? Could this explain anything? Perhaps the gibberish is due to incorrect addressing?
Thanks for the help.
|
|
|
|
|
donno1 wrote: FT_Read wants a pointer to the array ->(LPVOID)received_buffer (then subsequent elements addressed (LPVOID)received_buffer++ I assume), but i'm passing received_buffer, which is different????
The way you are doing it should be just fine.
You should initialize recieved_buffer and num_bytes_recieved before you use them. Makes it easier to spot errors.
char received_buffer [256] = {0};
DWORD num_bytes_received = 0;
Also, what kind of data are you expecting to recieve from the device? Is it suppose to be human readable text? Or is the "gibberish" the actual data that has to properly interpreted?
It's not rocket surgery!
Within you lies the power for good, use it!!!
|
|
|
|
|
Ok I'll try that.
Should be receiving human readable chars (upper case letters and numbers).
Cheers
|
|
|
|
|
Unfortunately no luck and the car has gone. I'm still just getting funky characters.
￾￾￾￾￾￾￾￾￾￾￾￾￾￾￾￾￾￾￾￾￾￾￾ï
I also tried appending it to an integer, and just kept getting -2 for each character (0xFE).
Any ideas?
|
|
|
|