Socket Programming
hi,
I am trying to transfer a folder of files using socket. could anyone
help me by providing tips to send and receive. I want the files to be
saved with same file name as sent. anyone help me regarding this,
sirisha. Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 265028
How to suspend operation/threads in VC
Hi,
I tried
stdlib.h
sleep(10);
to no avail.
I need a resolution of millisec range
Thx
Jack Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 265022
command line secure shell
I have a command line secure shell program and I would like to write my
own program to interact with it. I would like to perform both reading
and writing to the secure shell program. Could someone tell me the
best way to do this?
Thank you. Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 265013
Embedding a resource at runtime
Hi there. Does anyone know if it's possible to embed a new resource into an
assembly at runtime as well as update an existing (assembly) resource. Any
assistance would be appreciated. Thanks. Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264983
Help Using WinDBG
Hi,
Can any one point me to the specific link of how to use windbg tool
properly for debugging complex applications.
Example How to track the Access Voilation error from withen the DLL
which may use other DLLs. Tracking the addresses of the function in the
memory. Tracking which function in which DLL is failing. Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264979
memory leakage in vc++ 6.0
am trying to develop an application to transfer a folder of files
using sockets. I have been using a loop to transfer all the files.
there are many memory leakage errors found in debugging. how can i
solve this?
the output is differing. and I am unable to find the exactly where
is the error in the code.
the code for sending is like this : in which i am sending the contents
in the order
file size, filename size, file name, file contents
void Sender::SendData(void)
{
CString findFilePath=filePathInformation+"\\*.*";
bWorking=finder.FindFile(_T((LPCTSTR)findFilePath));
while (bWorking)
{
bWorking = finder.FindNextFile();
CString findFileName(finder.GetFileName());
if(findFileName.Compare(".") == 0 ||
findFileName.Compare("..") == 0)
{
//CloseSocket();
continue;
}
int returnValue=SetAddress();
if(returnValue==0)
{
CString sendFilePath=finder.GetFilePath();
FILE *filePointer;
//int returnedValue;
if( (filePointer = fopen(sendFilePath, "rb" ))
== NULL )
{
cout<<endl<<"File open error";
CloseSocket();
return;
}
else
{
char *fileContentBuffer;
unsigned int bytesRead,fileNameLength;
long fileSize;
//long allocReqNum;
//first send the file size details
fseek(filePointer, 0, SEEK_END); //
Move File Pointer to EOF
fileSize=ftell(filePointer); // Get
position of File Pointer
rewind(filePointer); // Move File
Pointer back to beginning of
file
fileContentBuffer = (char
*)calloc(32,sizeof(long));
//returnedValue=_CrtIsMemoryBlock(fileContentBuffer, 32,
&allocReqNum, NULL, NULL);
ltoa( fileSize, fileContentBuffer,10 );
int returnValue =
send(mySocket,fileContentBuffer,32,0);
if(returnValue == SOCKET_ERROR)
{
cout<<endl<<"Error in Sending
File Length";
CloseSocket();
return;
}
else
cout<<endl<<"File Size Sent
Successfully : "<<fileSize;
//long
valueReturned=_CrtSetBreakAlloc(allocReqNum);
//delete fileContentBuffer;
free(fileContentBuffer);
//send file name length
fileNameLength=findFileName.GetLength();
fileContentBuffer = (char
*)calloc(32,sizeof(int));
char *returnChar=itoa( fileNameLength,
fileContentBuffer, 10 );
returnValue =
send(mySocket,fileContentBuffer,32,0);
if(returnValue == SOCKET_ERROR)
{
cout<<endl<<"Error in Sending
File Details";
CloseSocket();
return;
}
else
cout<<endl<<"File Length Sent
Successfully : "<<fileNameLength;
free(fileContentBuffer);
//delete fileContentBuffer;
//Send the file name
char *temporaryBuffer;
fileContentBuffer = (char
*)calloc(255,sizeof(char));
temporaryBuffer=findFileName.GetBuffer(fileNameLength);
strcpy(fileContentBuffer,temporaryBuffer);
returnValue =
send(mySocket,fileContentBuffer,fileNameLength,0);
if(returnValue == SOCKET_ERROR)
{
cout<<endl<<"Error in Sending
in File Name";
CloseSocket();
return;
}
else
cout<<endl<<"File Name Sent
Successfully : "<<temporaryBuffer;
free(fileContentBuffer);
//delete fileContentBuffer;
//sending the file
fileContentBuffer = (char
*)calloc(fileSize,sizeof(char));
bytesRead=fread(fileContentBuffer,sizeof(char),fileSize,filePointer);
returnValue =
send(mySocket,fileContentBuffer,fileSize,0);
if(returnValue == SOCKET_ERROR)
{
cout<<endl<<"Error in Sending
File Contents";
CloseSocket();
return;
}
else
cout<<endl<<"File Sent
Successfully "<< returnValue<<" bytes";
//delete fileContentBuffer;
free(fileContentBuffer);
}
//returnedValue=_CrtDumpMemoryLeaks();
fclose(filePointer);
CloseSocket();
}
else
{
cout<<endl<<"Error in connecting";
CloseSocket();
return;
}
}
}
could u please help regarding this.
that would be greatful to me,
sirisha. Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264965
Get current windows profile name
Hello,
What is the Win32 API to obtain current logged in user name or a special
unique ID without having to login as adminstrator
thank you Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264961
[OT] Google Hates MSDN?
Hi All,
I understand this is OT, but has anyone else noticed that Google seems to
hate the MSDN now? where previously something like sprintf etc would have
referenced the MSDN in the top page or so, now the MSDN docs are usually
no-where to be found on a google search.???
--
- Mark Randall
http://www.temporal-solutions.co.uk
"We're Systems and Networks..."
"It's our job to know..." Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264960
C++ equivlence of int[][] x.length
Hi,
In java, you can extract the height and width of an array. In C++, how can u
do the same?
In java, I do this
int width = img[0].length;
int height = img.length;
Type of img is int[][]
Thanks in advance
Jack Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264955
Format time Year Month Day hour minute second millisecond
How can one format the time in order of increasing precision:
Year Month Day hour:min:sec.millisec
ie. 2006 6 5 11:40:35.456
Right now I have this setup that results in: Fri May 26 13:03:30.451
struct _timeb g_tstruct;
_ftime( &g_tstruct );
fprintf(LogFile, "%.19s.%hu\n", ctime( & ( g_tstruct.time ) ),
g_tstruct.millitm );
and have seen that another %s could be used to hold the year found from
&g_tstruct[20].
But I haven't been able to find any other formats available.
Thanks, Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264952
slider control problem, first control in slider control array could not be set
Dear people out there,
I cant see through the tomatoes on my eyes, so I ask you to help me
overcome my human weakness.
I got the following problem:
I've got 10 sliderbars in defined an array and assigned the controls to
the corresponding ID's.
Here some code, if not enough, I give u more
// the slider bars
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_1, m_sliderBars[0]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_2, m_sliderBars[1]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_3, m_sliderBars[2]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_4, m_sliderBars[3]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_5, m_sliderBars[4]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_6, m_sliderBars[5]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_7, m_sliderBars[6]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_8, m_sliderBars[7]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_9, m_sliderBars[8]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_10, m_sliderBars[9]);
for (i=0; i<10; i++ ) {
m_sliderBars[i].SetRange(0, 5000);
m_sliderBars[i].SetPos(200);
}
The problem is, the first sliderbar sets its range between 0 and 100
and the position to 0, no mather what I do.
This is not what I want it to do.
Is there anything I did not take into account, or do I really have a
problem and should look for a doctor checking my eyes.
I am desperate, since I dont see, why it wont work.
Would anybody show a little mercy and spend a few minutes for me
please?
Thank you in advance. Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264946
slider control problem, first control in slider control array could not be set
Dear people out there,
I cant see through the tomatoes on my eyes, so I ask you to help me
overcome my fucked up human weakness.
I got the following problem:
I've got 10 sliderbars in an array and assigned the controls to the
corresponding ID's.
Here some code, if not enough, I'll give you more.
// the slider bars
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_1, m_sliderBars[0]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_2, m_sliderBars[1]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_3, m_sliderBars[2]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_4, m_sliderBars[3]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_5, m_sliderBars[4]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_6, m_sliderBars[5]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_7, m_sliderBars[6]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_8, m_sliderBars[7]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_9, m_sliderBars[8]);
DDX_Control(pDX, IDC_SLIDER_COLOR_CHOOSER_10, m_sliderBars[9]);
for (i=0; i<10; i++ ) {
m_sliderBars[i].SetRange(0, 5000);
m_sliderBars[i].SetPos(200);
}
The problem is, the first sliderbar sets its range between 0 and 100
and the position to 0, no mather what I do, this is not what I want it
to do.
Is there anything I did not take into account, or do I really have a
problem and should look for a doctor checking my eyes.
I am desperate, since I dont see, why it wont work.
Would anybody show a little mercy and spend a few minutes for me
please?
Thank you in advance. Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264945
Why fscanf_s does not work ??
Try to debug this code, fscanf_s does not read from an input text file
numbers.txt that has 20 integers separated by a space. What I am doing
wrong ??
#include <stdio.h>
#include "stdafx.h"
#include <stdlib.h>
#define SIZE 20 /* size of elements in the the sequence of numbers */
int _tmain(int argc, _TCHAR* argv[])
{
int array[SIZE];
int i, pass, hold;
FILE *fp;
/* opens the file in in read only mode */
if(fopen_s(&fp,"d:\\numbers.txt","r")!=0)
{
printf("Error opening the file\n");
exit(1);
}
/* load the data in the array */
else
{
for(i=0;i<=SIZE-1;i++)
{
fscanf_s(fp,"%d",&array[i]);
}
}
fclose(fp);
/* show data */
for(i=0;i<=SIZE-1;i++)
{
printf("%d ", array[i]);
}
printf("\n");
return 0;
} Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264939
manifests and Vista Beta2
Not sure where the best place for this is as I can't find a
'Vista/programmer' type of newsgroup. I've got a VC 8 MFC application that
I've written that installs fine on XP and on Vista Beta2 and runs fine on XP.
But when I try to run it on a Vista Beta2 system, it complains that the
'side-by-side configuration is incorrect' and tells me to check the event
log. I can't tell much from the event log but it tells me to run the
'sxstrace'. When I try to do that it tells me 'access denied'. Any ideas if
this is just a Vista problem or if there's something I need to do with my
build/setup so that it'll run on Vista? Thanks! Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264938
Cannot convert from 'Type' to 'const Type&' error with templates
Hello,
I encountered strange compilation error, so I want to hear
what other people say before I blame the compiler.
My environment: VC++2005, XP/Win2K.
I made helper function, which helps to build predicates for
many standard algorithms. The point of the function is that
it compares certain member of the class instead of whole
class object. Here's the code:
---------
////////////////////////////////////////////
// Template class for composition f(g(x))
template<typename F, typename G>
class compose_t :
public std::unary_function<
typename G::argument_type,
typename F::result_type
>
{
public:
explicit compose_t(const F& f, const G& g)
: m_f(f), m_g(g) {}
typename F::result_type operator()(
const typename G::argument_type& x) const
{
return m_f(m_g(x));
}
private:
F m_f;
G m_g;
};
// Template function to construct compose_t
template<typename F, typename G>
compose_t<F, G> compose(const F& f, const G& g)
{
return compose_t<F, G>(f, g);
}
////////////////////////////////////////////
// Sample class
struct X
{
X(const char* s, int n) : s_(s), n_(n) {}
const std::string& GetS() const { return s_; }
std::string s_;
int n_;
};
////////////////////////////////////////////
// Helper function to form arbitrary predicate
template <
typename T,
typename Func,
typename Pred
>
compose_t<std::binder2nd<Pred>, Func>
mem_match(
const T& val,
Func fn,
Pred pr = std::equal_to<T>()
)
{
return compose(std::bind2nd(pr, val), fn);
}
////////////////////////////////////////////
//
int _tmain(int /*argc*/, _TCHAR* /*argv*/[])
{
typedef std::vector<X> XVec;
XVec v;
v.push_back(X("one", 1));
v.push_back(X("two", 2));
v.push_back(X("three", 3));
XVec::iterator it = std::find_if(
v.begin(), v.end(),
mem_match(
std::string("two"),
std::mem_fun_ref(&X::GetS)
)
);
return 0;
}
---------
The problem is that mem_match doesn't compile. Compiler
issues error C2783: could not deduce template argument for
'Pred'.
So, now I tried this one:
template <
typename T,
typename Func
>
compose_t<std::binder2nd<std::equal_to<T> >, Func>
mem_match(const T& val, Func fn)
{
return compose(
std::bind2nd(
std::equal_to<T>(), val), fn);
}
This compiles without any problem, however I cannot control
std::equal_to predicate from the outside of mem_match.
I cannot specify std::binary_function as template parameter
for std::binder2nd, since std::binary_function doesn't have
operator() at all, and compiler rightfully complains about
it.
How can I control predicate for mem_match?
Thanks in advance
Alex Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264936
OOP problem!
Hello,
Just to not cause any contreversy:
"I understand that class definitions go in headers and method
implementations go in CPP files, however to simplify things, I put everything
under one listing!"
okay!
"A_CTR" class derives from "actions" class and "actions" class derives from
"components" class.
ALSO:
"T_CTR" class derives from "transitions" class and "transitions class
derives from "components" class.
So, its doing like a pyramid, with "components" class at the top, and where
"actions" and "transitions" classes are right below "coponents". Further,
"A_CTR" class is underneath "actions" and "T_CTR" is under "transitions".
I guess this can be better viwed in the code below.
Please consider the following code and see question after code:
===============================================
class components
{
public:
components(){}
components(int Flag);
virtual ~components() {}
static int FLAG_AllTrueInCase;
protected:
};
//ADT
class actions:public components
{
public:
actions(){}
virtual ~actions(){}
virtual bool conv_BOOL_INPUT_INTERNAL(
int Bool_ID_INPUT1,int Bool_ID_INTERNAL1, IO *io);
protected:
};
class A_CTR:public actions
{
public:
A_CTR(){}
virtual ~A_CTR(){}
virtual int SYS_getCnstCount(int i_COunterID)const;
virtual void setCounter(int i_CounterID,int i_CountCnst);
protected:
int iCount1Cnst;
int iCount2Cnst;
int iCount3Cnst;
};
int A_CTR::SYS_getCnstCount(int iCounterID)const
{
...other code...
return iCount1Cnst;
}
void A_CTR::setCounter(int iCounterID, int iCountCnst)
{
...other code...
iCount1Cnst = iCountCnst;
}
//ADT
class transitions:public components
{
public:
transitions(){}
virtual ~transitions(){}
};
class T_CTR:public transitions
{
public:
T_CTR(){}
virtual ~T_CTR(){}
virtual bool get_CTR_Ellapsed(int i_CounterID, int i_BranchDest);
protected:
int iC1CurrentCount;
int iC2CurrentCount;
int iC3CurrentCount;
};
bool T_CTR::get_CTR_Ellapsed(int iCounterID,int iBranchDest)
{
int xxx;
xxx = A_CTR::SYS_getCnstCount(1); /// *** ERROR! *** on this line!
}
===================================================
What if we are in a method of the T_CTR class and we wish to access a member
of the A_CTR class?
The following line:
xxx = A_CTR::SYS_getCnstCount(1); /// *** ERROR! *** on this line!
causes the following error:
c:\_DTS_PROGRAMMING\C_PROGRAMMING\vc++\MY_APPS_LAB\XPPLC\WndProc_ClassMethods.h(375):
error C2352: 'A_CTR::SYS_getCnstCount' : illegal call of non-static member
function
I somehow have the feeling I have coded something wrong *again*..... I am
looking hard to find the problem, but obviously not hard enough, and
furthermore, a book example does the same thing... I don't know what to make
of it?
Just when I thought that I was getting this classes stuff, I get this! :-)
Can someone please tell me what am I doing wrong?
*ALL* support appreciated!
--
Best regards
Robert Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264935
understanding Windows printing
Windows or MFC, I'm not sure which.. whatever the code below represents.
I want to print text to a label printer. I'd like to center the text in
the label and increase the font size over whatever the default is. I
don't understand the RECT thing or how to calculate coordinates or use
fonts. The code below works and it's pretty simple, I'd like to stay
with this scheme if possible (I have similar code elsewhere in the app).
I copied it from MSDN, I think.
Can someone explain how to use a standard Windows font like Arial 12 and
center the text, or point me to a tutorial?
Thanks
---------------
CDC cdc;
HDC hdc;
CPrintDialog dlg(TRUE); // Windows Printer Dialog class
CString formattedpage;
if (dlg.DoModal() == IDOK)
{
// Create a printer device context (DC)
// based on the information
// selected from the Print dialog.
hdc = dlg.CreatePrinterDC();
ASSERT(hdc);
// Attach Device Context object to handle
cdc.Attach(hdc);
cdc.StartDoc("Pan Label"); // begin a new print job
}
else
{
// abort print
}
RECT rect = {0,0,0,0}; // RECT structure for page
cdc.DrawText(formattedpage,&rect,DT_CALCRECT);
cdc.StartPage();
formattedpage.Format("STUFF TO PRINT");
cdc.DrawText(formattedpage,&rect,DT_NOCLIP);
cdc.EndPage();
cdc.EndDoc(); Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264934
IViewObject::Freeze
hi
Im confused with calling IViewObject::Freeze.
What am i suposed to pass for the second parameter ?
DWORD key=0;
HRESULT hr = m_pView->Freeze(DVASPECT_CONTENT, 0, NULL, &key);
Freeze returns -2147467263
thanks Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264932
Form resource files
Hi there. I apolgize for posting this again (from June 2nd) but I've been
researching for many days now with no success. I have an app that will be
reading arbitrary ".resx" or "resources" files passed on the command line
for instance. Given only a resource file IOW, does anyone know:
1) How the app can determine if the passed resource file contains
(localized) form resources (i.e., it stores a form)
2) If it does contain (localized) form resources, how can I then generate
that form dynamically
Note that the native .NET utility "Winres.exe" is able to do this but I
can't figure out how (not without using techniques that appear to be
undocumented). Any help would be greatly appreciated. Thanks. Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264931
Visual C/C++ 6.0. Using SEH
I'm facaing a problem in using SEH (structured exceptions handling) in VC 6.0.
Please, create (using Visual C/C++ 6.0) an Empty Console application. Use
following source to build the application:
--------------------------------
class A
{
public:
operator const __int64() const
{
return 33i64; // random number
}
};
inline bool operator!=(const A& val1, const __int64 val2)
{
return false; // doesnt matter what it returns
}
static A g_a;
bool func()
{
__try
{
return (g_a != 0i64);
}
__finally
{
}
return 0;
}
void main(void)
{
// Check the returned value
bool bRetVal = func();
} // Place a breakpoint here and check the value of bRetVal.
--------------------------------
Run the application and check the value returned by func(). In my case it is
24, but it should be false <zero>. Actually (after number of tests) I found
that it is a random number.
Can somebody, please, explain what is goig on?
This code should be working, or I should get a compiler error.
I'm not looking for workaraoung. I just want to understand - am I wrong, or
there is something with the compiler. Thank you !!!
* I've tried the same source using VC 2003 and it works fine. Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264919
Get filename and path of a file selected on the desktop
Hi,
Is there a way to obtain a filename and path (or just a handle of a
file, but without knowing its name nor path) of a file(s) selected on
the desktop (with LEFT click). As far as I know there's no such api
function. "Shell extensions on right click" are NOT what I'm looking
for... When I click a file in any window, Explorer runs a few functions
like ReadFile, CreateFile and in some magical way gets it's name and
path. I searched the web but with no luck. I could make a filesystem
hook and intercept calls on functions like ReadFile or CreateFile, but
I would need only those calls, that are made when I select one or more
files in a Explorer window. And that is what I am not able to do,
because of my lack of knowlegde on that topic. If you can, please help Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264917
Map, Vector and List
What are the major differences between these stl classes/objects?
Thanks
Jack Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264906
how to turn jpgs to vector
Hi,
Are there any handy ways like GDI+ to convert between jpgs and vector
formats?
Linux platform equvilence is appreciated too
Thanks
Jack Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264902
std::string question
How do I convert an integer to std::string?
Thanks
Jack Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264900
how to record and save extracted audio in vc++
hi all,
I have a video format(.cam) and audio files are stored in it.I can able
to extract and play audio using waveout funtions in wave class.
I would like to save the extracted audio in .wav format.
how to do this.do i need to add any class like waveIn
I saw the following code to record wav file.
// Uses the MCI_OPEN, MCI_RECORD, and MCI_SAVE commands to record and
// save a waveform-audio file. Returns 0L if successful; otherwise,
// it returns an MCI error code.
DWORD recordWAVEFile(DWORD dwMilliSeconds)
{
UINT wDeviceID;
DWORD dwReturn;
MCI_OPEN_PARMS mciOpenParms;
MCI_RECORD_PARMS mciRecordParms;
MCI_SAVE_PARMS mciSaveParms;
MCI_PLAY_PARMS mciPlayParms;
// Open a waveform-audio device with a new file for recording.
mciOpenParms.lpstrDeviceType = "waveaudio";
mciOpenParms.lpstrElementName = "";
if (dwReturn = mciSendCommand(0, MCI_OPEN,
MCI_OPEN_ELEMENT | MCI_OPEN_TYPE,
(DWORD)(LPVOID) &mciOpenParms))
{
// Failed to open device; don't close it, just return error.
return (dwReturn);
}
// The device opened successfully; get the device ID.
wDeviceID = mciOpenParms.wDeviceID;
// Begin recording and record for the specified number of
// milliseconds. Wait for recording to complete before continuing.
// Assume the default time format for the waveform-audio device
// (milliseconds).
mciRecordParms.dwTo = dwMilliSeconds;
if (dwReturn = mciSendCommand(wDeviceID, MCI_RECORD,
MCI_TO | MCI_WAIT, (DWORD)(LPVOID) &mciRecordParms))
{
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
return (dwReturn);
}
// Play the recording and query user to save the file.
mciPlayParms.dwFrom = 0L;
if (dwReturn = mciSendCommand(wDeviceID, MCI_PLAY,
MCI_FROM | MCI_WAIT, (DWORD)(LPVOID) &mciPlayParms))
{
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
return (dwReturn);
}
if (MessageBox(hMainWnd, "Do you want to save this recording?",
"", MB_YESNO) == IDNO)
{
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
return (0L);
}
// Save the recording to a file named TEMPFILE.WAV. Wait for
// the operation to complete before continuing.
mciSaveParms.lpfilename = "tempfile.wav";
if (dwReturn = mciSendCommand(wDeviceID, MCI_SAVE,
MCI_SAVE_FILE | MCI_WAIT, (DWORD)(LPVOID) &mciSaveParms))
{
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
return (dwReturn);
}
return (0L);
}
if I add this code in wav.cpp,i got errors
Please give me suggestions and ideas..
help me
Regards,
Sangeet Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264899
C++ Vs C#
Anyone can point out the adavtages of C++ over C# in the 2005 Edition? Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264897
MScomm control faster or ReadFile faster?
Hi All,
It seems that we can use MScomm control or ReadFile (com_handle,
fifo_buffer, 254, &read, 0) to read com port data.
Which one is faster ?
P.S could you please advice how to add mscomm control to project?
Best regards,
Boki. Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264895
How to know how many bytes in buffer?
Hi All,
In VB, we can use "MSComm1.InBufferCount" to get the count of uart
buffer.
Could you please advice how to do that in VC?
Thank you very much!
Best regards,
Boki. Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264890
How to use WIN32 API in VC?
Hi All,
I have a WIN32 API call from VB:
Public Declare Function GetTickCount Lib "kernel32" () As Long
Could you please advice how to use it in VC?
Thank you very much!
Best regards,
Boki. Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264889
OT: stroke "orientation"
Sorry. I don't know any relevant newsgroups.
What I want to do is to able to recognize a rear license plate of a car. Say
due to the shot angles, the images are more or less skewed. At first
attempt, I was trying to transform the images using affine transformation to
make it erect 90 degrees as normal characters and compared with some
predefined character shapes. The new characters recognized would be put into
a nero-network. Now I have changed my mind, I would like to know how the
letters strokes are orientated. Say an O is always round and hollow, so each
time I see somethin' like this, I would say eh... this is an O. Are there
any ways I can do this? or any references that I can look?
Thanks
Jack Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264887
Point of operator() overloading (no pun intended)
After reading my book, and MSDN I'm still missing something to understanding
the "point" of this.
Given the code:
// function_call.cpp
class Point
{
public:
Point() { _x = _y = 0; }
Point &operator()( int dx, int dy )
{ _x += dx; _y += dy; return *this; }
private:
int _x, _y;
};
int main()
{
Point pt;
pt( 3, 2 );
}
How is this different than say adding a constructor that has the same body?
Is the only difference that you can only use the constructor when
instanciating?
If you have the constructor Point(int dx, int dy) { same as above}, the you
could simply do this:
int main()
{
Point pt(3, 2);
}
Thanks guys for helping a noob learn the in's and out's. Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264875
Stack Tracing
Hi,
I have come up against a bit of a hitch I cannot seem to find much on google
about targetting win32.
I would like to do a stack trace of a thread not belonging to my
application, the debug information isnt really that important, mangled up
names would be fine, its mainly the C-Style calls im after.
Could anyone advise an API for this?
--
- Mark Randall
http://www.temporal-solutions.co.uk
"We're Systems and Networks..."
"It's our job to know..." Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264867
Question about 'C' code and use of "void"
In code I'm reviewing I see this:
typedef void *PVOID; // <-- This line troubles me.
typedef PVOID *PPVOID;
And I'm confused becasue void is, of course, a keyword. Looks like someone
is trying to redefine the meaning of void, but I'm at a lose as to why.
Stick Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264864
Use of typedef in "C" code
I'm a noob, and this construct always escaped me:
typedef struct NAME_TAG {
// various variables here
} NAME_TYPE, *NAME_TYPE;
And I think I finally understand and want to confirm. In C++ there is no
need for the "struct" keyword when declaring variables.
Normally, in C:
struct NAME_TAG mystruct;
vs. in C++
NAME_TAG mystruct;
and so my guess is that the above type of pattern is to allow you to say
something like this in C:
NAME_TYPE mystruct;
without the 'struct' keyword.
Am I right?
Thanks, Stick Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264861
Quick Question!
Hello,
Without using STL, I find myself in the need to convert a TCHAR to an integer.
ex: "5" to 5
I am just putting off learning STL right now until I get some free time.
That's why I am looking into an alternate way of converting my data.
So I did a search and found the convert function. I started reading it and
at the bottom there is a few terms which I am not sure of.
I would like to know what is the difference between Implicit conversion and
explicit conversion?
If anyone also thinks that I am looking at the wrong command, I would
appreciated your input.
Thankyou all for your generous help! :)
--
Best regards
Robert Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264859
Software Disclaimer / EULA
Hello
I'm going to publish my software (freeware, "closed source") and looking
for a disclaimer which I want to publish with my application.
I often read the following:
"This software is provided as is ..."
My Question now: I'm not very well known wih writing an own. So.. are
there any "disclaimer templates", standard disclaimer or EULA on the web
which I can use?
Thanks
My app is closed source and freeware Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264854
Serial Port code
Hi,
I need a sample application in VC++ that works similar to Hyperterminal.
Is there something from Microsoft? The code should use an event based
approach to reading from the serial port.
regards,
Sinex Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264850
Classes not added when adding components and controls
Hi,
In VC++ 6.0, when we add a Registered ActiveX Control to the project form
Project menu\Add to Project\Components and Contorls, then all the classes
required for that control is automatically added to the project.
Even when we inset ActiveX componenet by right clicking a dialog resource.
and then try to add a variable for it, the Class wizard asks for inseting it
in the project, and inserts necessary classes for it..
But these things doesn't happen in VC++ .NET 2003.. currently I am working
in unmanaged vc++ .net 2003project.
Regards
Ashutosh Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264848
how to use VB 6 dll in VC++ 6
Hi
I have a ActiveX DLL written in VB 6, the dll has two classes. I have to use
these classes in a VC 6.0 or VC +.NET 2003 unmanaged project.
In VC 6.0 I have no idea as how to use it..
In VC++ .NET 2003, I can add the reference to the VB dll, but i can't use
it. Please help me with the syntax.
Regards,
Ashutosh Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264847
Can not change "Input Method" in Input Text
Hello,
I'm using VC++ 6.0 to develope multilanguage application software,
and I found that the user can not change "Input Method" in input text
by using press "Ctrl-Space" Key Windows XP.
There are no any control statements of input method in my
application software.
Shall I add some inital statements to reset the input method environment
in Widnows to solve this problem?
Thanks in advance.
--
Richard Hou Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264846
Preprocessor Question
I'm trying to get my brain around this:
#define lita(arg) #arg
#define xlita(arg) lita(arg)
Now, from what I am reading, this is a #define function-like macro.
So, if I enter code this:
cout << lita(Hello World);
It transforms into:
cout << "Hello World";
So, what is the "point" of the xlita(arg) version? Why would a programmer
need it? Thanks for your help.
Stick Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264841
Fixing new for VC6- on project-local basis
After much thinking at
http://msdn.microsoft.com/newsgroups/default.aspx?pg=2&p=1&tid=efddffe4-851f-4c80-9d77-7d64d809f9da&dg=microsoft.public.vc.language&cat=&lang=&cr=&sloc=en-us&mid=34273d38-9736-4312-aba5-676075a748e9
i settled for option IV.
This is a header i have in mind:
#if _MSC_VER <= 1200
void *__cdecl operator new(size_t size) throw()
{
char *p = new char[size];
if ( p == NULL) {
// TODO: log it
throw bad_alloc();
}
return p;
}
void *__cdecl operator new(size_t size, const std::nothrow_t&) throw()
{
char *p;
try
{
p = new char[size];
}
catch (std::bad_alloc)
{
p = NULL;
// TODO: log it
}
return p;
}
#endif
Any comments are welcome. Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264827
Form resource files
Hi there,
Given an arbitrary ".resx" file (not ."resources"), does anybody know how I
can identify that this file actually contains a Windows form (in code). Once
identified, I then want to collect information about the form and all its
controls. Presumably I would want to read this file into a
"System.Windows.Forms.Form" class so I can obtain the necessary info. How
would I do this. Thanks.in advance. Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264824
Detecting the system close button press
Hi all,
I'm extremely new to windows forms programming.
I'm using VC++ in Visual Studios 2005 to create a windows forms project
and I'd like to call some cleanup code when the system close button is
pressed. I've already got it going in my exit button and the exit on
the file menu.
Any help or pointers to a quick tutorial or example would be
appreciated.
Thanks Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264821
How to use IDL to create a move?
Hi,
I am a newer using IDL ,come from Nanjing,China!!
I have a question to ask you and hope some help from you!
How to make a seriers of pictures which have been existed to be
shown constinuously and automatically (like a move) in the
windowes
using IDL?
Thank you very much and hope quick answers!
XIEMIN Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264819
Why can't open other com port
Hi All,
I want to open a com port that is from PCI board.
I can control that port ( com 13 ) by VB with MSCOMM control, work
well.
Now, it can't work in VC, could you please advice?
Thank you very much!
Best regards,
Boki.
/////////////////////////////////////////////////////////
void InitialiseWindows(char *arg)
{
DCB
config;
COMMTIMEOUTS
timeouts;
// Open the com port required
com_handle = CreateFile
(
arg,
GENERIC_READ | GENERIC_WRITE,
0,
0,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0
);
if (com_handle == INVALID_HANDLE_VALUE)
{
printf ("Cannot open com port\n");
return;
}
// make sure everything is normal
memset (&config, 0, sizeof (config));
BuildCommDCB ("baud=460800 parity=N data=8 stop=1", &config);
// setup the com port state
SetCommState (com_handle, &config);
// setup the com port timeouts
timeouts.ReadIntervalTimeout = MAXDWORD;
timeouts.ReadTotalTimeoutConstant = 0;
timeouts.ReadTotalTimeoutMultiplier = 0;
timeouts.WriteTotalTimeoutConstant = 0;
timeouts.WriteTotalTimeoutMultiplier = 0;
SetCommTimeouts (com_handle, &timeouts);
// Setup the fifo depth
SetupComm (com_handle, 16, 16);
} Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264811
pbm or somethin' in lieu
Hi,
For simplicity reasons, I want to manipulate pbms on Linux or Windows
Platform.
I wonder if there is any open-source software that does conversion between
jpg's and pbm's?
Many articles state that pbm's are resource-hungry.
But as most of the color bits are represented by 1 and 0, just for
simplicity reason, I want to use it! Are there any better ways of doing
this?
the jpgs are taken from cameras. I want to do a yellow filtering procedure
to filter out the license plate and use dilation to emphase (can't spell)
the region...
and do pattern matching? is it viable? is there any source that I can look?
Sorry 4 bad English
Thanks
Jack Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264809
Help:About the message queue
Supposed there are several messages waiting in the message queue: A, B,
C, D.
When the windows procedure is processing the message A, it call a
function which sends another message E , then are the message E
processed prior to B?
Thank you Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264805
ArrayList
What is wrong with the following code? I am trying to create an ArrayList,
but it keeps giving me an illegal use error. I tried it both in VC++.NET
2002 and in VC++ Express 2005.
/ This is the main project file for VC++ application project
// generated using an Application Wizard.
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
using namespace System::Collections;
int _tmain()
{
// TODO: Please replace the sample code below with your own.
ArrayList arList = new ArrayList();
Console::WriteLine(S"Hello World");
return 0;
}
Z.K. Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264795
template class pointer instantiation
I have declared some template classes and would like to instantiate the
classes programatically because of the time it takes to instantiate them at
runtime.
Here is the templates
template <class T> class classObj
{
public:
volatile long InUse;
time_t lastAccessed;
T TClass;
classObj();
};
template <int i, class T = classObj<T> > class ClassContainer
{
public:
ClassContainer();
private:
volatile long iNext;
volatile long iActive;
volatile long iMax;
T TObjs[i];
string ObjType;
public:
void SetName(LPCSTR n);
long GetMaxCount();
long GetActiveCount();
void * GetActiveEntry(long *pIndex);
void * GetNextObj();
long Cleanup();
void Reset(T * pObj);
void Reset();
};
Currently I have this:
ClassContainer<MAX_SESSION_OBJS, classObj<CClient> > CClients;
Would like this:
ClassContainer<MAX_SESSION_OBJS, classObj<CClient> > *pCClients;
pCClients = new ClassContainer;
I'm having trouble with the syntax for the last line.
Thanks,
--
Timothy Jewett
Jewettware@online.nospam Tag: First-chance exception in Sender.exe: 0xC0000005: Access Violation. Tag: 264791
hi i am getting this error while accessing a CString variable in loop.
why am i getting this.