|
You didn't post the code in which you started the new thread. Can you post it ?
And what is the problem exactly ?
|
|
|
|
|
yes i posted it as ON_MESSAGE(WM_UPDATE_CONTROL,PaintText).
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
Ok, you updated your post.
The problem is that when you post a message, you will post it in the message queue associated with the thread that created the window (see here[^] ). So, the message will still be processed by your GUI thread (from any thread you sent it).
Why don't you call the FinalCall function directly there instead of posting a message ?
|
|
|
|
|
Again, you havn't stated your problem exactlty.
deeps_cute wrote: but i cant acheive the threading.
What does this mean, thread procedure is not getting called ?
|
|
|
|
|
i want to write very large numbers for ex 61118792 to the serial port.so i want to use DWORD to write data instead of byte.
When i take byte as parameter when using writeFile & ReadFile(and pass small values) i am able to get correct output,but if take parameter as DWORD i am getting some garbage value.
Please do reply how to solve this, if any other way also please suggest.
|
|
|
|
|
Can you show code ? causing this.
|
|
|
|
|
This is the code i found from codeguru.
The URL is as below
www.codeguru.com/Cpp/I-N/network/serialcommunications/article.php/c5395
please do take some time to look at the code
|
|
|
|
|
Doesn't Cedric's answer satisfy your query ?
l_d wrote: www.codeguru.com/Cpp/I-N/network/serialcommunications/article.php/c5395
Are you talking about this function ?
BOOL CSerialPort::WriteByte(BYTE bybyte)
{
iBytesWritten=0;
if(WriteFile(hComm,&bybyte,1,&iBytesWritten,NULL)==0)
return false;
else return true;
}
If you want to use DWORD, you need to modify it to,
BOOL CSerialPort::WriteByte(DWORD dWord)
{
iBytesWritten=0;
if(WriteFile(hComm,&dWord,sizeof(DWORD),&iBytesWritten,NULL)==0)
return false;
else return true;
}
-- modified at 4:01 Friday 23rd February, 2007
Corrected typo.
|
|
|
|
|
Well, that's a solution but it is not very convenient to modify the function so that it can support everything you want to transmit .
I looked at the article but I don't really see the added value of it. Yes, of course, it is perfect when you want to send bytes but when you have more complex datatypes then it becomes a pain in the sense that you need to use masks and bit shifting
|
|
|
|
|
thanks for Prasad& you for looking at the article.I understood what u both meant and modified but even then when i am reading back the value in that edit box i am getting garbage value.
can anyone please suggest me any other method when i want to send very large values that too many values if possible in an array accepting from different edit boxes.
|
|
|
|
|
Well, if you modified the code accordingly to what prasad said, you need of course to do the same for the Read function (so that it can read DWORD and not bytes).
|
|
|
|
|
Actually, I dont wanted to read the article, as it was to much for me to read whole article, because OP dont want to paste relevent code.
So I looked in to WriteFile part of article and give him suggestion.
|
|
|
|
|
Yes sure the same for me. In fact the post was not intended as a 'rant' to you but more to the article itself. That's not very flexible to only be able to send bytes. It would have been much more convenient to be able to send a buffer (if the buffer size is 1, then you only send one byte).
|
|
|
|
|
To write data to a serial port, you provide tha address of a buffer and the size of data to transmit. So if you want to send your DWORD, you simply need to do this:
DWORD dwMydata = 61118792;
WriteFile(...., &dwMyData, sizeof(DWORD), ....);
|
|
|
|
|
how to write a merge sort program using COM?
|
|
|
|
|
How it is related to COM ? COM is not a language. Have search on internet for same ?
|
|
|
|
|
meet_kirankumar wrote: how to write a merge sort
Here[^] is an example.
meet_kirankumar wrote: using COM
Write a MergeSort function or class then call it.
|
|
|
|
|
Hi,
I need to change the background color of a CStaic control to white color.
How can i do this ?
Thanks.
|
|
|
|
|
Handle WM_CTLCOLOR
HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor==CTLCOLOR_STATIC)
{
pDC->SetBkColor(RGB(255,255,255));
}
return hbr;
}
|
|
|
|
|
Hi,
I tried this. But that is not changing all pixels of CStatic window. This changes only the text background color of CStatic window.
I need to change the color of whole CStatic window.
Thanks.
|
|
|
|
|
You said in your OP, you want change background color of CStatic.
Try this code,
HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor==CTLCOLOR_STATIC)
{
pDC->SetBkMode(TRANSPARENT);
hbr = CreateSolidBrush(RGB(255,255,255));
}
return hbr;
}
|
|
|
|
|
|
C an any body tell me how 2 create frames in VC++ with buttons in detail prosedure.
|
|
|
|
|
Are asking this with respect to MFC or SDK?
|
|
|
|
|
Hi, I have a dialog box which has vertical scroll style enabled. The problem is, when i pull the scroll button down the controls in the dialog box move down. But when i pull the scroll button up the controls does not move up. The code which i have used is listed below
void CMyPropertyDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnVScroll(nSBCode, nPos, pScrollBar);
SetScrollPos( SB_VERT , nPos , TRUE ) ;
ScrollWindow( 0 , GetScrollPos( SB_VERT ) ) ;
}
please help
-- modified at 0:03 Friday 23rd February, 2007
|
|
|
|