|
I've been assigned to recode a large part of my company's application. Mainly to reduce the large amount of bloat and code in our dialog class. One of the main portions that I want to reduce is the code surrounding our CTreeCtrl class. I was planning on just creating a new class and directing all of the CTreeCtrl events to this class.
Here is where my problem comes in. I've tried creating the class from the class Wizard in VS however it wants me to create a class that inherits from an MFC class. What is the appropriate class to inherit from here?
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
|
Awesome. That's what I was hoping for. Because of the class wizard that popped up in the particular place I was crating a new class I wasn't sure if it had to be MFC for the Message Maps to work properly.
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
This is a strategy question to try to get me pointed in the right direction.
My application records several items of data held in a structure into a log file. It also is able to read those log files and process them. As the application evolves, the contents of the structure increases and decreases ... elements are added and removed, based on evolving need.
While the software and the log files matches for a particular version, I need to be able to have sw version 3 read data log version 2, and data log version 1. Backward compatibility. It seems to me that I need multipe structures and multiple classes to read and write the log files, each class meant to handle the log of a particular version. The structure should be contained in the class with accessor functions to provide the data elements.
If the document object handles the File/Open, and it gets the filename from the dialog, and then opens the file and reads the first 4 bytes (an int) to determine which data log version is required, the doc would then instantiate an object of that log version class to handle reading the log file records into the structure. But, this seems to separate the file opening from the file reading, and it seems like that ought to be contained fully in a class meant to handle the data log files. If I don't open the file first, how else could I know which version class is needed?
Does this approach make sense? Is there a better way to keep software versions and data log versions compatible? What do others do to handle data files of different structures based on evolving formats?
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
David Chamberlain wrote:
then opens the file and reads the first 4 bytes (an int) to determine which data log version is required
That´s exactly what i do for my app. In fact, I have only _one_ type of structure, containing _all_ the stuff, and i only fill what is necessary given the version number. BUT i can do that only because i know there won´t be any further version (so the struct size won´t be larger) ... i guess that´s not the good solution anyway
~RaGE();
|
|
|
|
|
When faced with that problem, I typically use a file format that's similar to or based on the INI format. For instance...
[SoftareInfo]
Version=3
[Data]
SomeVariable = read me!
Bob = green
...
That way the code can just pluck out the variables it needs. If it doesn't find one it needs, it can use a default value.
This is also nice because it can be *forward* compatible too!
The one thing I *wouldn't* do is rely too heavily on MFC serialization. It can work in many cases, but if your file format has a major change, then your task becomes extremely difficult.
Of course, if you have *existing* file formats, then perhaps your classes that read data need to keep track of the version... like:
SomeClass::ReadData()
{
if(version >= 3)
read some piece of data
else
older versions stored that piece of data differently
...
}
Even if you win the rat race, you're still a rat.
|
|
|
|
|
I designed a DLL in .NET VC++ 7 with MFC. Can my DLL be used in VS6 application. I need to deliver MFC7 also. How can I do it ?
Any special concern in using the DLL in VS6 projects ?
|
|
|
|
|
Did you create the project using managed VC++ or just plain old C++? If it's plain C++ then there shouldn't be a problem to my knowledge. It's still just a DLL. If you used managed C++ then you'll probably have to use COM to access it.
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
It's normal C++ DLL, unmanaged. However, it depends on MFC and also C++ Runtime library, right ? So, I'm worrying how to let users of VS6 to use it.
|
|
|
|
|
when drag & drop buttons from CToolBarCtrl, default drag icon is a small hand, i need my own icon for special required.
do u know how to change the small hand to my icon?
thx
includeh10
|
|
|
|
|
Already tried smthg with SetDragCursorImage() ?
~RaGE();
|
|
|
|
|
no, thx.
in which message if possible?
includeh10
|
|
|
|
|
includeh10 wrote:
in which message if possible?
Oh, hell, i really don´t know ... i do not even know how to find that out... this function has to do do with a CImageList, but i´m afraid you´re not doing stuff with MFC at the moment ... I´ll keep looking, hold on...
~RaGE();
|
|
|
|
|
Found that :
ImageList_SetDragCursorImage
BOOL WINAPI ImageList_SetDragCursorImage(HIMAGELIST himlDrag,
int iDrag, int dxHotSpot, int dyHotSpot);
Description: The ImageList_SetDragCursorImage function sets the image of the dragged item.
Parameters:
himlDrag and iDrag: Handle of the image list and index of the image.
dxHotSpot and dyHotSpot: The coordinates of the image’s hot spot.
Return value: TRUE if successful; NULL otherwise.
Does it help ??
~RaGE();
|
|
|
|
|
thank u, it really helps.
actually i use it many times in CTreeView, but never use in CToolBarCtrl, i can fix it soon, i think it's right function.
and, i'd like to say, u r a good and interesting mate, hope meet people as u often in my life.
cheers
includeh10
|
|
|
|
|
includeh10 wrote:
and, i'd like to say, u r a good and interesting mate, hope meet people as u often in my life.
Oh ... .. well, then, welcome at CodeProject, i think there will always be people here ready to help you, that´s the point of the forum ...
~RaGE();
|
|
|
|
|
I have used the mciSendCommand function in order to verify
if a CD-Rom unit is able to record data.
Syntax I have used is the following:
MCI_GETDEVCAPS_PARMS l_DevCaps;
......
l_DevCaps.dwItem = MCI_GETDEVCAPS_CAN_RECORD;
mciSendCommand(l_OpenParams.wDeviceID,
MCI_GETDEVCAPS,
MCI_GETDEVCAPS_PARMS,
(DWORD)(LPMCI_GETDEVCAPS_PARMS)&l_DevCaps);
Does someone know how this code doesn't work ???
Antony B.
|
|
|
|
|
pl.see this link may be use for you
http://www.nottingham.ac.uk/cal/publications/mcia2m.html
|
|
|
|
|
Hi in my application I call GlobalMemoryStatus() to get the status of the virtual memory of my system. It returns the fact I have loads of virtual memory, Great!!. However when I call new() to try to allocate memory that is less then the virtual memory (allocating quite a large amount but still less then the virtual memory)it is returning NULL due to there not being enough memory available.
Does anyone have an explanation for why this is happening?
Thanks
The Blade Runner
|
|
|
|
|
Memory allocation will fail if you don't have the required amount of contiguous memory available. Try running my product MemWatcher (free download) and see if that helps. Sorry for the shameless plug, but I think it may help you.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
This program only shows whats in Physical memory not virtual memory aswell. I know to memory I am trying to allocate is greater the just the physical memory but the virtual memory according to this GlobalMemoryStatus function shows it is big enough too allocate the memory.
Thanks anyway.
The Blade Runner
|
|
|
|
|
MemWatcher can free up memory that Windows mistakenly continues to flag as "in use", thereby possibly allowing more memory to be used by your program. However, if you try to allocate "x" bytes and there aren't "x" contiguous bytes available, the allocation will fail.
Unfortunately, simply increasing your virtual memory won't guarantee that it's actually usable, since none of the data currently in physical memory may be swappable.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi,
I have developed an ActiveX control using ATL, when I insert it and work with it in Ms Word 2000 it works perfect, but when I print it, depending on the screen resolution, the Word text is printed inside the control or in the right place or shifted
I have tried the same in Word 2002 and it works fine. How can I fix this ? Is there any well know bug from ATL/Ms Word about this issue ?.
Thanks in advance
Braulio
|
|
|
|
|
For some reason I get a compiler error when I try to use chevrons in WTL. I define _WIN32_IE as 0x0500 (instead of 0x0400), but then I get the following error.
c:\...\wtl70\include\atlframe.h(274) : error C2146: syntax error : missing ';' before identifier 'lpnm'
I have IE version 6, I got VC 6 with service pack 4, and I got WTL 7.
What more do I need to get it working? As it looks like I'm missing a header file.
Any ideas? Thanks in advance
- Griffith
Everything you say will be misquoted, ripped out of context and used against you.
|
|
|
|
|
I just tried this today and got the same error. Unfortunately, I do not know why either. I think (but am not sure) that maybe WTL7 is for .Net and that is why it may not work. I believe that there is an ATL 2.0, ATL 3.0 and 7.0 and a WTL 3.0 and WTL 7.0. The only thing I can figure, since there seems to be a major jump in version numbers, is that 7.0 is for .Net.
Can someone clarify or verify this?
|
|
|
|