|
OMG another ot those terrible over-the-top-youngster-developers!!!!!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: youngster
I wish...
I first programmed in C on my ZX Spectrum[^] around 1984. Can you imagine compiling in C (think headers...) when your only storage is a tape deck?
|
|
|
|
|
Stuart Dootson wrote: I first programmed in C on my ZX Spectrum[^] around 1984.
That time i was only few months old
BTW: THHB in action
Regards,
Sandip.
|
|
|
|
|
Stuart Dootson wrote: I first programmed in C on my ZX Spectrum[^] around 1984.
I did the same.
Stuart Dootson wrote: Can you imagine compiling in C (think headers...) when your only storage is a tape deck?
C ? I started with BASIC , but soon passed to Z80 assembly !
BTW: as told in advance by the (I would say 'good-old' but he's really youngster...) SandipG, welcome in the THHB [^], [^]!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks Pallini and Stuart,
For the first solution I already knew the static trick but not the template one
For the second..actually I had already used it developing a vst long time ago but I forgot
I used the float since in vst 2.4 the processReplacing function manages float data and it's mandatory to implement it..anyway in the end I followed your advise and used vectors!
Thanks again!!
|
|
|
|
|
Hello all,
I am new to MFC. I know how to create dialogbox by adding the new resource into the resource file. But i want to create DialogBox at runtime without adding it into the Resource.rc file. After creating dialogbox, i have to add Edit control, List Box over that dialog box.
How can i do this?
Thanks in advance.
|
|
|
|
|
Check this[^]
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
I would also recommend reading this post:
http://blogs.msdn.com/oldnewthing/archive/2005/04/29/412577.aspx[^]
and some previous ones.
Heck, I recommend reading every single one of his blog posts - you'll learn about lots of things you should and should not be doing.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Thanks for ur reply and suggesting me the link.
I read this post, but it is hard to understand for me, because i am new to MFC.
Please suggest the simplest way with example for creating dialog box without adding dialog resource into the resource.rc file.
|
|
|
|
|
Abhijit D. Babar wrote: because i am new to MFC
This is allllll windows stuff - MFC hardly comes in at all.
Abhijit D. Babar wrote: Please suggest the simplest way
There is no simple way - that's one of the reasons we use templates.
Abhijit D. Babar wrote: with example
Read a few months of the blog before the article I point you at - he builds up from very small examples to large complex ones. I could not write a better one - especially here on the fly.
Good luck,
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
|
hi all,
I am trying to convert from System::String to char *. After searching some forums and the msdn, i got these lines of code
const char * convertStrToChar(System::String ^ str)
{
CString tmpStr (str);
char* ConvToChar = new char[tmpStr.GetLength() + 2];
size_t Converted = 0;
wcstombs_s(&Converted, ConvToChar, tmpStr.GetLength()+1, tmpStr, _TRUNCATE);
return ConvToChar;
}
However, when i compilie it, these error messages appear :
Error 1 error LNK2028: unresolved token (0A00023F) "public: char * __clrcall Process::convertStrToChar(class System::String ^)" (?convertStrToChar@Process@@$$FQAMPADP$AAVString@System@@@Z) referenced in function "public: void __clrcall Process::showFaceDetect(class System::String ^,class System::String ^)" (?showFaceDetect@Process@@$$FQAMXP$AAVString@System@@0@Z) Process.obj
Error 2 error LNK2019: unresolved external symbol "public: char * __clrcall Process::convertStrToChar(class System::String ^)" (?convertStrToChar@Process@@$$FQAMPADP$AAVString@System@@@Z) referenced in function "public: void __clrcall Process::showFaceDetect(class System::String ^,class System::String ^)" (?showFaceDetect@Process@@$$FQAMXP$AAVString@System@@0@Z) Process.obj
I know this is a simple problem, but i cannot figure out why this bug happens. Can you give me some suggestion? Thanks
|
|
|
|
|
It looks to me (from the linker error) like the function signature you declared was:
char * convertStrToChar(System::String ^)
but you've actually implemented this function signature:
<big>const</big> char * convertStrToChar(System::String ^)
|
|
|
|
|
this is not C++, it is C++/CLI.
so it belongs to the Managed C++ forum
|
|
|
|
|
|
thank all. i just find out the solution. It 's only a stupid mistake
to toxcct: sorry. Will post in the right place next time
|
|
|
|
|
Hi,
I'm working in VS2005, C++. I'm pretty much a C++ newbie. I tend to write a lot of little console programs while i'm learning and testing things out. But of course the console disappears once the program is finished. it would be handy to be able to see the console output after the fact in the ide, and it seems to me there must be a way to do that - i just don't know it yet. any ideas?
Thanks,
Warre
Warren Sirota
www.warrensirota.com
|
|
|
|
|
Try any of the following suggestions
1. Put a getch() at the end of the program so that console application will wait for a key press before it exists.
2. Redirect the output to a text file. For eg in the project settings->debug->Program arguments, if you enter c:\output.txt, all the outputs from the program will go to the text file.
|
|
|
|
|
3: Get a Windows version of the "tee" utility so that the OP can get it both in a file and in the output. Helps with interactive apps or while debugging.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
I have a big problem porting one of my apps to VS 2005:
on one of the templates I get
"error C2906: 'const AFX_MSGMAP *CModWin<dialog>::GetThisMessageMap(void)': Explizite Spezialisierung erfordert 'Vorlage <>'" in the line BEGIN_MESSAGE_MAP(CModWin<cdialog>, CDialog)</cdialog>
the*.cpp looks like this
BEGIN_MESSAGE_MAP(CModWin<cdialog>, CDialog)
ON_COMMAND(IDOK, OnOK)
ON_COMMAND(IDCANCEL, OnCancel)
END_MESSAGE_MAP()
BEGIN_MESSAGE_MAP(CModWin<cresizabledialog>, CResizableDialog)
ON_COMMAND(IDOK, OnOK)
ON_COMMAND(IDCANCEL, OnCancel)
END_MESSAGE_MAP()
BEGIN_MESSAGE_MAP(CModSht<cpropertysheet>, CPropertySheet)
ON_COMMAND(IDOK, OnOK)
ON_COMMAND(IDCANCEL, OnCancel)
END_MESSAGE_MAP()
BEGIN_MESSAGE_MAP(CModSht<cresizablesheet>, CResizableSheet)
ON_COMMAND(IDOK, OnOK)
ON_COMMAND(IDCANCEL, OnCancel)
END_MESSAGE_MAP()
BEGIN_MESSAGE_MAP(CModSht<clistviewwalkerpreferencesheet>, CListViewWalkerPreferenceSheet)
ON_COMMAND(IDOK, OnOK)
ON_COMMAND(IDCANCEL, OnCancel)
END_MESSAGE_MAP()
BEGIN_MESSAGE_MAP(CModSht<clistviewwalkerpropertysheet>, CListViewWalkerPropertySheet)
ON_COMMAND(IDOK, OnOK)
ON_COMMAND(IDCANCEL, OnCancel)
END_MESSAGE_MAP()
BEGIN_MESSAGE_MAP(CModWlkSht<clistviewwalkerpreferencesheet>, CListViewWalkerPreferenceSheet)
ON_COMMAND(IDOK, OnOK)
ON_COMMAND(IDCANCEL, OnCancel)
END_MESSAGE_MAP()
BEGIN_MESSAGE_MAP(CModWlkSht<clistviewwalkerpropertysheet>, CListViewWalkerPropertySheet)
ON_COMMAND(IDOK, OnOK)
ON_COMMAND(IDCANCEL, OnCancel)
END_MESSAGE_MAP()
</clistviewwalkerpropertysheet></clistviewwalkerpreferencesheet></clistviewwalkerpropertysheet></clistviewwalkerpreferencesheet></cresizablesheet></cpropertysheet></cresizabledialog></cdialog>
the *.h like this
template<class window="">
class CModWnd : public WINDOW {
public:
CModWnd() {
m_bDeleteOnClose = TRUE;
m_bActive = FALSE;
}
void OpenDialog(UINT bDeleteOnClose = TRUE) {
m_bDeleteOnClose = bDeleteOnClose;
if (!m_bActive){
m_bActive = TRUE;
CallCreate();
}
ShowWindow(SW_SHOW);
SetFocus();
}
virtual void CloseDialog() {
if (m_bActive)
DestroyWindow();
}
bool IsDialogOpen() {
return (m_bActive == TRUE);
}
protected:
virtual void CallCreate() = 0;
virtual BOOL OnInitDialog(){
UINT old_nFlags = m_nFlags;
m_nFlags |= WF_CONTINUEMODAL;
BOOL bResult = WINDOW::OnInitDialog();
m_nFlags = old_nFlags;
return bResult;
}
afx_msg void OnOK() {
UpdateData();
DestroyWindow();
}
afx_msg void OnCancel() {
DestroyWindow();
}
afx_msg void PostNcDestroy() {
m_bActive = FALSE;
if (m_bDeleteOnClose)
delete this;
}
BOOL m_bActive;
BOOL m_bDeleteOnClose;
};
template<class dialog="">
class CModWin : public CModWnd<dialog> {
public:
CModWin(UINT nIDTemplate, CWnd* = NULL):CModWnd<dialog>(){
m_nIDTemplate = nIDTemplate;
}
protected:
virtual void CallCreate() {
Create(m_nIDTemplate, GetEmuleDlg());
}
DECLARE_MESSAGE_MAP()
UINT m_nIDTemplate;
};
template<class sheet="">
class CModSht : public CModWnd<sheet> {
public:
CModSht():CModWnd<sheet>() {}
protected:
virtual void CallCreate() {
Create(GetEmuleDlg(), WS_SYSMENU | WS_POPUP | WS_CAPTION | DS_MODALFRAME | DS_CONTEXTHELP | WS_VISIBLE | WS_MINIMIZEBOX);
}
virtual BOOL OnInitDialog(){
BOOL old_bModeless = m_bModeless;
m_bModeless = FALSE;
BOOL bResult = CModWnd<sheet>::OnInitDialog();
m_bModeless = old_bModeless;
return bResult;
}
afx_msg void OnOK() {
SendMessage(WM_COMMAND, ID_APPLY_NOW);
CModWnd<sheet>::OnOK();
}
DECLARE_MESSAGE_MAP()
};
template<class wlk_sheet="">
class CModWlkSht : public CModSht<wlk_sheet> {
public:
CModWlkSht(CListCtrlItemWalk* pListCtrl):CModSht<wlk_sheet>() {
m_pListCtrl = pListCtrl;
}
void DropControl() {
m_pListCtrl = NULL;
m_bDeleteOnClose = TRUE;
if(!IsDialogOpen())
delete this;
}
protected:
DECLARE_MESSAGE_MAP()
};
typedef CModWin<cdialog> CModDialog;
typedef CModWin<cresizabledialog> CModResizableDialog;
typedef CModSht<cpropertysheet> CModPropertySheet;
typedef CModSht<cresizablesheet> CModResizableSheet;
typedef CModWlkSht<clistviewwalkerpreferencesheet> CModListViewWalkerPreferenceSheet;
typedef CModWlkSht<clistviewwalkerpropertysheet> CModListViewWalkerPropertySheet;
</clistviewwalkerpropertysheet></clistviewwalkerpreferencesheet></cresizablesheet></cpropertysheet></cresizabledialog></cdialog></wlk_sheet></wlk_sheet></class></sheet></sheet></sheet></sheet></class></dialog></dialog></class></class>
the whole project is available on NeoMule.sf.net
Any ideas how I can fix this anoying problem?
|
|
|
|
|
It would help if you'd escaped your code so we could see the template parameters...
|
|
|
|
|
|
See #5 in this page[^].
You're expecting this community to download a 9MB zip file of dubious origin and find the source code you're asking about (in a 9MB zip file, remember) rather than YOU spending 30 seconds of YOUR time posting the source code in a readable form so YOU can get an answer to YOUR problem. Na. Don't think so.
|
|
|
|
|
Well the 1st template that causes the problem takes as argument a CDialog also CPropertySheet, thats in MFC, the later CResizableDialog CResizableSheet are defined in the resizablelib with witch I'm not that famillair with. and the last 4 that are specific to my code well the compiler even dont get that far or it only has a problem with the one where CDialog is apssed.
So I'm pritty sure that i postet all needed to solve my problem I hope.
Ofcause I could post also CListViewWalkerPreferenceSheet CListViewWalkerPropertySheet CListViewWalkerPreferenceSheet CListViewWalkerPropertySheet but that would be quite long and I already got a automated notice that my post is a bit to long, so i'd rather don't make it even longer.
|
|
|
|
|
OK - the error message makes sense. Lets look at the start of the definition of BEGIN_MESSAGE_MAP :
#define BEGIN_MESSAGE_MAP(theClass, baseClass) \
const AFX_MSGMAP* PASCAL theClass::_GetBaseMessageMap() \
{ return &baseClass::messageMap; } \
Now, let's look at how NeoMule uses BEGIN_MESSAGE_MAP :
BEGIN_MESSAGE_MAP(CModWin<CDialog>, CDialog)
If we expand the start of the BEGIN_MESSAGE_MAP macro with those parameters, we get this:
const AFX_MSGMAP* PASCAL CModWin<CDialog>::_GetBaseMessageMap()
{ return &CDialog::messageMap; }
Visual C++ is quite correct - this is a template specialisation, so should be:
template<>
const AFX_MSGMAP* PASCAL CModWin<CDialog>::_GetBaseMessageMap()
{ return &CDialog::messageMap; }
I'm guessing that this is one place where VS2005 is more standards compliant than VS2003. Certainly, g++ 4.0.1 on my iBook agrees with VS2005.
What can you do about it...not sure, really. MFC was designed a long, long time before templates became common, so it's not too surprising that its infrastructure can't cope with templates. Either just go back to VS2003 for building NewMule or...mmm, make lots of changes to the code.
|
|
|
|