Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++ 2005
|
Visual C++ 2005 For discussion of Visual C++ 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 26th, 2007, 11:29 AM
Registered User
 
Join Date: Mar 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can't get to MessageBox in dll

I'm pretty sure that I'm missing an include, or a reference, or something.

I'm quite new to Visual Studio 2005, so it's probably something like the above.

My problem is that I've got a Class Library project that creates a .dll file.

in the solution explorer I went to the project and did an Add->Class->CLR Windows Form. I ended up with class loggerClass : form, which makes sense.

For the life of me, I don't seem to be able to get this class to call MessageBox.Show("string"); ! In the loggerClass.h header file it's got:

     using namespace System::Windows::Forms;

and I declare public function void myShow(String ^ a);

Then in loggerClass.cpp I've got

(in the right namespace)

void loggerClass::myShow(String ^ a)
{
    MessageBox.Show(a); // error C2143: syntax error : missing ';' before '.'
    System::Windows::Forms::MessageBox.Show(a); // same error
}


I've tried a dozen different ways to get this to work, but no luck at all.

The crazy thing is that if I add a C# class to the project (using the technique at http://blogs.msdn.com/frankpr/archiv...27/198918.aspx ) I can call MessageBox directly from the C# class, simply as

     MessageBox.Show(a);

no complaints at all. And I'm compiling this with the command-line compiler so there aren't any special command-line options at work.








Similar Threads
Thread Thread Starter Forum Replies Last Post
MessageBox help Barkils C# 1 July 16th, 2007 09:30 PM
Install problems - VS 6.0 on XP SCRRUN.DLL PDM.DLL jeff4444 Visual C++ 0 December 6th, 2006 08:48 PM
Messagebox mh VB.NET 27 March 31st, 2005 01:41 PM
DLL & Excel - keep having to reset DLL reference! James Diamond Pro VB 6 2 May 25th, 2004 03:37 AM
MessageBox asbayani ASP.NET 1.0 and 1.1 Basics 3 July 29th, 2003 03:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.