我用WIN32控制台程序创建了一个项目
里边有个很简单的main()函数
然后用在资源里添加了一个IDD_DIALOG对话框,对话框里放了一个 Media Player控件我想在main()函数里运行着运行着 就把那个 对话框突然给 show 出来  不知道怎么做请大家指点   main()函数的代码我贴在下面#include "stdafx.h"
#include "windows.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
// HWND hwnd;
// FindWindow(IDD_DIALOG1);
// ShowWindow(hwnd,true);
// FreeLibrary(hInstance); printf("End.\n");
return 0;
}

解决方案 »

  1.   

    用ClassWizard 用资源 IDD_DIALOG1 建立对话框类,在main函数中
    #include "selfmediaplayerDlg.h" // 你自己定义的对话框类,对话框资源ID是 IDD_DIALOG1
    int _tmain(int argc, _TCHAR* argv[])
    {
    // HWND hwnd;
    // FindWindow(IDD_DIALOG1);
    // ShowWindow(hwnd,true);
    // FreeLibrary(hInstance);
             CSelfMediaplayerDlg dlg ;
             int nResponse = dlg.DoModal();
            
    printf("End.\n");
    return 0;
    }
    就可以显示你的对话框程序了
      

  2.   

    编译出错  d:\Microsoft Visual Studio.NET\Vc7\atlmfc\include\afxv_w32.h(18) : fatal error C1189: #error :  WINDOWS.H already included.  MFC apps must not #include <windows.h>这是什么意思呀  我头文件里并没有声明“windows.h”#include "stdafx.h"
    #include "myDialog.h"
    #include <iostream>
    using namespace std;typedef int (*SQRTPROC)(char *,char*);int _tmain(int argc, _TCHAR* argv[])
    {
    myDialog mt;
    mt.DoModal(); HINSTANCE hInstance;
    SQRTPROC pFunction;
    hInstance=::LoadLibrary("d:\\workspace\\pcmtowav\\djcvt.dll");
    pFunction=(SQRTPROC)::GetProcAddress(hInstance,"PcmtoWave");
    if (pFunction!=NULL) 
    {
    char PcmFileName[]="";
    char WaveFileName[]="";
    cout<<"Input the Pcm file name"<<endl;
    cin>>PcmFileName;
    cout<<"Input the Wave file name"<<endl;
    cin>>WaveFileName; char *a=PcmFileName;
    char *b=WaveFileName;  int result=(*pFunction)(a,b);
    if(result==1)
    printf("Success.\n");
    else
    {
    printf("Error orcured.\n");
    return -1;
    } } printf("End.\n");
    return 0;
    }