CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2011
    Posts
    73

    [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....

  2. #2
    Join Date
    Mar 2001
    Posts
    2,529

    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.

  3. #3
    Join Date
    Aug 2005
    Posts
    198

    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;
    }
    David Anton
    Convert between VB, C#, C++, & Java
    www.tangiblesoftwaresolutions.com
    Instant C# - VB to C# Converter
    Instant VB - C# to VB Converter

  4. #4
    Join Date
    Dec 2011
    Posts
    73

    Resolved Re: How to use delegate in vc++ 2010?

    To David Anton:
    My heartiest thanks to those kindness... Your reply cleared me...
    Thanks Again..

  5. #5
    Join Date
    May 2012
    Posts
    1

    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
  •  





Click Here to Expand Forum to Full Width

Featured