including windows.h in the Form1.h file

Hello ,
I have a problem that is :
in a VC++ >>WindowsForms.Net 
I have included the <winodws.h> file in my Form1.h file
then I tried to use the System::Windows::Forms::MessageBox::Show(...) method,
but I recieved an error message that the MessageBox class is not a member of Forms namespace .

note that I need the to include that file to load an old dll file (unmanaged)


Answer this question

including windows.h in the Form1.h file

  • AndyHammer

    Thanks ,
    but am using an unmanaged dll file and I have loaded it using the LoadLibrary()function which is contained in windows.h file
    the load operation has succeeded and I can call its functions but I just have a problem with calling System::Windows::Forms::MessageBox::Show() static method .

    thanks again Mr Zeta >>>
     

  • thehomerj

    Since you used the fully-qualified name, I'd have to suspect that you didn't correctly reference the managed DLL. Or, possibly, Visual Studio can't find it because you didn't specify the location in the property pages.
    In C++ .NET, you reference the DLL with the #using directive, generally at the beginning of your source file. This DLL is: System.Windows.Forms.dll
    Including the <windows.h> file in a .NET Forms project will cause some name collisions here and there, so, I would use fully-qualified names like you are doing.
    To set the search path for assemblies that you have referenced in your project, select Tools and Options from the Menu, and then open the Projects folder. You want to select VC++ Directories, and then (there is a drop-down menu available in the upper area of the page), select Reference Files and set the path to the location of the .NET Framework assemblies (for some reason there is no default setting). This value corresponds to environment variable LIBPATH (which can also be specified in the command line).
    Read this, about the Dialog box:
    http://msdn.microsoft.com/library/default.asp url=/library/en-us/vsintro7/html/vxurfVCDirectoriesProjectsOptionsDialogBox.asp

  • including windows.h in the Form1.h file