|
no problem.
actually, that's a chunk of code i got off of codeguru a couple of years ago - it's always worked well for me. just sharing the wealth.
-c
POKE 808,234
|
|
|
|
|
Dear Sirs,
I must receive serial bytes in a MFC proyect using a WideTrack buffer (as Greenleaf Comms lib calls it); with every byte I must receive its error status (parity error, frame error) so that I can discard it.
The proyect is a propietary protocols monitor in a noisy environment (radio comunications).
I've tried to use alternative techniques as to use the error message that comes every time an erroneous byte arrives, but the problem is I'm unable to identificate which one in the waiting queue is the bad one.
Can you help me?
T.I.A.
|
|
|
|
|
Haven't checked this, but maybe you can set the size of input buffer to 1 (with SetupComm ) to make it easier to sync bytes received and error messages. Also, the UART has an internal buffer of its own (see Control Panel->System->your COM port->Properties->Configuration->Advanced) that you might want to set down to the minimum. Tell us back if something along this line works.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Not sure if I understand the original question exactly or not, but etting the UART to the minimum might be a problem if he can't service the comm before the next character comes in - with Windows this is probably a fairly likely thing and the reason there is a buffer there - it will just be overwritten. You can probably get away with it if the speeds are low - but it seems like you are asking for compatibility problems (i.e. it fails a lot with Winmodems or Cable Modems) if you do this.
Can you read the bytes into an intermediate buffer, throw your error if and when you need to, and only pass clean (that pass your test) bytes on to the application?
--Mark Terrano
www.ensemblestudios.com
(Creators of the Age of Empires series)
|
|
|
|
|
VC++ 6.0 now making executable above 20 MB rather than 400 KB. MFC used as shared libraryes. If it used as a static executable size - 30 MB.
Answers pls send to e-mail: ovm@SoftHome.net
P.S. Executable ziping to 200 KB
|
|
|
|
|
Have you included a huge resource ? I'm guessing blindly here due to lack of info in your post. What did you do to make it so big ? Did you find the hidden switch that M$ use to compile Office ?
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
It's not funny, Chris.
No i'm not included a large resources. .OBJ files of classes of derived from MFC (CDialog, CDocument etc.) has size about 1 MB
|
|
|
|
|
Try to run DUMPBIN with /headers option on the executable. Which section (their names start with a dot) is the largest one?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
The DATA section. But i can't understand why.
|
|
|
|
|
Do you have any large table declared at global scope? You can also try to examine the .map file produced by linker - but first you have to enable .map file generation.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
There is a way to see if the huge size is cause of embedded bitmap resources. Take the 20 MB exe and zip it. If the size reduces to less than 1 MB you can be sure that the huge size was due to embedded resources which are easily compressed several magnitudes.
Regards
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Thanks for all, i'm already solve this problem. VC so stupid ...
|
|
|
|
|
You didn't say what your solution was?
I was going to guess you had accidentally switched Release and Debugging mode switches - I got surprised by that one time (was exporting the debugging version over the release one)
--Mark Terrano
www.ensemblestudios.com
(Creators of the Age of Empires series)
|
|
|
|
|
Is any body know how to retrieve all process, like task manager, without enumerate windows on system.
Thank you.
|
|
|
|
|
If you're on NT/2K, you can use EnumProcesses in the PSAPI.
On Win9x/2K, but not NT4, you can use the ToolHelp API, see Process32First/Process32Next.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
I have a workspace consisting of five projects. Let's call them Project A through E. The structure I'm aiming for is the following:
A
/ \
B C
/ \
D E
I've updated the dependencies so that A is dependent of B and C, and C is dependent of D and E.
Project A is a regular application while B through E are static libraries providing functionality to the application.
My problem is that I have a couple of classes with identical names in the different projects. The classes aren't identical but play a similiar role in the different projects. When compiling I get warnings about the classes already being defined and that the second definition is ignored.
Since I'm still relatively new to VC++ I'm not sure if my approach is the right one. Maybe I should try another structure, but this is the one that feels most intuitive because of the way my projects are related.
Maybe I'm just not including my libraries correctly? Or is the problem that I have conflicting class names? Should I rename the classes within the projects, or is it possible to just add some sort of namespaces?
I would much appreciate some pointers to what I might be doing wrong. Examples of project settings and such.
Thanks in advance!
|
|
|
|
|
I'm a big fan of using namespace. I have a number of libraries that I have similiar named classes and I use namespace a lot. It helps too when I use a third party library which has a class named the same as one of mine.
Michael
|
|
|
|
|
Namespaces will most likely solve my problem so I'll give them a try. Unfortunately I'm not very familiar with them, but I'll go namespace hunting in the MSDN.
Thanks for your time!
|
|
|
|
|
quiet simple
in your class .h
namespace yournamespacename
{
class CMyClass
{
};
}
To use it, yournamespacename::CMyClass myclass;
Michael
|
|
|
|
|
Ok, but does this mean that I'll have to specify the namespace for each and every class in a library, or is there a way to specify a namespace for the whole library at once?
|
|
|
|
|
See the keyword: using namespace ...
You can see an example when you create a new "Win32 console application" project that supports MFC, right before _tmain().
I'm not an expert of namespaces, though, just know what to look for
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Yes I found the keyword and it will probably come in handy when I want to use my libraries.
But what I would like to avoid is to declare the same namespace several times, once for each class, in my library and instead declare a namespace for the whole library at once. I have no idea if this is possible though?
|
|
|
|
|
Have you tried to do:
namespace yournamespacename
{
#include "mylibrary.h"
}
I read somwhere that you can do something like that, but never tried.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Using this method I lost the warnings about classes already being defined. But I still get errors when compiling. This is how my code looks like now:
namespace LibA {
#include "LibraryA.h"
}
namespace LibB {
#include "LibraryB.h"
}
.
.
.
LibA::MyClass myClassInLibraryA;
LibB::MyClass myClassInLibraryB
When compiling this code I get several LNK2001 errors. So it seems the compiler can't resolve the namespace after all. It makes no difference if I try "using namespace LibA" instead.
Am I doing something wrong when trying to access my libraries?
Maybe I have to modify my code, so that I specify the namespace for every class, after all.
|
|
|
|
|
Some experimenting seems to reveal that my problem is happening because I try to use two libraries (with name collisions) from another library. I created a new project where my two libraries are used by a regular application, and that seems to work.
I guess I'll do some redesigning so that I don't need multiple library levels in my program.
Thanks for all your help!
|
|
|
|