|
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.
|
|
|
|
|
Function SetWindowText does not show '&' in following example:
pInfo->SetWindowText ("Father & son");
Even if I try it with \x26 instead of '&' it diaplays a blank instead of the '&'.
|
|
|
|
|
|
did u try pInfo->SetWindowText ("Father && son");
|
|
|
|
|
Hi,
thanks a lot. The "&&" works!
|
|
|
|
|
Hi,
using Vista with a standard user (no admin), I cannot start a service using Win32 with OpenSCManager, OpenService etc.
How can I modify the user rights temporary to admin rights, so the functions work properly?
Regards,
Stefan
|
|
|
|
|
You can use the CreateProcessAsUser API to run a process admin and use OpenSCManager from within that process.
«_Superman_»
|
|
|
|
|
Could you provide me with a quick example? Sorry I'm not that into services and user access rights
|
|
|
|
|
|
Hello clever programmers,
I am very new to C++, i shall say a begineer. I am trying to do a project on designing an interactive application for skills training.
My idea is as follows:
I would/have developed an interface (HCI) screen using Visual Studio C++ 2008.
I have created a relational database in Microsoft Access 2007.
1) What I'd like to do is to display the HCI to the user then ask him to enter her name,
2) Then I'de like to get scenarios from my access table to display via a drop down menu. Once, this is done, the user selects the scenario and submits send button for processing.
3) Then I'd like the computer to process the answer and reply back, the reply will come from the access database and shown on the HCI.
4) The process continues until 10 interactions have taken place then a decision for the winner is made by the computer.
What I need is some guidelines on what features of Visual studio I can use to develop this. Keep in mind, I only want to retrieve a record on request. Should I use any wizards to get started....
Pleeease helppp....
Many Thanks for your help,
HK
|
|
|
|
|
Check this.[^] It might be helpful
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Hi all,
I am using SetLayeredWindowAttributes in order to create an outlook like message.
I have a special show function which moves (with SetwindowPos) the dialog and changes its opcaity while moving.
The dialog fades in (both by movement and opacity change) around the system tray area, and after 3 seconds fades out.
When i call the show function for the first time, all controls on the dialog (bitmap, static text etc.) appear as black boxes, until the fade in effect is done, then he controls appear properly.
Consequent calls to the show function works properly - it shows the controls through all the fade in and fade out procedure.
If i create a thread and call the show function from it then it works fine for the first call also.
I would appriciate it if someone can explain the differnece between calling the function from another thread or form the window thread, the drawing procedure of a dialog and may be offer a way to solve this problem without creating a new thread.
Thanks
Shimon
|
|
|
|
|
One thing that can be tried first is calling UpdateWindow after the first show function call.
- ns -
|
|
|
|