如何用SDK实现如下程序:运行后自动在指定目录生成一个mp3文件(此文件是事先给定的)?

解决方案 »

  1.   

    Shellapi.h:
            SHFileOperationCopies, moves, renames, or deletes a file system object. int SHFileOperation(
        LPSHFILEOPSTRUCT lpFileOp
    );
      

  2.   

    MoveFile
    The MoveFile function moves an existing file or a directory, including its children. To specify how to move the file, use the MoveFileEx function. BOOL MoveFile(
      LPCTSTR lpExistingFileName, // file name
      LPCTSTR lpNewFileName       // new file name
    );
      

  3.   

    我的意思不是MoveFile,而是当该程序在一台机上运行时,自动生成一个mp3文件,根本看不到原文件。
      

  4.   

    CFile f;
    f.Open();
    f.Write();
    f.Close();
      

  5.   

    那用标准C的文件I/0咯
    fopen
    fread
    fwrite
    fclose
      

  6.   

    你到底要什么,在内存中产生你个文件,没有人能看到
    CreateFile
    ////////////////////////////////////////////////
    HANDLE CreateFile(
      LPCTSTR lpFileName,          // pointer to name of the file
      DWORD dwDesiredAccess,       // access (read-write) mode
      DWORD dwShareMode,           // share mode
      LPSECURITY_ATTRIBUTES lpSecurityAttributes,
                                   // pointer to security attributes
      DWORD dwCreationDisposition,  // how to create
      DWORD dwFlagsAndAttributes,  // file attributes
      HANDLE hTemplateFile         // handle to file with attributes to 
                                   // copy
    );
      

  7.   

    keenleung(Sword Master) and  DoubleJiang(Double) are correct!you can do it such as follow:FILE *fp = fopen("yourname.mp3","w+");
    fwrite(buffer,1,size,fp);
    fclose(fp);如果还想将此文件生成在指定的路径下,也是可以的,有大把的API函数可以调用,比如
    CreateDirectory, GetCurrentDirectory, GetSystemDirectory.......
      

  8.   

    yourname.mp3已经作为资源了,还能用FILE *fp = fopen("yourname.mp3","w+");吗?
      

  9.   

    先:
    FILE *fp = fopen("yourname.mp3","w+");
    fwrite(buffer,1,size,fp);
    fclose(fp);
    然后:CreateDirectory, GetCurrentDirectory, GetSystemDirectory.......
      

  10.   

    你到底是什么意思啊如果MP3文件的内容实现给定了的话CreateFile
    ReadFile
    WriteFile绝对够你用了。
      

  11.   

    我试过,连接到资源里好象不能用FILE *fp = fopen("yourname.mp3","w+");
      

  12.   

    fopen
    fread
    fwrite
    fclose
      

  13.   

    我的意思是资源中有一个mymp3.mp3文件,怎么操作使其释放出来,是不是要先loadresource还是loadfromresource一下?然后fopen等函数如何应用?
      

  14.   

    HRSRC hResource = FindResource(hModule,lpszName,lpszType);/first fine the resource
    HGLOBAL hgbRes = LoadResource(hModule, hResource);//load the resource
    LPVOID lpRes = LockResource(hgbRes);//get a pointer to the resourceHANDLE hFile = CreateFile(...);
    DWORD dwWritten;
    WriteFile(hFile, lpRes, SizeofResource(hModule, hResource), dwWritten,NULL)//or 
                                                   // you can use overlapped IO
    CloseHandle(hFile);
      

  15.   

    不明白你说什么
    如果你文件事先存在,把他拷贝过来就可以了SHFILEOPSTRUCT FileOp;
    FileOp.hwnd = m_hWnd;
    //执行文件操作    
    FileOp.wFunc = FO_DELETE;
         
    SHFileOperation(&FileOp);
      

  16.   

    事先是存在的,要不mp3得自己编码,而不能直接联入资源,我的目的是联编后的文件不依赖原来的那首mp3运行.yndfcd(YNDFCD)的方法我先去试试.
      

  17.   

    HRSRC hResource = FindResource(hModule,lpszName,lpszType);中,lpszName应该怎么填?比如,把love.mp3作为资源连接进去了,是不是就填"love.mp3"还是其ID?我都试过,都不行啊。
      

  18.   

    是不是这样:HRSRC hResource = FindResource(hInstance,"love.mp3","MP3");//hResource 得不到有效的值
    还是应该怎么写?