What could be the error??
i have a dll for converting vox files to Dll.
the structure of the header looks like :
-----------------------------------------code-------------------------------------------
typedef struct tFILECONVERT
{
long lStructSize; // the size of this structure
BOOL bCallback; // if TRUE, notify the callback window after
conversion (ID + result code)
HWND hCallbackWindow ; // the handle of the callback window if
bCallback is true
long CallbackID; // User provided ID used to mark the callback
message
LPSTR szInputFile; // path and name of the input sound file
WORD wInputFormat; // sound format of the input sound file
DWORD dwInputRate; // sample rate of the input sound file
WORD wInputChannels; // number of channels of the input sound file
LPSTR szOutputFile; // path and name of the output sound file
WORD wOutputFormat; // sound format of the output sound file
DWORD dwOutputRate; // sample rate of the output sound file
WORD wOutputChannels ; // number of channels of the output sound file->
currently = 1
BOOL bFilter; // if TRUE, enables filtering during conversion
WORD FilterType; // filter type, if filtering is enabled
DWORD LopassCutoff; // cutoff frequency for low pass filtering
DWORD HipassCutoff; // cutoff frequency for high pass filtering
BOOL bSilence; // if TRUE, performs automatic leader/trailer
trimming during conversion
float SilenceVal; // sound intensity (in % full scale) under which
sound is considered as silence
DWORD LeaderLength; // wanted duration of the trimmed leader
DWORD TrailerLength; // wanted duration of the trimmed trailer
BOOL bNormalize; // if TRUE, allows amplification of the sound
float NormalizeVal; // intensity at which the sound should be
amplified (in % full scale)
BOOL bClarity; // if TRUE, applies sound enhancement effects during
conversion
short ClarityVal; // type of sound enhancement desired
BOOL bCenter; // if TRUE, sound will be centered around 0 during
conversion
BOOL bOldWaveFormat; // if TRUE, will generate old win3.1 wave formats
(no WAVEFORMATEX, no fact chunk)
BOOL bLogIt; // if TRUE, the conversion results will be logged in a
file
LPSTR szLogFile; // path and name of the conversion log file
BOOL bErrorMessage; // if TRUE, a litteral error message will be
returned after conversion
LPSTR szErrorMessage; // address of the string to return the error
message (must be >= 128 char)
WORD ReturnCode; // code to notify the user of the result of the
conversion
DWORD Reserved; // reserved for future extensions-> MUST be set to 0
} FILECONVERT,*PF ILECONVERT,far *LPFILECONVERT;
extern "C" BOOL VoxFileConvert( LPFILECONVERT); // the actual
conversion function declaration
extern "C" void VoxConvertRegis ter(void); // the actual conversion
function declaration
-----------------------------------------------code
end-----------------------------------------------------------------
Now when i try to call the "voxFileConvert " function, it fails. i link
the Dll with the corresponding .Lib file,
but i tried dynamic loading also. that too fails.
-------------------------------------------code------------------------------------------------------------------------------
CONVERT()
{
LPFILECONVERT lpFileConvert;
HGLOBAL hFileConvert;
char szInputFile[256];
char szOutputFile[256];
char szLogFile[256];
char szErrorMessage[256];
hFileConvert = GlobalAlloc(GHN D,sizeof(FILECO NVERT));
if (!hFileConvert)
{
cout<<"Not enough memory left";
//break;
}
lpFileConvert = (LPFILECONVERT) GlobalLock (hFileConvert);
/*Upon reaching here, Access violation Error found while,(only) in
debugging mode., but when you run the program, it goes till the end ..
(till voxFileConvert) .. and throws "illegal Operation" error.*/
lpFileConvert->lStructSize = 128;
lpFileConvert->bCallback = FALSE;
lpFileConvert->hCallbackWindo w = NULL;
lpFileConvert->CallbackID = 0;
strcpy(szInputF ile,"11.vox");
printf("%s","HA PPEND");
lpFileConvert->szInputFile = szInputFile;
printf("%s",lpF ileConvert->szInputFile) ;
lpFileConvert->wInputFormat = SID_WAVE;
lpFileConvert->dwInputRate = 0;
lpFileConvert->wInputChanne ls = 0;
strcpy(szOutput File,"11.wav");
printf("%s","HA PPEND");
lpFileConvert->szOutputFile = szOutputFile;
lpFileConvert->wOutputForma t = SID_DIALADPCM;
lpFileConvert->dwOutputRate = 8000;
lpFileConvert->wOutputChannel s = 1;
lpFileConvert->bFilter = FALSE;
lpFileConvert->FilterType = 0;
lpFileConvert->LopassCutoff = 0;
lpFileConvert->HipassCutoff = 0;
lpFileConvert->bSilence = FALSE;
lpFileConvert->SilenceVal = 5.0;
lpFileConvert->LeaderLength = 50;
lpFileConvert->TrailerLengt h = 50;
lpFileConvert->bNormalize = FALSE;
lpFileConvert->NormalizeVal = 75.0;
lpFileConvert->bClarity = FALSE;
lpFileConvert->ClarityVal = 5;
lpFileConvert->bCenter = FALSE;
lpFileConvert->bOldWaveForm at = FALSE;
lpFileConvert->bLogIt = FALSE;
strcpy(szLogFil e,"VOXlog.txt") ;
printf("%s","HA PPEND");
///// szIniPath );
//strcat(szLogFil e,"VCLog.txt" );
strcpy(szErrorM essage,"My Error");
lpFileConvert->szLogFile = szLogFile;
lpFileConvert->bErrorMessag e = TRUE;
lpFileConvert->szErrorMessa ge = szErrorMessage;
GlobalUnlock(hF ileConvert);
printf("%s","HA PPEND END");
// VoxFileConvert( &lpFileConvert) ; ///////////VoxDllTest has
encountered a problem and needs to close.
sprintf("CODE:" ,"%d",lpFileCon vert->ReturnCode);
--------------------------------------code
end--------------------------------------------------------------
i have a dll for converting vox files to Dll.
the structure of the header looks like :
-----------------------------------------code-------------------------------------------
typedef struct tFILECONVERT
{
long lStructSize; // the size of this structure
BOOL bCallback; // if TRUE, notify the callback window after
conversion (ID + result code)
HWND hCallbackWindow ; // the handle of the callback window if
bCallback is true
long CallbackID; // User provided ID used to mark the callback
message
LPSTR szInputFile; // path and name of the input sound file
WORD wInputFormat; // sound format of the input sound file
DWORD dwInputRate; // sample rate of the input sound file
WORD wInputChannels; // number of channels of the input sound file
LPSTR szOutputFile; // path and name of the output sound file
WORD wOutputFormat; // sound format of the output sound file
DWORD dwOutputRate; // sample rate of the output sound file
WORD wOutputChannels ; // number of channels of the output sound file->
currently = 1
BOOL bFilter; // if TRUE, enables filtering during conversion
WORD FilterType; // filter type, if filtering is enabled
DWORD LopassCutoff; // cutoff frequency for low pass filtering
DWORD HipassCutoff; // cutoff frequency for high pass filtering
BOOL bSilence; // if TRUE, performs automatic leader/trailer
trimming during conversion
float SilenceVal; // sound intensity (in % full scale) under which
sound is considered as silence
DWORD LeaderLength; // wanted duration of the trimmed leader
DWORD TrailerLength; // wanted duration of the trimmed trailer
BOOL bNormalize; // if TRUE, allows amplification of the sound
float NormalizeVal; // intensity at which the sound should be
amplified (in % full scale)
BOOL bClarity; // if TRUE, applies sound enhancement effects during
conversion
short ClarityVal; // type of sound enhancement desired
BOOL bCenter; // if TRUE, sound will be centered around 0 during
conversion
BOOL bOldWaveFormat; // if TRUE, will generate old win3.1 wave formats
(no WAVEFORMATEX, no fact chunk)
BOOL bLogIt; // if TRUE, the conversion results will be logged in a
file
LPSTR szLogFile; // path and name of the conversion log file
BOOL bErrorMessage; // if TRUE, a litteral error message will be
returned after conversion
LPSTR szErrorMessage; // address of the string to return the error
message (must be >= 128 char)
WORD ReturnCode; // code to notify the user of the result of the
conversion
DWORD Reserved; // reserved for future extensions-> MUST be set to 0
} FILECONVERT,*PF ILECONVERT,far *LPFILECONVERT;
extern "C" BOOL VoxFileConvert( LPFILECONVERT); // the actual
conversion function declaration
extern "C" void VoxConvertRegis ter(void); // the actual conversion
function declaration
-----------------------------------------------code
end-----------------------------------------------------------------
Now when i try to call the "voxFileConvert " function, it fails. i link
the Dll with the corresponding .Lib file,
but i tried dynamic loading also. that too fails.
-------------------------------------------code------------------------------------------------------------------------------
CONVERT()
{
LPFILECONVERT lpFileConvert;
HGLOBAL hFileConvert;
char szInputFile[256];
char szOutputFile[256];
char szLogFile[256];
char szErrorMessage[256];
hFileConvert = GlobalAlloc(GHN D,sizeof(FILECO NVERT));
if (!hFileConvert)
{
cout<<"Not enough memory left";
//break;
}
lpFileConvert = (LPFILECONVERT) GlobalLock (hFileConvert);
/*Upon reaching here, Access violation Error found while,(only) in
debugging mode., but when you run the program, it goes till the end ..
(till voxFileConvert) .. and throws "illegal Operation" error.*/
lpFileConvert->lStructSize = 128;
lpFileConvert->bCallback = FALSE;
lpFileConvert->hCallbackWindo w = NULL;
lpFileConvert->CallbackID = 0;
strcpy(szInputF ile,"11.vox");
printf("%s","HA PPEND");
lpFileConvert->szInputFile = szInputFile;
printf("%s",lpF ileConvert->szInputFile) ;
lpFileConvert->wInputFormat = SID_WAVE;
lpFileConvert->dwInputRate = 0;
lpFileConvert->wInputChanne ls = 0;
strcpy(szOutput File,"11.wav");
printf("%s","HA PPEND");
lpFileConvert->szOutputFile = szOutputFile;
lpFileConvert->wOutputForma t = SID_DIALADPCM;
lpFileConvert->dwOutputRate = 8000;
lpFileConvert->wOutputChannel s = 1;
lpFileConvert->bFilter = FALSE;
lpFileConvert->FilterType = 0;
lpFileConvert->LopassCutoff = 0;
lpFileConvert->HipassCutoff = 0;
lpFileConvert->bSilence = FALSE;
lpFileConvert->SilenceVal = 5.0;
lpFileConvert->LeaderLength = 50;
lpFileConvert->TrailerLengt h = 50;
lpFileConvert->bNormalize = FALSE;
lpFileConvert->NormalizeVal = 75.0;
lpFileConvert->bClarity = FALSE;
lpFileConvert->ClarityVal = 5;
lpFileConvert->bCenter = FALSE;
lpFileConvert->bOldWaveForm at = FALSE;
lpFileConvert->bLogIt = FALSE;
strcpy(szLogFil e,"VOXlog.txt") ;
printf("%s","HA PPEND");
///// szIniPath );
//strcat(szLogFil e,"VCLog.txt" );
strcpy(szErrorM essage,"My Error");
lpFileConvert->szLogFile = szLogFile;
lpFileConvert->bErrorMessag e = TRUE;
lpFileConvert->szErrorMessa ge = szErrorMessage;
GlobalUnlock(hF ileConvert);
printf("%s","HA PPEND END");
// VoxFileConvert( &lpFileConvert) ; ///////////VoxDllTest has
encountered a problem and needs to close.
sprintf("CODE:" ,"%d",lpFileCon vert->ReturnCode);
--------------------------------------code
end--------------------------------------------------------------
Comment