|
I had tried this. But logically, it should not work and it doesn't work.
But the problem i've mentioned is not the same one.
|
|
|
|
|
Hello,
I am using the bit of code below in a function to send instructions thru the serial port to some equipment and also to read off some feedback from
the equipment:
WriteFile(hCOM1, txbuff, 8, &bytesRead, NULL);
ReadFile(hCOM1, rxbuff, 8, &bytesRead, NULL);
Power= (((int)rxbuff[6])%4)*256 + (int)rxbuff[5];
When i am testing this function alone, it seem to work perfectly and obtain nice readings. However, when i integrate it with the rest of the program i find that the function gives wierd readings.I later found that this was due to the ReadFile portion reading the recieved portion at an offset, meaning there was some meaningless data before my actual portion of the feedback.
eg
I expect 255 255 43 .....
instead i get 05 04 255 255 43...
I managed to solve this problem by making use of the PURGE command.
However, i would like to know, why does the offset of data occurr ?
Is there any better way to solve this problem instead of PURGE ?
Thanks
|
|
|
|
|
The serial port has an input buffer of usually around 16 characters. Anything that is received by the serial port but not read by an application will be just sitting there waiting to be read. A good practice is to clear the input buffer (just read until you can't read any more) when you open the serial port, and then make sure you keep up with all the reads after that.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
*
***
******
********
I have some problems to make this triangle for my hobby.
John,K
|
|
|
|
|
<font color=blue>const int</font> nMaxLines = 4;
<font color=blue>for</font>(<font color=blue>int</font> lnCount=0;lnCount<nMaxLines;lnCount++)
{
<font color=green>
<font color=blue>for</font>(<font color=blue>int</font> nStars=0;nStars<=(lnCount*2);nStars++)
{
cout<<"*";
}
cout<<endl;
}
Nibu thomas
Software Developer
|
|
|
|
|
1.how can i find the location of whitespace character in the file like tab, space etc??
|
|
|
|
|
I guess you are using MFC ...
Use CStdioFile ..
Using ReadString method of CStdioFile read a line of text and search for occurrence of the specified characters in that line.
Keep searching in this manner till EOF .
Nibu thomas
Software Developer
|
|
|
|
|
why is CView and CDocumnet created in the function?? any relation among them?
|
|
|
|
|
derek7 wrote: why is CView and CDocument created in the function?? any relation among them?
I don't see any CView and CDocument in the function.
Nibu thomas
Software Developer
|
|
|
|
|
Hello, everyone,
I want to implement such requirement as making a windows service on vista,
the service can display ui to user. How can I do? Where I can find the example?
Best Regards.
|
|
|
|
|
The proper name is an 'Interactive Session', check out this[^] MSDN article which explains about them.
Under Windows Vista interactive sessions are being fazed out though, check out this[^] blog entry by Larry Osterman (from Microsoft) which explains the reasons behind not using them.
Gavin Taylor
w: http://www.gavspace.com
-- modified at 0:13 Tuesday 7th March, 2006
|
|
|
|
|
These articles are very helpful to me, thanks!
|
|
|
|
|
Is there any method to dismiss the system modal dialog box programmatically?
|
|
|
|
|
|
to delete modelless dialog window
void CRVDlg:: OnExit()
{
OnCancel();
}
void CRVDlg::OnCancel()
{
DestroyWindow();
}
void CRVDlg::PostNcDestroy()
{
CDialog::PostNcDestroy();
if(m_pParent)
{
(CVCDlg*)m_pParent)->Obj=NULL;
}
delete this;
}
JAYARAJ
|
|
|
|
|
mfc42.dll 2.1k
mfc42d.dll 1.466k
why? debug version should large than release version.
|
|
|
|
|
The debug version has a list of all the named symbols in the file and their addresses, as well as line number information so the debugger can relate machine-code instructions to their line number in the source file.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
so debug version is large than retail.
but did you see that?
debug is smaller than retail.
|
|
|
|
|
Your message title... mfc42.dll < mfc42d.dll
If the debug version is smaller, then there's a problem with your installation.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
MFC71 depend many lib :msvcr71.dll kernel32.dll gdi32.dll etc...
but I use depends.exe look mfc71 ,it no import function. why?
|
|
|
|
|
declaration in vc6 :virtual ~CException();
declaration in vc7 :virtual ~CException() = 0;
try {
if(nCount != sizeof(BITMAPFILEHEADER)) {
throw new CException;
}
if(bmfh.bfType != 0x4d42) {
throw new CException;
}
.................
}
it work in vc6 ,it should pass compile but it should not pass link.
but it all work in vc6.
|
|
|
|
|
#include <iostream>
class ccc
{
public:
ccc(int i)
{
m_i = i;
}
int m_i;
};
void f(bool b) throw( ccc )
{
if(b)
{
throw new ccc(5);
}
}
main()
{
try
{
f(1);
}
catch (ccc)
{
std::cout<<"catch call";
abort();
}
}
the catch not run;
|
|
|
|
|
Because your not catching what you throw:
throw new ccc(5);
catch (ccc)
To fix:
throw ccc(5);
catch (ccc* pC)
{
delete pC;
std::cout<<"catch call";
abort();
}
Steve
|
|
|
|
|
Hi,
We are using Visual C++ 6 with MFC, and require the ability to scan a document and pick up some data that is printed on the forms (like serial numbers etc).
Just wondering if anyone has had any experiences good/bad with any OCR libraries?
I have tried SimpleOCR from http://www.simpleocr.com/ and never got a reply back about request for trial edition.
Currently testing Leadtools OCR solution (leadtools.com) using COM and getting errors. Have emailed them but awaiting a response.
Any others I should try?
|
|
|
|
|
Hi,
I am trying to put a chart in an MFC Dialog. I was told that the best way was to use the Office Web Components and the Chart available through that (adding it by selecting ActiveX componenent). However, I'm not sure how to do it. When I add this control to my Visual C++ 6.0 Project, the program never starts. It gets stuck in a BindControls function.
Does anyone know where I can get an example or article to help me out with this? Or a better way to graph a huge amount of data and display it in a MFC Dialog?
Thanks so much!
Jen
|
|
|
|