-
May 8th, 2012, 07:22 AM
#1
[RESOLVED] How to use delegate in vc++ 2010?
Hi,
I need to convert the following C#, delegate statement to VC++2010...
Is it possible..?
notifyIcon1.BalloonTipClosed += delegate { notifyIcon1.Dispose(); };
Thanks....
-
May 8th, 2012, 07:32 AM
#2
Re: How to use delegate in vc++ 2010?
Well you could use CALLBACKS or function pointers.
The syntax won't be the same, but you will get close.
http://www.cprogramming.com/tutorial...-pointers.html
ahoodin
To keep the plot moving, that's why.
-
May 8th, 2012, 03:35 PM
#3
Re: How to use delegate in vc++ 2010?
C++0x (or whatever they're calling it now):
Code:
notifyIcon1::BalloonTipClosed += [&] ()
{
delete notifyIcon1;
};
C++/CLI:
Code:
void test()
{
notifyIcon1::BalloonTipClosed += AnonymousMethod1;
}
void AnonymousMethod1()
{
delete notifyIcon1;
}
-
May 9th, 2012, 01:14 AM
#4
Re: How to use delegate in vc++ 2010?
To David Anton:
My heartiest thanks to those kindness... Your reply cleared me...
Thanks Again..
-
May 15th, 2012, 07:21 PM
#5
Re: [RESOLVED] How to use delegate in vc++ 2010?
Similar question. My app worked in debug build, but once i moved to release build the namespace of the C# DLL I'm using can not be found. What do i need to do to fix.
Thanks in advance
Code:
#include "stdafx.h"
#include "BL Control Test.h"
#include "BL Control TestDlg.h"
using namespace ATL;
using namespace USBHIDDRIVER;
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CBLControlTestApp
BEGIN_MESSAGE_MAP(CBLControlTestApp, CWinAppEx)
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()
// CBLControlTestApp construction
CBLControlTestApp::CBLControlTestApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
USBInterface ^ usb = gcnew USBInterface( "vid_0123", "pid_0456");
if ( usb->Connect() == FALSE )
MessageBox( (HWND)this->m_pMainWnd, _T("Failed to connect"), _T("Fail"), MB_ICONEXCLAMATION);
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|