|
Albedo wrote:
_T("ir_end.wav")
Is the ir_end.wav file in the executable directory?
-Nick Parker
|
|
|
|
|
Well...ok, this is going to make me sound like a moron, but what is the executable directory and how do I put something into it?
This is my first "serious" program using MFC, so I'm not quite familiar with everything yet.
|
|
|
|
|
Albedo wrote:
but what is the executable directory and how do I put something into it?
The executable directory is the location on the hard drive where your executable program is running from. I am not familiar with SetSound , you may try the PlaySound function from Windows Media:
BOOL PlaySound(
LPCSTR pszSound,
HMODULE hmod,
DWORD fdwSound
);
-Nick Parker
|
|
|
|
|
Agh...problems upon problems! Ok, I tried using PlaySound() and made sure to put the file into the executable directory, but it still doesn't work. There are no errors with code (at least I don't think so, so I'll give a run-down). Here's what I have done so far:
#include <mmsystem.h>
#include <windows.h> (I don't know whether I actually need this one)
I also made sure to add the resource Winmm.lib to my program (both debug and release versions). I also put the .wav file itself into the executable program (C:\Program Files\Microsoft Visual Studio\MyProjects\Same Game\another game). Furthermore, I also added the .wav file directly to my project (Using Project->Add to Project->Files). Here is how I call PlaySound() then in my program:
PlaySound("ir_end.wav", NULL, SND_FILENAME | SND_ASYNC);
I also tried other ways, such as
PlaySound((LPCTSTR)_T("ir_end.wav"), NULL, SND_FILENAME | SND_ASYNC);
PlaySound((LPCTSTR)_T("C:\\WINNT\\Media\\ir_end.wav"), NULL, SND_FILENAME | SND_ASYNC);
and the like, but still nothing. What I want it to do is play a sound if I click a button. Geez, I never thought that it would be so complicated though! The program pauses slightly as if it's loading the sound, but nothing comes out. Maybe the problem lies in something else, not my code. Anyway, thanks for all your help so far.
|
|
|
|
|
Haha, nevermind; I got it to work. All I had to do was restart the computer and everything was fine...
But once again, thanks for all your help!
|
|
|
|
|
here is my problem I am writing an app in VC++.net using mfc and I am also using STL vectors. My app crashes everytime at the same place when I try to run it stand alone but when i run it from VC++.net it works fine. Does anyone know why this is. It only happens with apps that use the STL and it only happens with .net. With 6.0 it works fine. Can anyone help me?
|
|
|
|
|
I suspect a loop or invalid access to the STL container.
Kuphryn
|
|
|
|
|
Dear Friends
I wish to set Aspect Ratio using API.Kindly write to me what is the particular command to get the screen resolution paramaeter and to set the aspect ratio accordingly.
Thanking you.
With Regards,
Adarsh
|
|
|
|
|
Can't say I ever needed the aspect ratio for the screen resolution.
Isn't it enough with width and height?
if (lpdd->SetDisplayMode(width,height,bpp,0,0)!=DD_OK)
jhaga
|
|
|
|
|
::GetSystemMetrics(SM_CXFULLSCREEN)
::GetSystemMetrics(SM_CYFULLSCREEN)
and
SetMapMode
The SetMapMode function sets the mapping mode of the specified device context. The mapping mode defines the unit of measure used to transform page-space units into device-space units, and also defines the orientation of the device's x and y axes.
int SetMapMode(
HDC hdc, // handle of device context
int fnMapMode // new mapping mode
);
Parameters
hdc
Handle to the device context.
fnMapMode
Specifies the new mapping mode. It can be any one of the following values: Value Description
MM_ANISOTROPIC Logical units are mapped to arbitrary units with arbitrarily scaled axes. Use the SetWindowExtEx and SetViewportExtEx functions to specify the units, orientation, and scaling.
|
|
|
|
|
Thanks a lot.
With Regards,
Adarsh
|
|
|
|
|
I want to connect to my mail server and get my emails.This is my code:
WSAStartup(0x0101,&wsa);
sock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
HOSTENT *hp = gethostbyname("mail.parsonline.net");
sin.sin_addr.s_addr=*((unsigned long*)hp->h_addr);
sin.sin_family=AF_INET;
sin.sin_port=htons(110);
int i = connect(sock,(struct sockaddr*)&sin, sizeof(sin) );
char *buff="USER mazdakmansouri\r\n";int y;
send(sock,buff,strlen(buff),0);
recv(sock,buff,10,0);
i = WSAGetLastError();
But I recieve nothing andreturn value from recv() is -1 and after that line WSAGetLastError() return error 10053 which means "An established connection was aborted by the software in your host machine".Before that WSAGetLastError() return 0. (no error) Any suggestion?
Mazy
No sig. available now.
|
|
|
|
|
try
char szBuffer[128];<br />
recv(sock,szBuffer,128,0);<br />
i = WSAGetLastError();
I will let you work out why!
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
Thanks,it works now.
Mazy
No sig. available now.
|
|
|
|
|
How can I translate a relative PIDL to an absolute PIDL ?
|
|
|
|
|
Hi,
I am using the SerializeElements template and specify 5 of them, each used to allow the serialization of classes I built. 4 of them compile fine but there is one that casues a
linking prolem that suggested that the template is defined in two different locations. Here
is the message:
SupaKewlDoc.obj : error LNK2005: "void __stdcall SerializeElements(class CArchive &,class IRCchannel * *,int)" (?SerializeElements@@YGXAAVCArchive@@PAPAVIRCchannel@@H@Z) already defined in IRCnetwork.obj
Debug/SupaKewl.exe : fatal error LNK1169: one or more multiply defined symbols found
Now the code compiles if I remove the template for the IRCchannel. Also I have done a find
for IRCchannel template elsewhere in the code and it definitely is only defined once.
I was thinking it maybe due to how the included statements are structured. I have included below the start code for the two files SupaKewlDoc and IRCnework. I'd appreciate any help or suggestions. Thanks a bunch.
// SupaKewlDoc.cpp : implementation of the CSupaKewlDoc class
//
#include "stdafx.h"
#include "SupaKewl.h"
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "SupaKewlDoc.h"
#include "ircnetwork.h"
#include "ircsocket.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CSupaKewlDoc
IMPLEMENT_DYNCREATE(CSupaKewlDoc, CDocument)
BEGIN_MESSAGE_MAP(CSupaKewlDoc, CDocument)
ON_COMMAND(ID_FILE_SAVE, OnFileSave)
ON_COMMAND(ID_FILE_RESET, ResetState)
END_MESSAGE_MAP()
/////////// SERIALIZATION STUFF ///////////////////
template <> void AFXAPI SerializeElements <ircnetwork*> ( CArchive& ar, IRCnetwork** pItem, int nCount )
{
for ( int i = 0; i < nCount; i++, pItem++ )
{
(*pItem)->Serialize( ar );
}
}
template <> void AFXAPI SerializeElements <dccserver*> ( CArchive& ar, DCCserver** pItem, int nCount )
{
for ( int i = 0; i < nCount; i++, pItem++ )
{
(*pItem)->Serialize( ar );
}
}
template <> void AFXAPI SerializeElements <dccfile*> ( CArchive& ar, DCCfile** pItem, int nCount )
{
for ( int i = 0; i < nCount; i++, pItem++ )
{
(*pItem)->Serialize( ar );
}
}
template <> void AFXAPI SerializeElements <ircchannel*> ( CArchive& ar, IRCchannel** pItem, int nCount )
{
for ( int i = 0; i < nCount; i++, pItem++ )
{
(*pItem)->Serialize( ar );
}
}
// CSupaKewlDoc construction/destruction
CSupaKewlDoc::CSupaKewlDoc()
{
// TODO: add one-time construction code he
this->SetTitle("hello");
}
CSupaKewlDoc::~CSupaKewlDoc()
{
//////////////////////////////////////
// remove all files
//////////////////////////////////////
DCCfile *dccFile = NULL;
for (int nFiles = 0; nFiles < m_DCCfiles.GetCount(); nFiles++)
{
dccFile = m_DCCfiles.ElementAt(nFiles);
delete dccFile;
}
m_DCCfiles.RemoveAll();
m_DCCfiles.FreeExtra();
... rest of the code not included...
#include "StdAfx.h"
#include "ircnetwork.h"
/////////// SERIALIALIZATION ////////////////////
IMPLEMENT_SERIAL(IRCnetwork,CObject,1)
IMPLEMENT_SERIAL(IRCserver,CObject,1)
IMPLEMENT_SERIAL(DCCserver,CObject,1)
IMPLEMENT_SERIAL(DCCfile,CObject,1)
IMPLEMENT_SERIAL(IRCchannel,CObject,1)
template <> void AFXAPI SerializeElements <ircserver*> ( CArchive& ar, IRCserver** pItem, int nCount )
{
for ( int i = 0; i < nCount; i++, pItem++ )
{
(*pItem)->Serialize( ar );
}
}
//////////// IRC NETWORK CLASS ////////////////
IRCnetwork::IRCnetwork()
{
}
IRCnetwork::~IRCnetwork()
{
IRCserver *networkServer = NULL;
for (int nServers = 0; nServers < serverNetwork.GetCount(); nServers++)
{
networkServer = serverNetwork.ElementAt(nServers);
delete networkServer;
}
serverNetwork.RemoveAll();
serverNetwork.FreeExtra();
IRCchannel *networkChannel = NULL;
for (int nChannels = 0; nChannels < channelArray.GetCount(); nChannels++)
{
networkChannel = channelArray.ElementAt(nChannels);
delete networkChannel;
}
channelArray.RemoveAll();
channelArray.FreeExtra();
}
IRCnetwork::IRCnetwork(CString name)
{
networkName = name;
}
void IRCnetwork::addServer(IRCserver *newIRCserver)
{
serverNetwork.Add(newIRCserver);
}
CString IRCnetwork::GetName()
{
return networkName;
}
void IRCnetwork::Serialize(CArchive& ar)
{
CObject::Serialize( ar );
serverNetwork.Serialize(ar);
channelList.Serialize(ar);
channelArray.Serialize(ar);
/*CString networkName;
CArray<ircserver*,ircserver*> serverNetwork;
CStringList channelList;
CArray<ircchannel*,ircchannel*> channelArray;*/
if (ar.IsStoring())
ar << networkName;// << currentInChannel << channelActivity;
else
ar >> networkName;// >> currentInChannel >> channelActivity;
}
|
|
|
|
|
hello,
I want to take a cd serial number like "media player" when identify an audio cd by it's serial and search the microsoft cd datbase for song titles ....
Can anyone give me a hint how to take that serial ....?
I suppose this serial is written by the "cd burner" !
I want to set it in Nero, burn the cd, and identify my cd later ...
thanks !
|
|
|
|
|
_crs_,
I was browsing the freedb.org website last week and they have code somewhere in the developer section on doing just what you asked.
Steve
|
|
|
|
|
LPITEMIDLIST GetDialUpNetworkingPidl(LPSHELLFOLDER pDesktop)
{
HRESULT hr;
LPITEMIDLIST pidlDialUp;
if(!pDesktop)
return NULL;
//get the pidl for Dial-Up Networking
hr = pDesktop->ParseDisplayName( NULL,
NULL,
L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{8714C09D-E388-4190-A18E-6A340C2FD557}",
NULL,
&pidlDialUp,
NULL);
//992CFFA0-F557-101A-88EC-00DD010CCC48
if(FAILED(hr))
return NULL;
return pidlDialUp;
}
This is the function which returns pidl for Dial-up networking under win 98,
I need the same working under win 2000/xp.
What shpuld I pass as 3rd parameter?
Please help
|
|
|
|
|
I have project with database support.
Does it possible to complile this project in one *.exe file ?
(i.e. database will be included into the *.exe module).
Or maybe ypu are have some other ideas - how i can to hide my data's ?
regards !
|
|
|
|
|
Several options i can think of:
- Encrypt the data before inserting it into the database
- Encrypt the database file so it would be unreadable
- U can add the database file into the resources and on runtime get the handle to it, unpack it, decrypt it, do what u wanna do and the update the resources
Try to look on code project for some algorithm of encryption and on MSDN for resource management and UpdateResource Api family
hope this help
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Databases are usually stored in files on the harddisk. If you
store data in the .exe then you have to make a new .exe every
time you change the data. It is not impossible but I can't
remember ever seen it done.
If you want to hide your data you must encrypt it
before storing it in the database.
jhaga
|
|
|
|
|
well , but i actually don't want to change data in database. It's will be permanent data storage - it can be changed only during project compliling. So if it is possible to store database file in *.exe or *.dll module - tell me please, how can i do it ?
regards
|
|
|
|
|
CString row1="This is data row 1"
CString row2="This is data row 2"
etc.
You can have you whole database in one CString.
jhaga
|
|
|
|
|
well , but most data will be in binary data .. To store this data in the resource *.rc i think it's quite difficult , because there is about 20K items to store .. So how can i handle this problem ?
By the way - how to put and get from table binary data's ?
thanks !
|
|
|
|
|