никак немогу справится с этими Функциями. Даже при выполнении всех требований выдаётся ошибка:
"Compiling resources...
Compiling...
praktikaDlg.cpp
Linking...
praktikaDlg.obj : error LNK2001: unresolved external symbol __imp__PlaySoundA@12
Debug/praktika.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
praktika.exe — 2 error(s), 0 warning(s)"
Код программы:
"// praktikaDlg.cpp : implementation file
//
#include "stdafx.h"
#include "praktika.h"
#include "praktikaDlg.h"
#include <mmsystem.h>
#include "winbase.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// CAboutDlg dialog used for App About
CFileFind finder;
CString test;
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPraktikaDlg dialog
CPraktikaDlg::CPraktikaDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPraktikaDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPraktikaDlg)
m_puty = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CPraktikaDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPraktikaDlg)
DDX_Control(pDX, IDC_LIST2, m_wibor);
DDX_Control(pDX, IDC_LIST1, m_PLAYLIST);
DDX_Text(pDX, IDC_EDIT_PUTY, m_puty);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPraktikaDlg, CDialog)
//{{AFX_MSG_MAP(CPraktikaDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON_PAUSE, OnButtonPause)
ON_BN_CLICKED(IDC_BUTTON_PLAY, OnButtonPlay)
ON_BN_CLICKED(IDC_BUTTON_STOP, OnButtonStop)
ON_BN_CLICKED(IDC_BUTTON_PUT, OnButtonPut)
ON_LBN_DBLCLK(IDC_LIST2, OnDblclkWIBORPESEN)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPraktikaDlg message handlers
BOOL CPraktikaDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
return TRUE; // return TRUE unless you set the focus to a control
}
void CPraktikaDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CPraktikaDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() — cxIcon + 1) / 2;
int y = (rect.Height() — cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CPraktikaDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CPraktikaDlg::OnButtonPause()
{
MessageBeep(MB_ICONASTERISK);
}
void CPraktikaDlg::OnButtonPlay()
{
LPSTR lpRes;
HRSRC hResInfo;
HGLOBAL hRes;
// Find the WAVE resource.
hResInfo = FindResource(NULL, MAKEINTRESOURCE(1), RT_VERSION);
// Load the WAVE resource.
hRes = LoadResource(AfxGetInstanceHandle(),hResInfo);
// Lock the WAVE resource and play it.
lpRes =LPSTR (LockResource(hRes));
if (lpRes != NULL)
{
#ifdef WIN32
PlaySound("chord.wav",NULL,SND_FILENAME|SND_ASYNC);
#endif
UnlockResource(hRes);
}
AfxMessageBox(lpRes);
// Free the WAVE resource and return success or failure.
FreeResource(hRes);
}
void CPraktikaDlg::OnButtonStop()
{
MessageBeep(MB_OK);
}
void CPraktikaDlg::OnButtonPut()
{
UpdateData(true);
m_wibor.ResetContent();
test=m_puty;
AfxMessageBox(test);
int b=finder.FindFile(test,0);
if(b)
{
while(finder.FindNextFile())
{
m_wibor.AddString(finder.GetFileName());
CString as;
CString bs="wav";
CString ds=finder.GetFileName();
as=ds.Right(3);
if(bs==as)
m_PLAYLIST.AddString(finder.GetFileName());
else
{}
}
}
else
AfxMessageBox("error");
int w;
w=test.Find("*.*",0);
test=test.Mid(0,w);
UpdateData(false);
}
void CPraktikaDlg::OnDblclkWIBORPESEN()
{
m_PLAYLIST.ResetContent();
int w,e;
int a=0;
CString str;
CString W;
W=test;
a=m_wibor.GetCurSel();
m_wibor.GetText(a,str);
test+=str;
test+="/*.*";
int b=finder.FindFile(test,0);
m_wibor.ResetContent();
if(b)
{
while(finder.FindNextFile())
{
m_wibor.AddString(finder.GetFileName());
CString as;
CString bs="wav";
CString ds=finder.GetFileName();
as=ds.Right(3);
if(bs==as)
m_PLAYLIST.AddString(finder.GetFileName());
else
{}
}
w=test.Find("*.*",0);
e=test.Find("/*.*",0);
CString wer;
wer=test.Mid(0,e);
test=test.Mid(0,w);
/////////////////////////////////////////////////////////////////////////////
}
else
{
///////////////////////////////////////////////////////////////////////
//m_PLAYLIST.ResetContent();
AfxMessageBox("error: dalee net failov");
W+="*.*";
int d=finder.FindFile(W,0);
if(d)
{
while(finder.FindNextFile())
{
m_wibor.AddString(finder.GetFileName());
CString as;
CString bs="wav";
CString ds=finder.GetFileName();
as=ds.Right(3);
if(bs==as)
m_PLAYLIST.AddString(finder.GetFileName());
else
{}
}
}
///////////////////////////////////////////////////////////////////////
w=test.Find("*.*",0);
e=test.Find("/*.*",0);
CString wer;
wer=test.Mid(0,e);
test=test.Mid(0,w);
///////////////////////////////////////////////////////////////////////
w=W.Find("*.*",0);
test=W.Mid(0,w);
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
}
/////////////////////////////////////////////////////////////////////////////
UpdateData(false);
}"
Пожалуйста, если вы сталкивались с такой ошибкой, то помогите молодому юзеру. Зарание большое спасибо.
28.08.05 19:31: Перенесено модератором из 'C/C++' — Павел Кузнецов
People who are more than casually interested in computers should have at least some idea of what the underlying hardware is like. Otherwise the programs they write will be pretty weird (c) D.Knuth