Need help with a dll!

This is a discussion on Need help with a dll! within the C++ Programming forums, part of the General Programming Boards category; I am currently building a small dll that makes your pc "beep". I am using it with another language called ...

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    4

    Exclamation Need help with a dll!

    I am currently building a small dll that makes your pc "beep". I am using it with another language called gml. My gml syntax is correct.

    There are no errors in the code but my pc refuses to "beep".

    Here is my c++ code:

    dllmain.cpp:
    Code:
    #include "dll.h"
    #include <string>
    #include <cstdlib>
    #include <windows.h>
    
    export double bp(int pitch,int length) { 
           return Beep(pitch,length); 
           }
    dll.h:
    Code:
    #ifndef _DLL_H_
    #define _DLL_H_
    #define export extern "C" __declspec (dllexport)
    
    #if BUILDING_DLL
    # define DLLIMPORT __declspec (dllexport)
    #else /* Not BUILDING_DLL */
    # define DLLIMPORT __declspec (dllimport)
    #endif /* Not BUILDING_DLL */
    
    
    class DLLIMPORT DllClass
    {
      public:
        DllClass();
        virtual ~DllClass(void);
    
      private:
    
    };
    
    
    #endif /* _DLL_H_ */

    Any help would be appreciated.

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Have you tried calling Beep directly with the same arguments (hz and length) and you hear something. Check the return value for errors (Beep returns a bool, not double).
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User
    Join Date
    Mar 2006
    Posts
    4

    ok...

    could you give me a code example? I'm a beginner when it comes to dlls.

  4. #4
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Code:
    Beep(5000, 1000);
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  5. #5
    Registered User
    Join Date
    Mar 2006
    Posts
    4
    The point of the dll is that the user defines what values Beep takes.

  6. #6
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    You can take baby steps until you attain full functionality.

    Right now, it is important for you to make sure your function is even being called, and that it returns no errors.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. non-MFC DLL with MFC app question.
    By Kempelen in forum Windows Programming
    Replies: 10
    Last Post: 08-20-2008, 07:11 AM
  2. dll communicating between each other
    By cloudy in forum C++ Programming
    Replies: 5
    Last Post: 06-17-2005, 02:20 AM
  3. DLL and std::string woes!
    By Magos in forum C++ Programming
    Replies: 7
    Last Post: 09-08-2004, 12:34 PM
  4. Using class with DLL
    By greg2 in forum C++ Programming
    Replies: 2
    Last Post: 09-12-2003, 05:24 AM
  5. .lib vs .h vs .dll
    By Shadow12345 in forum C++ Programming
    Replies: 13
    Last Post: 01-01-2003, 04:29 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21