开发者

Using MFC and ATL libraries without Visual Studio

开发者 https://www.devze.com 2023-03-17 01:17 出处:网络
My question is if I can use MFC and ATL libraries that come with PSDK Windows Server 2003 R2, without Visual Studio. I mean only at the command prompt with BCC32.exe or CL.exe?

My question is if I can use MFC and ATL libraries that come with PSDK Windows Server 2003 R2, without Visual Studio. I mean only at the command prompt with BCC32.exe or CL.exe?

I have found MFC and ATL libraries in the PSDK Windows Server 2003 R2 but I does not know if these libraries can be used without Visual Stuio IDE! What I need t开发者_运维技巧o do before using MFC and ATL at the command prompt?

Thanks!


If you have all the headers, and either the source code or compiled version of the rest, then yes it can be used without Visual Studio. Visual Studio is just an IDE that invokes the compiler etc. for you. With command line tools you do that job yourself.

Here's a minimal MFC program that you can try out:

#define WINVER  0x0500      // Windows 2000 and up.
#include <afxwin.h>         // MFC core and standard components

typedef CFrameWnd   MainWindow;

class App
    : public CWinApp
{
private:
    bool createTheMainWindow()
    {
        static char const title[]   = "A general top level MFC window";
        MainWindow* const pWnd      =
            new MainWindow;
        if( !pWnd ) { return false; }   // Pre-standard 'new' in MFC...
        m_pMainWnd = pWnd;
        pWnd->Create( NULL, title );
        return true;
    }

public:
    virtual BOOL InitInstance()
    {
        CWinApp::InitInstance();

        if( !createTheMainWindow() ) { return false; }

        m_pMainWnd->ShowWindow( SW_SHOW );
        m_pMainWnd->UpdateWindow();
        return true;
    }
};

App theApp;

Cheers & hth.,


No you can't, since some functionality relies on the Visual Studio compiler specific behavior. For example the way trampolines are used to map window handles to objects.

I'm assuming that you by "can be used without Visual Stuio IDE" you actually mean "with another compiler", since you mention the Borland compiler. Of course you can write C++ in a text editor and compile those files from the command line, not using the IDE, but what you want is using another compiler, right? (the IDE and the compiler are related but not the same).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号