|
Hi,
I am trying to make a VERSIONABLE_SCHEMA for future versions of a program, but I allways receive '-1' as version number when I call GetObjectSchema() function this is the probe code: (What could be the problem?)
//METEOGRAFICADOC.H
class CMeteoGraficaDoc : public CDocument
{
protected: // create from serialization only
CMeteoGraficaDoc();
DECLARE_SERIAL(CMeteoGraficaDoc)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMeteoGraficaDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMeteoGraficaDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CMeteoGraficaDoc)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//METEOGRAFICADOC.CPP
IMPLEMENT_SERIAL(CMeteoGraficaDoc, CDocument,1| VERSIONABLE_SCHEMA)
// CMeteoGraficaDoc serialization
void CMeteoGraficaDoc::Serialize(CArchive& ar)
{
CDocument::Serialize(ar);
if (ar.IsStoring())
{
ar<<dia<<mes<<anno<<horaactual<<titulo;
}
="" else
="" {
="" int="" nversion="ar.GetObjectSchema();" always="" '-1'
="" ar="">>dia>>mes>>anno>>horaActual>>Titulo;
}
}
NOTE: Where ar< appears, the code is right but I don't know why I cannot look what appears after the first < in The Code Project screen.
|
|
|
|
|
This is a classic problem. MFC serialization versioning works only for CObject-derived objects serialized with a call to one of these functions:
CArchive& operator <<(CArchive & ar, const CObject* pOb);
void CArchive::WriteObject(const CObject* pOb);
They save metadata about object type and version before actual object bits written by Serialize method.
The problem is that CDocument is saved with a direct call to Serialize inside CDocument::OnSaveDocument. There's no metadata about document itself. There may be some metadata about document members if you save them using functions listed above. So if you need a version number at the beginning of MFC-serialized file, write it yourself. It's much easier than rewriting OnSaveDocument (but this option is also possible).
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi I have built this MFC Wizard using the Visual C utility for building Wizards.
all is fine, except for i don't seem to have control over the next and back buttons in terms of enabling and disabling them. I would like to keep them all disbaled until all fields on the dialog are entered. How do I do this , since I can't find the resource id for these buttons?
|
|
|
|
|
There's a CPropertySheet::SetWizardButtons used to enable/disable buttons.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I can't add a variable to my static text.
I have a dialog box to which I added a static text labelled IDC_STATIC_TEMP. When I open ClassWizard, the ID is not visible and therefore I can not add a variable to IDC_STATIC_TEMP. At an earlier stage of my project I added other variables to other ID's but now, they are not visible anymore. What is wrong?
From the main dialog I can open two other dialogs. That makes three dialogs. To distinguish all dialog items from each other (which dialog they belong to) and to be able to use some "automatic" features, I have re-numbered the ID's. Dialog 1: 1XXX, Dialog 2: 2XXX etc.
Is this the problem? In all other dialogs but the main dialog I can se all ID's and add variables to them. Why???
The program works perfectly so far, even if I (in ClassWizard) can not see the variables and ID's belonging to the main dialog. All data exchange between main and sub dialogs are working perfect...
/Mattias
|
|
|
|
|
Try rebuilding the classwizard database.
Close VC, delete the projectname.clw file open VC again, and launch the classwizard to rebuild the files.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I can create a link to a file programmatically but how can I create a link to a folder?
Thanks
|
|
|
|
|
|
Hi Friends,
I have a Propertysheet class. I had set the TCS_BOTTOM style for this propertysheet. If I execute this application in a system which has IE4.0 or above, all the tabs are coming at the bottom as expected. But if I run this exe on a system which has IE 3.0, the tabs appear at the top.
But the same thing i tried with a tab control whose styles are set to BOTTOM tabs. They seem to work well both in IE 3.0 as well as IE 4.0 and above.
How can i make a Propertysheet control have tabs at the bottom with IE3.0 ?
Below is my code :
{
CntrlLevelSheet.AddPage(&MajorPage1);
CntrlLevelSheet.AddPage(&MajorPage2);
CntrlLevelSheet.AddPage(&MajorPage3);
CntrlLevelSheet.Create(this, WS_CHILD, 0);
CntrlLevelSheet.GetTabControl()->ModifyStyle (0,TCS_BOTTOM);
CntrlLevelSheet.SetActivePage(0);
CntrlLevelSheet.ShowWindow(TRUE);
}
|
|
|
|
|
The difference is because the two computers has different versions of commctrl.dll
I don't remember if the newest version is included in the Platform SDK, and can be installed without IE. If not, you have to upgrade IE to make it work...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
This might help you to install the latest ComCtl32.dll along with your app on the user's system:
http://www.codeproject.com/miscctrl/commctrls.asp
There are other articles that show how to test for the existence of a specific version of this DLL.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
How can I determine the size of dynamic array?
double *dynAr = new double[5]
This array has 5 items but if there is a condition that resize this array and then I want to know its size.
|
|
|
|
|
You can't do this. Use std::vector<double> instead - it has a size() method that does exactly what you want.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Actually you *can* do it - sizeof(array)/sizeof(int). Apparantly it's not recommended, but it works.
I second you though - vector is the obvous solution.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
No, you can't. He's using new and array is allocated on the heap, so sizeof(array) will be the size of pointer. This trick works only with global or stack-allocated arrays; I don't beleive it's not recommended in such case.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Fair enough - I read your response and remember seeing the method I quoted in a book, I've never used it and so have never thought it through.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hello, the codegurus around the world.;)
ANCI C++ type array doesn't have the same functionality like MFC array classes
like CAarray, CStringArray, and so on.
In this case, you can create your own class called CdoubleArray, and
create the member function GetSize()....
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Hi there!
I've created a program in AppWizard - just a SDI with a CVIEW and i've been using a CDC->LineTo(X,Y) to draw stuff.. I would like to be able to save this as a .jpeg, .gif or something..
HOW can I get this done?
|
|
|
|
|
First you need to change your code so it draws stuff onto a bitmap and then show that bitmap in OnPrepareDC, then you can use CXImage from this site to save that file using one of the formats you mentioned.
You may also find it helpful to look at GDI+, although I hear the guy who wrote most of the artcles on the subject here has no idea, you may like to check them out anyhow. GDI+ saves and loads these formats, and also has a lot of new cool stuff.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hi All!
I've a problem : Into an application I'm developing, I need to check if a key (or a key set) is pressed and handle this event.
Well : I can now capture the event "key_is_pressed", but I can't avoid the event this pression generates.
For Example : If an user on W98 presses the keys CTRL+ALT+Canc I receive from my application an error status, and I show a dialog like "what do you do?". So, All seems ok but, after the Dialog has been shown, I can't avoid the visualization of the task-list window.
How Can I do?
N.B : that's only an example : the same problem was encountered while monitoring the status of ALT+F4 or CTRL+Esc etc.etc...
Thanx All
Alessio
|
|
|
|
|
You need a keyboard hook to intercept the message and stop Windows acting on it. Sorry, I've never written one, so I can't help more, but that is most certainly what you want.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hi all,
I am designing a project which can be separated into two layers.
1. The user interface
2. the business logic.
The business logic has to be developed as COM components (since it will need to be reused in other environments)
The question is in which language (environment) to write the users interface. Should I do it in Visual Basic or Visual C++ (or other)?
Thanks in advance
Alberto Gattegno
Software Engineer
http://www.itgil.com
|
|
|
|
|
I would use VC++, but it's because I can't write a line of VB...
If you are good at VB, it's AFAIK a lot more easy to use COM objects from VB that it is from VC++.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
This is a loaded question. It depends what you want to do. If you want to get an interface up quickly, then the answer is obviously VB. If you want have maximum flexibility then you need C++, where you can create controls derived from those provided by MFC. Personally I have my doubts about how fast VB is compared to someone who is proficient in VC, but on the other hand your components are obviously going to be written to take advantage of VB's hiding implimentation details from you, which further simplifies your task.
Did I just recommend VB to someone ? I'm hoping not.... Personally I would go VC++/MFC if I was doing it professionally and VC++/WTL if I was doing it for fun ( because I've not done much WTL ).
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Write it in whatever you are most experienced with. I had a similiar situation where I had a Telephony component written as a COM object. At first I thought that it would be easier and quicker to write the UI in VB. However in the end I decided to use MFC because that is what I've been using for the past 8 years.
Michael
|
|
|
|