|
As i told ya it is not always neccessary that there should be a error message, I guess its a serious problem in the code that is causing premuture termination.
1.Why do people not wearing a wrist watch look at their wrist for time when people ask for time.
2.Why do people ask for time from people who are not wearing a wrist watch.
Prakash,
India.
|
|
|
|
|
Hello Mr. Prakash,
may be you're right. We do have ONE recursive function in our code. I also created a dummy recursive function which is called with no end condition. And I got the exact same behaviour as in our service app... no error message...
Thanks,
Gero
|
|
|
|
|
No Problem, just sharing my experience.
"Fear not of those who can kill the body and not the soul, rather fear Him who can kill both body and soul" - Bible
Prakash,
India.
|
|
|
|
|
Require some help in relation to the problem illustrated below
struct THREAD_CONTROL
{
HNADLE hDevice;
HANDlE hEvent;
};
HANDLE inThreadControl;
inThreadControl.hDevice = hDeviceWrite;
inThreadControl.hEvent = WriteEvent;
_beginthread(ThreadEZUSBWrite,0, &inThreadControl);
void ThreadEZUSBWrite(THREAD_CONTROL pThreadCtrl)
{
// TODO HERE
}
error C2664: '_beginthread' :
cannot convert parameter 1 from 'void (struct THREAD_CONTROL)' to 'void (__cdecl *)(void *)'
None of the functions with this name in scope match the target typ
Suggested appreciated
Kind Regards
Kevin
|
|
|
|
|
This is wrong way to pass multi paramater in thread, instead use
#include "process.h"
beginthread(MyFun,0,reinterpret_caste<cmyclass*>(this));
.
.
MyFunc(LPVOID pThis);
DWORD CMyclass::MyFunc(LPVOID pThis)
{
CMyClass *pThisObj = static_cast<cmyclass*>(pThis);
pThis->UseurClassFunctions.....
.
.
.
}
regards
Balkrishna Talele
|
|
|
|
|
Did you declare the prototype of the thread function before it is called?
and also the input parameter of the thread function is and should be void* not THREAD_CONTROL
so in a nutshell
//thread proc
void ThreadEZUSBWrite(void* pThreadCtrl)
{
THREAD_CONTROL *pControl;
pControl = (THREAD_CONTROL*) pThreadCtrl;
}
//and to start the thread.
...
_beginthread(ThreadEZUSBWrite,0, (void*)&inThreadControl);
...
1.Why do people not wearing a wrist watch look at their wrist for time when people ask for time.
2.Why do people ask for time from people who are not wearing a wrist watch.
Prakash,
India.
|
|
|
|
|
I've two global variables which I require defined in a header file, unfortunately I require this file to be included in more than one C++ file. However I get an error in relation to the global variables being defined twice. Any suggestions on a workaround?
Kind Regards
Caoimh
|
|
|
|
|
Put the definition in the .cpp
ex.
.cpp
int variable;
.h
extern int variable;
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
u forgot to type "extern"
some.h
int gGlobal;
fx.c
extern int gGlobal;
|
|
|
|
|
We normally dont define a variable in the header file as the header file is included in many cpp files, it causes redefination of the variable.
Instead we define the variable in a .cpp file or .c file and an extern in the .h file.
In windows application developed using the project wizard, it creates two files namely stdafx.h and stdafx.cpp
stdafx is by default included in each file that you add using the classwizard.
and stdafx.cpp is generally a empty file except for #include "stdafx.h"
So the best thing is to put the defination of the variable in the stdafx.cpp file and extern in stdafx.h file
forexample
in stdafx.cpp file
#include "stdafx.h"
int g_SomeGlobalVariable;
and in stdafx.h file
extern int g_SomeGlobalVariable;
hope this solves ur problem.
1.Why do people not wearing a wrist watch look at their wrist for time when people ask for time.
2.Why do people ask for time from people who are not wearing a wrist watch.
Prakash,
India.
|
|
|
|
|
|
hi!
I am using the following code to generate a random string. But each time i get the same string output. Can anyone help.
char myarray[22];
char* CGeneratorApp::GenerateString()
{
myarray[21]='\0';
for(int k=0;k<21;k++)
{
myarray[k] = (char)(((int)rand()%25)+65);
}
char first[2];
intUsed++;
sprintf(first,"%d",intUsed);
if(intUsed<10)
{
first[1]=first[0];
first[0]='0';
}
first[0]=(char)((int)first[0]+27);
first[1]=(char)((int)first[1]+27);
myarray[8]=first[0];
myarray[10]=first[1];
AfxMessageBox(myarray);
return myarray;
}
Thnx in advance
|
|
|
|
|
Please take a look into the MSDN under command 'srand' !!!
Try to extend your code as follow:
#include <stdlib.h>
#include <time.h>
..
...
srand ( (unsigned)time (NULL) );
for(int k=0;k<21;k++)
{
myarray[k] = (char)(((int)rand()%25)+65);
}
...
...
greets al
|
|
|
|
|
Dont forget to call randomize before calling the rand fucntion.
1.Why do people not wearing a wrist watch look at their wrist for time when people ask for time.
2.Why do people ask for time from people who are not wearing a wrist watch.
Prakash,
India.
|
|
|
|
|
sorry, the includes are:
#include <stdlib.h>
#include <time.h>
greets al
|
|
|
|
|
|
I've two separate dialogs (Dialog1,Dialog2), each having its own class. Dialog1 has an Edit box which I need to write to, from Dialog2. In Dialog1 I normally use
CString Status;
GetDlgItemText(IDC_EXIT_BOX_ONE, STATUS);
SetDlgItemText(IDC_EDIT_BOX_ONE, "TEST APPLICATION");
However If I do the very same in Dialog2 nothing appears in the Edit box of Dialog1.
Any Suggestions.
(Note required to use GetDlgItemText to maintain all information on the Edit box)
Kind Regards
Caoimh
|
|
|
|
|
How will it work???
IDC_EXIT_BOX_ONE is a dialog item of the other dialog.
to do this you need to have the pointer of the other dialog
CDialog1 *pDlg1;
so from the second dialog
//in CDialog2
you say
pDlg1->GetDlgItemText(IDC_EXIT_BOX_ONE, STATUS);
pDlg1->SetDlgItemText(IDC_EDIT_BOX_ONE, "TEST APPLICATION");
1.Why do people not wearing a wrist watch look at their wrist for time when people ask for time.
2.Why do people ask for time from people who are not wearing a wrist watch.
Prakash,
India.
|
|
|
|
|
I've found there are loads of macros in the windowsx.h header file. Anyone know if there is a listed description of these macros available, or do I just plough through this header? Thanx.;)
|
|
|
|
|
There are some macros not documented in the MSDN but most of them are...
Some macros are for internal use. But you will lot of things if you go throuh the header files of the windows operating system.
1.Why do people not wearing a wrist watch look at their wrist for time when people ask for time.
2.Why do people ask for time from people who are not wearing a wrist watch.
Prakash,
India.
|
|
|
|
|
Hi
I am new to VC++ and have given the task to connect VC++ with the Oracle,so plz some body help me i have no idea from where i have to start caze i am really unable to understand how the VC program control flows so plz help me in that also can i use the ADO componenets for that tell me in detail and if possible plz refer me a tutorial including source code for it.
Thanx
alex303
|
|
|
|
|
I have a class structure as follows:
Class A: public CObject
{
}
Class B: Public A
{
}
Now I want to serialize pointer class B using CArchive.
How can this be done?
Regards
|
|
|
|
|
|
in .h file
class A : public CObject
{
public:
DECLARE_SERIAL( A )
A(){};
void Serialize( CArchive& archive );
};
in .cpp file
IMPLEMENT_SERIAL( A, CObject, 1 )
void A::Serialize( CArchive& archive )
{
CObject::Serialize( archive );
if( archive.IsStoring() )
else
}
Hope this code help you , for further reading MSDN has good explanation for
serialization.
1.Why do people not wearing a wrist watch look at their wrist for time when people ask for time.
2.Why do people ask for time from people who are not wearing a wrist watch.
Prakash,
India.
|
|
|
|
|
I would like to see my binary tree nodes and their data contents by using a tree control, but I would like to show it in horizontaly and from top to bottom expanding way, not the vertically way as in the explorer style tree control. This can be implemented using available tree controls or does this require a fully new implementation ?
|
|
|
|