|
Well, at the moment I'm just a beginner that tries this MFC collection class. Sadly, I've got no experience in STL at the moment. Maybe I'll learn how to use it by the time...
And yes, I've still got the same problem. I really do not know what causes these problems. As I before all this used a much more complex class with some CString(s) and COleDateTime, I thought that I did something wrong when deleting the whole object (maybe something in the destructor), but I get this problem even in this simple CTest class. I also before this created the whole thing on the stack CMapStingToOb Test; and thought it was this that caused the problem but it remained when I created it on the heap CMapStringToOb *pMTO = new CMapStringToOb; ... Do you know if it has something to do with new and the associated pointers to the object instances or the instances of my CMapStringToOb?
I'll also ask a friend of mine who's got a Win XP machine to test it (I've got 98SE), maybe it is just the system... For what reason ever.
|
|
|
|
|
I did not forget about this problem however I am too busy to help at the moment I look at as soon as I can.
John
|
|
|
|
|
First of all I would like to thank you; first of all you should do what you have to do
It's just a private project (a program I want to be used by my school) and I've got time to wait as there is no need for the program to be finished within a certain time. I'm just programming so that I get more versed in the whole subject of computer, programming, databases and data processing.
I would be glad if you had a look on it once again, but you don't have to as there really is no
need for you to spend your free time on this, you surely have got something better to do
Thanks again first of all (and in advance )!
|
|
|
|
|
I know we can use Class Wizard to set maximum length of a CString in an edit box. Is there any way to change the maximum length of an edit box without using the Class Wizard?
|
|
|
|
|
CEdit::SetLimitText or something similar (or send an EM_SETLIMITTEXT message).
When I am king, you will be first against the wall.
|
|
|
|
|
Thanks Rob, it works perfectly!
|
|
|
|
|
RTTI - good or bad? I am using ATL/WTL and by default, new projects created using VS.NET have RTTI disabled. Before I rush off and use dynamic_cast are there any known gotchas with using RTTI? Will it make a difference to my program size, etc.?
I used to use "IsKindOf(RUNTIME_CLASS(...))" in my MFC days, though I'll admit that is makes some code look ugly and kinda feels like a kludge.
Thoughts?
When I am king, you will be first against the wall.
|
|
|
|
|
I use it all the time now in my MFC code and stay away from the "IsKindOf(RUNTIME_CLASS(...))" stuff...
John
|
|
|
|
|
It *could* slow down your application a little bit, but in most cases you won't notice any difference.
|
|
|
|
|
Well I guess it has to store the RTTI info so my program size will increase too I guess.
I found some more info in Effective C++ too:
"...the space cost of RTTI is an additional entry in each class vtbl plus the cost of the storage for the type_info object for each class. Just as the memory for virtual tables is unlikely to be noticeable for most applications, however, you're unlikely to run into problems due to the size of type_info objects."
So I should probably give it a go - it can be very handy...
When I am king, you will be first against the wall.
|
|
|
|
|
It adds some overhead to the application (both size and runtime). It's usually negligible, but the reason why it's off by default.
You get into trouble, however, if you try to link to a .LIB which is compiled without RTTI
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Are there additional mix&match rules about using RTTI? May I create a .DLL (class library) with RTTI and link to it from non-RTTI EXE's?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
Santa Cruz Networks
|
|
|
|
|
Might be a problem when the DLL exports classes. After all, if you compile the DLL without RTTI, and later request RTTI from the DLL-implemented class, something strange will happen.
I guess the C++ name decoration is different for compiles with/without RTTI, so it won't find the correct exports in a RTTI setting mismatch.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
I don't think you will have any problems either way as long as you don't try to use RTTI on code that was not compiled with it. I write all my code with RTTI turned on and I know the libraries that my coworkers give me do not have RTTI turned on but it does not seem to cause any problems. However when I think of it they do give me a simple class interface with no inheritance or virtual functions so maybe the problems occur when the code uses these features. When this subject was brought up I was thinking of MFC. I do use RTTI with MFC all the time. Was MFC 4.1 compiled with this turned on??
John
|
|
|
|
|
I use it all the time for the VCF, and use dynamic_cast as a replacement for QueryInterface type of functionality. Haven't seen any real issues with it.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
|
|
|
|
|
Hi All
i have been given a dll file, which i need to import into my
.net c++ application, as i need to access some of the functions
defined in DLL
However i havent ever done anything on dll's and importing them into
a project and have no idea where to start
can ne1 help or point me in the right direction
thanks
simon
|
|
|
|
|
This is not my strong point, but I've done this a few times in the past.
Some questions first:
1) Do you already know the API? Is it a C++ or C or other style API?
2) Does it come with .H files?
3) Does it come with .LIB file? (this *may* be generated)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
Santa Cruz Networks
|
|
|
|
|
Hi Peter
I dont know what style the API is in, the DLL has been supplied to me
from an external company, at a guess i would say it was probably written in VB or delphi
it doesnt come with any .h files or .lib files, all i have been
supplied with is a single dll file
any ideas ???
thnaks
simon
|
|
|
|
|
Uhhhh....
You got this DLL from an external source. They provided you with nothing except the DLL file?
What does this DLL do? Do you know anything about what you're supposed to do with it? Or what function you are supposed to call? Or....
What exactly do you know about this DLL?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
Santa Cruz Networks
|
|
|
|
|
Hi Peter
what it is, is im writing an application which access's an external
company's database, however they wont, for security reasons allow me
to access the database directly, instead they have provided me
with this DLL, which contains exported functions from another program
which i then call to obtain the data which i require
|
|
|
|
|
So, there's 2 parts to this problem.
1) How to get access to the DLL and it's functions
2) How to integrate this into your program.
(1) access -- Get familiar with LoadLibrary and GetProcAddress. LoadLibrary will load the DLL into memory. GetProcAddress will probe the loaded DLL for it's entrypoints (functions). You should also understand "pointers to functions" and how to represent those in C++ code.
(A) Create a prototype for the function you want to call. This prototype declares a function pointer:
typedef int (FAR PASCAL *FunctionPrototypeName)();
note that the FAR PASCAL identifiers are defined by whoever wrote the DLL. This defines the "calling convention" used in the function. Get this info from whoever wrote the DLL.
(B) Declare storage for this pointer. Global variable is fine. [Consider wrapping all this stuff in a C++ class, i.e. represent the DLL as a class, compartmentalizing access to the DLL through the class. Abstract each entrypoint of the DLL into a C++ member function.]
FunctionPrototypeName fp_function;
(C) In code, load the library:
HMODULE hDLL = LoadLibrary( _T("MyDLL.DLL" );
(D) Load the pointer to the function:
fp_function= (FunctionPrototypeName)GetProcAddress( hDLL, "ExportedFunctionName" );
(E) The function is now ready to be called:
int x = (*fp_function)()
(2) integration
As I mentioned in a note above. Represent the DLL as a C++ class. Each entry point in the DLL, should be represented by an member function in the C++ class.
-p
P.S. I can't guarantee my syntax is perfect. Compile errors may occur. Mileage may vary. Do not bend, spindle, or mutilate.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
Santa Cruz Networks
|
|
|
|
|
Hey lads,
Is it possible to handle a ON_REGISTERED_MESSAGE message in a CWinApp derived class... Keeps giving me static_cast errors... I don't have the code with me now... It was 1am this morning that I was doing it and I didn't even get a chance to look at the messge properly before I fell alseep.
Think it was somethign to do with a cast from CWnd to CWinApp. ON_REGISTERED_MESSAGE a macro that only works with CWnd?
Regards,
Brian Dela
|
|
|
|
|
when i open mmc.exe (microsoft managment console)there is a default menu items
'Action' 'View' & 'Favourites'
i opened sql server enterprise manager which is uses the mmc and i notice that the last menu item was 'Tools'....
(i have a snap-in object project)
i need to produce such an item...but don't know how?
can any1 help please?
thanks in advanced,
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Does anybody know how to scan avalible wireless (802.11b) network in a MFC program?
Any tips will be appreicated!
mao
|
|
|
|
|
What do you mean by "scan wireless network?"
|
|
|
|