|
Welcome brother!
I went straight from C coding to using MFC, and [yah] it corrupted me too. My best code [my opinion] was always the code that did not depend on MFC or even Windows.
On my own time I started working on standard C++ code, utilizing STL and building templates, amongst other things. If you really want to learn the details, try writing a complex C++ template class. Meyers is an excellent reference, which I have used myself.
The most important method used by the STL [in my opinion] is swap(), know why and how to implement it as a method guaranteed not to throw.
Good luck!
INTP
Every thing is relative...
|
|
|
|
|
Thanks again for the advice.
John R. Shaw wrote: On my own time
That's about the phase I'm in now. Using MFC at work and bound and determined to finally learn how to write my own templates and finally embrace the STL on my own time. I wish I would've done this years ago but I guess that's how life turns out sometimes.
Take Care.
|
|
|
|
|
I keep receiving an unexplained error when I use the CSocket class in a multithreaded program. The error is in the socketcore.cpp file:
BOOL CSocket::PumpMessages(UINT uStopFlag)<br />
{<br />
ASSERT(m_pbBlocking == NULL);<br />
<br />
_AFX_SOCK_THREAD_STATE* pState = _afxSockThreadState;<br />
<br />
ASSERT(pState->m_hSocketWindow != NULL); <br />
<br />
.<br />
.<br />
.<br />
.<br />
}
I have read several articles regarding the reliability of the CSocket class in multithreaded applications. I just wanted to know if anyone here had any opinions on the subject or a solution to this particular problem.
Thanks!
-- modified at 14:01 Thursday 16th February, 2006
|
|
|
|
|
Call AfxSocketInit() in each thread that is using sockets.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I have a class member CSocket variable that is used in several class member functions. AfxSocketInit() is first called in the app's InitInstance() . Should I also call it in my class constructor?
The problem is that the app will receive half of the file sent by a TCP server and then generate the error. The size of the file doesn't make a difference!
|
|
|
|
|
masnu wrote: Should I also call it in my class constructor?
No, you need to call it at the beginning of any thread that uses sockets.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
I have been trying to construct a simple server client system just to come to grips with TCP/IP programming. It has a authentication system where the protocol goes something like...
server: "AUTH"
client: "AUTH:<user>:<pass>"
server:"AUTH:SUCCESS" or "AUTH:FAILURE" depending on result
server may follow the "AUTH:FAILURE" with an "EXIT" to break the connection in certain conditions. however when i try to send the "AUTH:FAILURE" and "EXIT" strings in succession, i land up receiving "AUTH:FAILUREEXIT" at the client which then messes up things. I have tried disabling the Nagle's algorithm but the problem still persists.
Any pointers on how i could solve this?one way is to introduce seperators between two send()s but i would like to know of any methods to get by without seperators.
Thanks!
clueso
|
|
|
|
|
Nagle-ing might not have anything to do with it. The Nagle algorithm works to improve the performance of a send operation. But the intermediate network equipment as well as the receving system are free to combine or break apart data as they see fit - TCP sockets are stream sockets, and as such, data will stream into and out of them.
Moving to a datagram socket will prevent this, but you lose the automatic guarnanteed delivery you get with TCP.
I would suggest better parsing (watch for keywords made of combined data segments), change the format of the messages (e.g. each one starts with 0x01 and ends with 0xFF ), or change to a request-ack system, where each command gets an ACK back before the next one is sent.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi,
I have say N Elements, of N i want R cominations of N.How to find the combinations.So that i can take them in array nd use them..and they should not repeat ..
Thanks before
James
|
|
|
|
|
RockyJames wrote: How to find the combinations.So that i can take them in array nd use them..and they should not repeat ..
if they should not repeat, they are not Combinations but Arrangements.
n!
nCp(n, p) = ---------------
(n - p)! * p!
n!
nAp(n, p) = ----------
(n - p)!
see in my VisualCalc to see a possible implement of them (you can just have a look at the Doxygen Parser documentation provided at the top of the article - when having unzipped it, you will find your answer by looking at doc/html/class_c_v_calc_parser.html#8f5e1a27fee1e8aea82de140cd8fc839 ).
TOXCCT >>> GEII power [toxcct][VisualCalc 2.24][3.0 soon...]
-- modified at 13:08 Thursday 16th February, 2006
|
|
|
|
|
I know the formula for cominations and permutations.Say N=6 Elements and p=3
In what cominations should i need to fill my Array Double A[3][10] Each time i have take 3 elements out of 6 elements ..And they dhould not reapeat.
thanks before
James
|
|
|
|
|
toxcct wrote: if they should not repeat, they are not Combinations but Arrangements.
Not quite. Permutations and combinations can both repeat and not repeat. The formulas look very similar.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
i want find out cominations for N=6 and r=3
i.e 1 2 3
2 4 5
3 4 6
2 3 4
3 4 5
4 5 6
5 6 1
5 6 2 ........etc...So i want to implement this..Each time i want these elementd data in to array and perform some task......Can any help me in doing this.....
I hope i am more clear this time....Hope so.....
Thanks befor
James
|
|
|
|
|
See here.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
In previous versions of Visual Studio, the linker an the editbin utility had the ability to convert object files from OMF to COFF format. I can't make it work with the link.exe and editbin.exe versions in VS2005.
Does anybody know if that conversion was intentionally removed in VS2005 or if it's just a bug?
I have a project in which some files are compiled with arity/prolog32 (v.1.1). The output of the prolog compiler is an object file in OMF format. Actually, the compiler itself tries to silently convert it to COFF by calling editbin behind the scenes. But with VS2005 the conversion fails and the object file remains in OMF format. Trying to convert the file by explicitly calling EDITBIN from the command line produces the following output, and the file is not converted:
Microsoft (R) COFF/PE Editor Version 8.00.50727.42<br />
Copyright (C) Microsoft Corporation. All rights reserved.<br />
<br />
prlg_ifce.obj : warning LNK4048: Invalid format file; ignored<br />
<br />
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Hi,
I have a COM DLL, and am trying to access this DLL from a MFC application in VC 6.0. But the linker is throwing the following error:
unresolved external symbol "int __stdcall AfxMessageBox
An eg of the usage of AfxMessageBox in the Application code is as under:
AfxMessageBox("Connection Failure",MB_OK);
Help would be quite Helpful !!!
|
|
|
|
|
|
toxcct wrote: remove the 2nd parameter
Am still getting the same linker error...
|
|
|
|
|
Sounds like your COM DLL is not built to use MFC.
Instead of dragging MFC into your COM DLL, I would just use MessageBox(...) instead.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I'm using SQLXMLBulkLoad object to read XML/XSD files and insert data and structure into empty SQL Server database.
SQLXMLBulkLoad::Execute( XMLFile, XSDFile) is executed succesfully, but the database remains empty. No tables are created and no data copied.
SQLXMLBulkLoad.BulkLoad property is TRUE
SQLXMLBulkLoad.SchemaGen property is TRUE
Are there some other properties needed for correct Bulkload, or some SQL Server setting to allow this operation?
thanks.
|
|
|
|
|
I am trying to develop a MFC program with database support using DAO.I am using VC6.0 and access 2003.Yet I got the message that VC6.0 can't detect access 2000 database when using DAO.How can I solve this problem?Thanks!
|
|
|
|
|
Hi dear friends,
I want to add ATL support to MFC DLL,
Can you help me?
|
|
|
|
|
It involves adding a global _Module variable and initializing it properly. If you make a dummy DLL project with the AppWizard, and enable MFC and ATL support, you can see how the ATL part is initialized.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Hi, Thanks for your reply.
I meant adding ATL support to an MFC extension DLL. You know that in VC++ 6.0 (and also later) you can not add ATL support to MFC extension DLLs but you can add this support to regular DLLs.
Knowing this, can I add ATL support to MFC extension DLLs in the way you mentioned.
|
|
|
|
|
a_kiani wrote: I want to add ATL support to MFC DLL,
Could you tell me which ATL class you intended to use in MFC dll.!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|