|
i think your really not ready to code a game... begin learning the basics!
when you've done this, check out the "Pick"-Example (D3D) from the microsoft DirectX SDK!
Don't try it, just do it!
|
|
|
|
|
Hi,
I am working on a project that that makes use of WSAOVERLAPPEDPLUS or OVERLAPPEDPLUS structure. However, Visual C++ compiler outputs and error that says WSAOVERLAPPEDPLUS is an unknown identifier.
What header files or libraries do you need for WSAOVERLAPPEDPLUS? I imported ws2tcpip, ws2spi, and winsock2.
Thanks,
Kuphryn
|
|
|
|
|
have you tried installing platform sdk yet?
|
|
|
|
|
Thanks.
Come to find it, WSAOVERLAPPEDPLUS is an abstract structure, not something that is official.
Kuphryn
|
|
|
|
|
Hi, how can i get a list of tables with columns from a access database
by using cdatabase and crecordset? I want to use the list in
a CTreeCtrl!
|
|
|
|
|
//To get the tables in the database
CDaoDatabase db;
db.Open("pathToDatabase");
CDaoTableDefInfo tblInfo;
short tblCount=db.GetTableDefCount();
for(int u=0;utblCount;u++)
{
db.GetTableDefInfo(u, tableInfo);
//Take the tablename tableInfo structure and write it to your treeCtrl
}
To get the columns of the table it's the same with the GetFieldCount and GetFieldInfo members of the class CDaoRecordset.
MS
|
|
|
|
|
Hello all,
I use VC6. Haven't the funds to bother with VS.NET yet...
I have the weirdest problems happening lately, with this code:
<br />
double* arr = new double[some_length];<br />
<br />
if (arr == NULL) return; <br />
<br />
<br />
delete[] arr; <br />
arr = NULL;<br />
I have no idea what could be causing this -- I mean, I am behaving myself, and calling delete for arrays of a primitive type that I allocate on the heap, right? The problem is there whether I call either delete[] or just plain delete . The problem goes away when I remove the call to delete[] entirely.
same thing happens using malloc()/free()...what's going on?
This is bizzare. Has anybody else seen this behavior before? Thanks.
Sincerely Yours,
Brian Hart
Department of Physics and Astronomy
University of California, Irvine
|
|
|
|
|
Where does the problem happen? Is it right at the
delete[] arr;
call, or is it later in the code? If it's later, chances are something else is trying to use it after it has been deleted.
Otherwise, perhaps you are deleting arr somewhere else above, and not setting it to NULL, and then trying to delete it again?
It's impossible to say without seeing the rest of the code.
BTW, you are right in calling delete[] .
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
Hello Navin,
It faults right on delete[] arr; . I don't understand. Whenever I delete any pointer in my program, I always do:
<br />
if (arr != NULL) {<br />
delete[] arr;<br />
arr = NULL;<br />
}<br />
However, it still faults on the delete[] arr; . I agree with Neville Franks that I think I am screwing the heap, but how does one prevent this?
Thanks for any help -- it is much appreciated.
Sincerely Yours,
Brian Hart
Department of Physics and Astronomy
University of California, Irvine
|
|
|
|
|
Brian Hart wrote:
if (arr != NULL) {
delete[] arr;
arr = NULL;
}
delete is smarter than the C free() function and does the right thing (which is to do nothing at all!) when you delete a pointer that is NULL (or 0).
Ofcourse, still want to set your pointer to 0 when you are done.
|
|
|
|
|
Hello All:
I have solved the problem. What i have done is:
<br />
double* arr = double[size];<br />
<br />
... <br />
<br />
delete[] arr; <br />
arr = NULL;<br />
I discovered this goes away when I set the size of the array to size + 1 ; i.e. delete[] sometimes faults because the debug version of things told me that I was having buffer overruns. Setting the array size to size + n where n is some arbitary number gives the computer a 'buffer' to work with to protect agsinst overruns.
Thanks for the help.
Sincerely Yours,
Brian Hart
Department of Physics and Astronomy
University of California, Irvine
|
|
|
|
|
Brian Hart wrote:
I discovered this goes away when I set the size of the array to size + 1; i.e. delete[] sometimes faults because the debug version of things told me that I was having buffer overruns. Setting the array size to size + n where n is some arbitary number gives the computer a 'buffer' to work with to protect agsinst overruns.
What you're describing here is a sever programming error. You're going past the end of your allocated 'arr' somewhere, and corrupting your stack. Your 'buffer' is just hiding the problem. You really should take a close look at your code, and figure out what's going wrong. You probablu have an array bounds problem. I would bet you're not even performing your calculation correctly.
What you've said about "protecting against buffer overruns" is complete nonsense.
|
|
|
|
|
Actually, free(NULL) is safe on any standard C compiler. There were certainly old, pre ANSI C, compilers that didn't handle free(NULL) well.
--------
There are 10 types of people in this world. Those who know binary and those who don't.
|
|
|
|
|
You haven't said precisely what the error is, but I assume it is an error in the heap. I think you'll find you've screwed the heap somewhere in your code and when delete(free) is called it is detecting this. There are various flags you can set to help track heap problems. Have a look at _CrtSetDbgFlag().
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Neville Franks wrote:
You haven't said precisely what the error is, but I assume it is an error in the heap. I think you'll find you've screwed the heap somewhere in your code and when delete(free) is called it is detecting this. There are various flags you can set to help track heap problems. Have a look at _CrtSetDbgFlag().
Hello Neville:
I have solved the problem. It was just a buffer overrun, which I fixed by allocating a couple of more 'extra' elements than I needed.
Thanks for the help.
Sincerely Yours,
Brian Hart
Department of Physics and Astronomy
University of California, Irvine
|
|
|
|
|
You are probably overruning arr
To confirm:
allocate one element more [some_length+1 ];
put some predefined double value into arr[some_length](1234.);
before delete check that the value at arr[some_length] is still the same.
If not -- you've got confirmation.
Also, just a clue: if you do new and delete in different modules: check if both of them are using same runtime (Release/Debug).
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
igor1960 wrote:
You are probably overruning arr
To confirm:
allocate one element more [some_length+1 ];
put some predefined double value into arr[some_length](1234.);
before delete check that the value at ...
Yep, that was it...thanks for the help.
Sincerely Yours,
Brian Hart
Department of Physics and Astronomy
University of California, Irvine
|
|
|
|
|
Hi, in my MFC app I have a template class like this:
<br />
template <typename BASE><br />
class CBWnd : public BASE {<br />
public:<br />
CBWnd(){};<br />
CBWnd(LPCTSTR s, CWnd *p):BASE(s, p){};<br />
CBWnd(UINT n, CWnd *p):BASE(n, p){};<br />
CBWnd(LPCTSTR s):BASE(s){};<br />
CBWnd(UINT n):BASE(n){}; <br />
};<br />
When I derive a class from an MFC one a make this:
<br />
class CMyButton : public CBWnd < CButton > {};<br />
<br />
class CMyDialog : public CBWnd < CDialog > <br />
{<br />
CMyDialog(LPCTSTR s, CWnd *p):CBWnd< CDialog >(s, p){};<br />
};<br />
In the contructors of CMyButton and CMyDialog I need to pass the parameters (for example the template ID and the parent window of derived a dialog) to the base class (CDialog, CButton and so on...that's why all constructors).
This code works fine on Visual Studio 6 but doesn't compile on Visual Studio 2003 because this compiler check all the CBWnd constructors (VS6 check only the used ones...)and if there isn't an implementation in the other classes (CMyButton, CMyDialog ecc...)
of the called one it generates an error...
Plz help me!
|
|
|
|
|
Shouldn't you be using:
template < typename BASE ><br />
class CBWnd : public BASE {<br />
public:<br />
CBWnd(){};<br />
...
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
That was only a problem in the code formatting (forgot spaces)...
You didn't answer my question...
bye
|
|
|
|
|
Hi, all
recently i'm planing to make an ie plugin to prevent some(not all) scripts running on ie, or even disable download them from the web, i notice norton antivirus 2003 has some kind of function like that -- script blocking. i originally considered the BHO, but there isn't any events about for script running. anybody can let me know that? thanks.
|
|
|
|
|
Hello, following is my problem:
In Serial communication, I want to send and receive data of 9 dataBits. How should i set the DCB? And how can i get the 9th bit when receive.
Please , help me. Thanks.
|
|
|
|
|
There is no such thing 9 databits.
beware that:
When a DCB structure is used to configure the 8250, the following restrictions apply to the values specified for the ByteSize and StopBits members:
The number of data bits must be 5 to 8 bits.
The use of 5 data bits with 2 stop bits is an invalid combination, as is 6, 7, or 8 data bits with 1.5 stop bits.
Good luck!
ÿFor the bread of God is he who comes down from heaven and gives life to the world. - John 6:33
|
|
|
|
|
We can set databits to 8, and set the dcb.parity to
MarkParity or SpaceParity as the 9th bit to send.
if dcb.parity equals markParity then the 9th bit is 1;
if dcb.parity equals spaceParity then the 9th bit is 0.
|
|
|
|
|
can anyone kindly provide source code for adding cdialogbar into an SDI? Also does this CDialogBar have all the cntrls (buttons, treelist, combo..etc) as in the cdialog? thanx!
|
|
|
|