locked
How do I convert an application exe to a dll RRS feed

  • Question

  • Hi All,

    I want to convert an existing application exe to a COM Dll. I am a newbie in this field and any help in this direction would be highly appreciated.
    Thanks in advance 
    Thursday, September 11, 2008 12:24 AM

Answers

  • Alternatively to Vegan's suggestion, on the project properties, General, Configuration Type -> Change the combo box from 'Application (exe)' to 'Dynamic Library (dll)'.

    On the point of using COM. I would highly recommend getting a good book on COM programming or looking at one of these beginner internet examples:

    Code Project - Introduces COM
    CodeGuru - Introduces ActiveX

    but I warn you: COM is a pretty complicated beast to master and not for the faint hearted!
    • Marked as answer by Yan-Fei Wei Wednesday, September 17, 2008 7:06 AM
    Thursday, September 11, 2008 11:18 AM

All replies

  • Alternatively to Vegan's suggestion, on the project properties, General, Configuration Type -> Change the combo box from 'Application (exe)' to 'Dynamic Library (dll)'.

    On the point of using COM. I would highly recommend getting a good book on COM programming or looking at one of these beginner internet examples:

    Code Project - Introduces COM
    CodeGuru - Introduces ActiveX

    but I warn you: COM is a pretty complicated beast to master and not for the faint hearted!
    • Marked as answer by Yan-Fei Wei Wednesday, September 17, 2008 7:06 AM
    Thursday, September 11, 2008 11:18 AM
  • Neil Tippett said:

    Alternatively to Vegan's suggestion, on the project properties, General, Configuration Type -> Change the combo box from 'Application (exe)' to 'Dynamic Library (dll)'.

    On the point of using COM. I would highly recommend getting a good book on COM programming or looking at one of these beginner internet examples:

    Code Project - Introduces COM
    CodeGuru - Introduces ActiveX

    but I warn you: COM is a pretty complicated beast to master and not for the faint hearted!





    Are you sure That simple selection from exe to dll will convert your exe to dll.
    Thanx
    Rupesh Shukla
    Thursday, September 11, 2008 4:46 PM
  • Pretty certain - yes.

    The main() will be ignored as it is no longer required. If on the other hand you were going from DLL to EXE it wouldn't work as you'd need to define lots of fancy stuff such as the main entry point.
    Thursday, September 11, 2008 4:49 PM
  • Sorry Again i am asking same question are you sure that by simple selection from exe to dll will made it a dll .
    Again have a look on OP Post . i had never tried that but i am sure directly you can't convert a exe to a dll. Remember you already has a project  a exe.

    Thanx
    Neil Tippett said:

    Pretty certain - yes.

    The main() will be ignored as it is no longer required. If on the other hand you were going from DLL to EXE it wouldn't work as you'd need to define lots of fancy stuff such as the main entry point.




    Rupesh Shukla
    Thursday, September 11, 2008 5:45 PM
  • I think we're getting a little off topic here Rupesh, but yes, changing that setting will build a dll rather than an exe. That is not to say that it will necessarily compile first time and you certain won't have made a COM dll by just changing that setting nor will your classes by exposed outside of the DLL. Although all of these points would apply if you took Vegan's suggestion.

    If you don't believe me try it - Make a very simple console application (perhaps the VS generated conole), change the setting and compile.
    Thursday, September 11, 2008 6:17 PM
  • Yes Rupesh, what Neil mentions is correct. I can change a project from .EXE to a DLL by just changing the settings. I recently changed my MFC .EXE app to MFC .DLL. I didn't have to change anything and the code compiles with no errors

    But by changing settings you can't directly use the DLL. You will have to add a few lines of code to use the methods inside DLL.

    For assistance on how to make a converted DLL functional you can refer to this useful article:

    http://www.codeguru.com/cpp/cpp/cpp_mfc/tutorials/article.php/c4017
    • Edited by gsumm Thursday, September 11, 2008 10:45 PM added URL to a useful resource
    Thursday, September 11, 2008 10:13 PM