|
Wow! Thanks! That fixed it! I know the order of headers matters, but is there a simple reason why this worked?
Thanks,
Selevercin
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
The compiler uses stdafx.cpp to generate a precompiled header file substituting it for all # include's in the # include stdafx.h directive. The header stdafx.h should be at the top of all headers because the compiler ignores any # include directives before stdafx.h.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
if you don't want to include stdafx.h try this:
go to Project->Settings->C/C++->Project Options and search for:
""/Yu"stdafx.h" " and replace it by "" (nothing) (that means kick it !)
and you don't need to include stdafx.h
Sendel
The only place for millions of bugs is the Rainforest
|
|
|
|
|
hi people,
I created a button (button1) that was suppose to bring out the save file dialog and prompt user for a place to save the file.. which works exactly like "SAVE AS" under FILE selection. but i can't get it to work. for example, i want to save a file "c:\ABC.txt" into "d:\XYZ.txt" using the save file dialog once button1 is clicked...
void CMytestDlg::OnButton1()
{
}
thanks in advance.;)
|
|
|
|
|
CFileDialog d(true);
if (d.DoModal() == IDOK)
{
}
else
{
}
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
.... the dialog thing came out.. but it looks like a file opening dialog.. i'm really new at this... can you please be more detail here? thanks..
for example..
everytime button is clicked.. a specific file (c:\ABC.txt) will be saved to another location that user placed in the prompt..
thanks again.. your help is grealy appreciated..
|
|
|
|
|
there is a member of CFileDialog called
m_ofn[^].
it is an OPENFILENAME[^] structure, which can be modified before calling the dialog (ie. before DoModal()) to define the dialogs behaviour.
BW
"I always wanted to be somebody, but now I realize I should have been more specific."
- Lily Tomlin
|
|
|
|
|
Use CFileDialog dlg(FALSE); instead - this creates the dialog as a "Save" dialog instead of an "Open" dialog.
|
|
|
|
|
oops.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Does anyone know how to seek a value in a database field from an ODBC recordset? In other words, is there an equivalent to the CDAORecordset.seek or CDAORecordset.find for ODBC? Thanks,
Ralf.
ralf.riedel@usm.edu
|
|
|
|
|
Try CRecordset::m_strFilter.
i.e.
// m_Rs is a CRecordset instance
m_Rs.m_strFilter = "vField = someValue";
I really don't know what the advantages and disadvantages are but personally I use filters to search for values.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
yo can use m_strFilter this way too:
recordset.m_strFilter.Format("intField=%d",value);
the format works the same as printf.
you can use AND if you need to find records that meet two values at the same time.
bye
Daniel Cespedes Daza
"Santa Cruz de la Sierra Paraiso Terrenal!"
daniel.cespedes@ieee.org
|
|
|
|
|
hello.
I´m making a TCP SocketServer Class derived from CAsynCSocket where I overwrite the OnAccept and OnReceive method.
void SurServer::OnAccept(int nErrorCode)
{
SurServer* ps=new SurServer(pWnd);
Accept(*ps);
CAsyncSocket::OnAccept(nErrorCode);
}
void SurServer::OnReceive(int nErrorCode)
{
char *pBuf = new char[4096];
int iBufSize = 4095;
int iRcvd;
CString strRecvd;
iRcvd = Receive(pBuf, iBufSize);
pBuf[iRcvd] = NULL;
strRecvd = pBuf;
((CSpoolerSurDlg*)pWnd)->NuevaTarea(strRecvd);
}
PWnd is a reference to dialog partner. All that work fine, but, I need something better because I have a big traffic of messages at the same time.
el hombre arriesga su vida cada vez que elige y eso es lo que lo hace libre
|
|
|
|
|
One solution is IOCP.
Kuphryn
|
|
|
|
|
I listened that i could use MultiThread Socket. But I don´t know how to make it.
|
|
|
|
|
can sameone help me whith that problem
|
|
|
|
|
the solution is to use CSocket , and don´t use CAsyncSocket
|
|
|
|
|
I compiled and linked some sample source code got from Microsoft SDK, there were some strange link errors:"error LNK2001: unresolved external symbol "error LNK2001: unresolved external symbol "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z)" and "error LNK2001: unresolved external symbol "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z)", it caused by such code:"_TCHAR *szName = new _TCHAR[100]" and "delete []szName".I tried to change the project setting option, but it still happened. I just wonder if there is anyone once met such problem before and how to solve it. Thank you.
Ray
|
|
|
|
|
sounds like either:
a: You are usinf functions from a library but havent added the lib to your project settings
or
b: You have a function defined that there is no prototype for.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
check this out, hopefully it might help you:
http://www.codeproject.com/cpp/cppforumfaq.asp#cl_errormain
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
|
Welcome to CP where everything is made up and points don't matter.
Thank you Nitron.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Hi, I have written a nice class (well, I think it's nice... may be other don't )
I have called it class Stream but I think it's a wrong name for that, but how do I name it ?!
What the class do:
Stream.begin();
void * Stream.end();
Stream.clear();
Stream.add(void * data, int size);
example on how to use it:
Stream myStream;
void * t1 = allocateMem(11);
void * t2 = allocateMem(21);
void * t3 = allocateMem(31);
memmove(t1,"1________x\0",11);
memmove(t2,"2________xa________x\0",21);
memmove(t3,"3________x_________xb________x\0",31);
myStream.begin();
printf(" fill stream:\n"); myStream.add(t1,11);
printf(" fill stream:\n"); myStream.add(t2,21);
printf(" fill stream:\n"); myStream.add(t3,31);
printf(" --- stream completed ---\n");
char * myData = (char *) myStream.end();
tStreamheader * pStreamheader = (tStreamheader *)myData;
printf(" num of blocks: %i\n",pStreamheader->numblocks);
unsigned long * pBlocksize;
char * pBlockdata = NULL;
unsigned long myoffset = sizeof(tStreamheader);
for (int i = 0; i< (int) pStreamheader->numblocks; i++)
{
pBlocksize = (unsigned long *) (myData + myoffset);
myoffset+=sizeof(unsigned long);
pBlockdata = (char *)allocateMem(*pBlocksize);
memmove(pBlockdata, myData + myoffset,*pBlocksize);
myoffset+=*pBlocksize;
printf(" Stream Block %i size = %u\n", i, *pBlocksize);
printf(" Stream Block data = %s\n",pBlockdata);
pBlockdata = freeMem(pBlockdata);
}
t1 = freeMem(t1);
t2 = freeMem(t2);
t3 = freeMem(t3);
So, how should I call this class ?!
Do anyone need such a class ? Because it's free code and I want to make it here available...
what do you all think ?!
thanks alot ,
Sendel
The only place for millions of bugs is the Rainforest
|
|
|
|
|
if you wanna be an MFC junkie (hungarian strain) you put a "C" in front of it (for "Class"), and then maybe camelize and call it something like: CMyCoolStream
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Strange , I always thought that "C" stands for MFC (Microsoft Foundation Class) so if you call your classes like "CMyClass" you say that your class is only for MFC. So I won't put any "C" before my class name
but anyway: My class isn't a real stream class, so I thought that "Stream" is not the right name for it: neither CMyVeryCoolAbsoluteUnbelivableWorkingBuglessSpiritRichMasterlyWorkOf ArtStream will do...
I thought about packing names because it is packing data to one big block. Also DataCollector, BufferPacker, DataPatcher, DataConnector, DataWeld, DataSoupPot or DataMashCollectingTank... ;P
So I am not sure what it really is... may be I have to expand it a littlebit more so it would be really a stream class: i have to overload the << and >> operators etc. in that way that you can use it as follows:
network_in<<MyStream<<MyClass;
...
network_out>>MyStream>>MyClass;
but I don't think that it is possible to create such an intelligent class
but any way: I will use this class to prepare Data to be send over network and also to be reconverted back to its old structure after receiving it on the second pc.
datastructure -> Stream -> sending -> receiving -> Stream -> datastructure
Thank you
Sendel
PS: I will release this code here for free anyway: if you want or if you don't!;P
The only place for millions of bugs is the Rainforest
|
|
|
|