|
Yes, there is no need to use a mutex if you prefer some other option. As I said, there are many ways this can be done.
Steve
|
|
|
|
|
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
If I had a dollar for every time this question was asked here I could pay off my kitchen remodel ...
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
------ Build started: Project: Project4a, Configuration: Debug Win32 ------
Compiling...
Impl.cpp
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(112) : error C2011: 'fd_set' : 'struct' type redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(54) : see declaration of 'fd_set'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(147) : warning C4005: 'FD_SET' : macro redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(88) : see previous definition of 'FD_SET'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(156) : error C2011: 'timeval' : 'struct' type redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(97) : see declaration of 'timeval'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(212) : error C2011: 'hostent' : 'struct' type redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(153) : see declaration of 'hostent'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(225) : error C2011: 'netent' : 'struct' type redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(166) : see declaration of 'netent'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(232) : error C2011: 'servent' : 'struct' type redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(173) : see declaration of 'servent'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(244) : error C2011: 'protoent' : 'struct' type redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(185) : see declaration of 'protoent'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(400) : error C2011: 'sockaddr_in' : 'struct' type redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(321) : see declaration of 'sockaddr_in'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(410) : error C2011: 'WSAData' : 'struct' type redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(331) : see declaration of 'WSAData'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(470) : warning C4005: 'SO_DONTLINGER' : macro redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(411) : see previous definition of 'SO_DONTLINGER'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(527) : warning C4005: 'AF_IPX' : macro redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(469) : see previous definition of 'AF_IPX'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(555) : warning C4005: 'AF_MAX' : macro redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(488) : see previous definition of 'AF_MAX'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(561) : error C2011: 'sockaddr' : 'struct' type redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(494) : see declaration of 'sockaddr'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(601) : error C2011: 'sockproto' : 'struct' type redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(503) : see declaration of 'sockproto'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(640) : error C2011: 'linger' : 'struct' type redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(540) : see declaration of 'linger'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(653) : warning C4005: 'SOMAXCONN' : macro redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(553) : see previous definition of 'SOMAXCONN'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(679) : warning C4005: 'FD_READ' : macro redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(571) : see previous definition of 'FD_READ'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(682) : warning C4005: 'FD_WRITE' : macro redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(572) : see previous definition of 'FD_WRITE'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(685) : warning C4005: 'FD_OOB' : macro redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(573) : see previous definition of 'FD_OOB'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(688) : warning C4005: 'FD_ACCEPT' : macro redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(574) : see previous definition of 'FD_ACCEPT'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(691) : warning C4005: 'FD_CONNECT' : macro redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(575) : see previous definition of 'FD_CONNECT'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(694) : warning C4005: 'FD_CLOSE' : macro redefinition
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(576) : see previous definition of 'FD_CLOSE'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1626) : error C2375: 'accept' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(744) : see declaration of 'accept'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1647) : error C2375: 'bind' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(749) : see declaration of 'bind'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1666) : error C2375: 'closesocket' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(754) : see declaration of 'closesocket'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1685) : error C2375: 'connect' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(756) : see declaration of 'connect'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1706) : error C2375: 'ioctlsocket' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(761) : see declaration of 'ioctlsocket'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1727) : error C2375: 'getpeername' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(766) : see declaration of 'getpeername'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1748) : error C2375: 'getsockname' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(771) : see declaration of 'getsockname'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1771) : error C2375: 'getsockopt' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(776) : see declaration of 'getsockopt'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1792) : error C2375: 'htonl' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(783) : see declaration of 'htonl'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1809) : error C2375: 'htons' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(785) : see declaration of 'htons'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1826) : error C2375: 'inet_addr' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(787) : see declaration of 'inet_addr'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1843) : error C2375: 'inet_ntoa' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(789) : see declaration of 'inet_ntoa'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1861) : error C2375: 'listen' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(791) : see declaration of 'listen'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1879) : error C2375: 'ntohl' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(795) : see declaration of 'ntohl'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1896) : error C2375: 'ntohs' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(797) : see declaration of 'ntohs'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1916) : error C2375: 'recv' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(799) : see declaration of 'recv'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1941) : error C2375: 'recvfrom' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(805) : see declaration of 'recvfrom'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1967) : error C2375: 'select' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(813) : see declaration of 'select'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(1991) : error C2375: 'send' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(820) : see declaration of 'send'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2016) : error C2375: 'sendto' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(826) : see declaration of 'sendto'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2042) : error C2375: 'setsockopt' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(834) : see declaration of 'setsockopt'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2064) : error C2375: 'shutdown' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(841) : see declaration of 'shutdown'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2084) : error C2375: 'socket' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(845) : see declaration of 'socket'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2107) : error C2375: 'gethostbyaddr' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(852) : see declaration of 'gethostbyaddr'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2126) : error C2375: 'gethostbyname' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(857) : see declaration of 'gethostbyname'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2144) : error C2375: 'gethostname' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(859) : see declaration of 'gethostname'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2163) : error C2375: 'getservbyport' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(863) : see declaration of 'getservbyport'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2182) : error C2375: 'getservbyname' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(867) : see declaration of 'getservbyname'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2200) : error C2375: 'getprotobynumber' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(871) : see declaration of 'getprotobynumber'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2217) : error C2375: 'getprotobyname' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(873) : see declaration of 'getprotobyname'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2237) : error C2375: 'WSAStartup' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(877) : see declaration of 'WSAStartup'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2255) : error C2375: 'WSACleanup' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(881) : see declaration of 'WSACleanup'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2272) : error C2375: 'WSASetLastError' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(883) : see declaration of 'WSASetLastError'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2289) : error C2375: 'WSAGetLastError' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(885) : see declaration of 'WSAGetLastError'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2306) : error C2375: 'WSAIsBlocking' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(887) : see declaration of 'WSAIsBlocking'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2323) : error C2375: 'WSAUnhookBlockingHook' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(889) : see declaration of 'WSAUnhookBlockingHook'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2340) : error C2375: 'WSASetBlockingHook' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(891) : see declaration of 'WSASetBlockingHook'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2357) : error C2375: 'WSACancelBlockingCall' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(893) : see declaration of 'WSACancelBlockingCall'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2379) : error C2375: 'WSAAsyncGetServByName' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(895) : see declaration of 'WSAAsyncGetServByName'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2406) : error C2375: 'WSAAsyncGetServByPort' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(903) : see declaration of 'WSAAsyncGetServByPort'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2432) : error C2375: 'WSAAsyncGetProtoByName' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(911) : see declaration of 'WSAAsyncGetProtoByName'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2457) : error C2375: 'WSAAsyncGetProtoByNumber' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(918) : see declaration of 'WSAAsyncGetProtoByNumber'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2482) : error C2375: 'WSAAsyncGetHostByName' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(925) : see declaration of 'WSAAsyncGetHostByName'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2509) : error C2375: 'WSAAsyncGetHostByAddr' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(932) : see declaration of 'WSAAsyncGetHostByAddr'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2532) : error C2375: 'WSACancelAsyncRequest' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(941) : see declaration of 'WSACancelAsyncRequest'
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock2.h(2552) : error C2375: 'WSAAsyncSelect' : redefinition; different linkage
C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winsock.h(943) : see declaration of 'WSAAsyncSelect'
c:\documents and settings\ashu\desktop\project4a\project4a\Sockets.h(126) : error C2079: 'SocketListener::tcpAddr' uses undefined struct 'sockaddr_in'
Build log was saved at "file://c:\Documents and Settings\ashu\Desktop\Project4a\Project4a\Debug\BuildLog.htm"
Project4a - 58 error(s), 11 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
|
|
|
|
|
I do not know the answer, but please do no post every error message. Once they start to repeat them selves it becomes redundant and you are wasting sever storage space. You need to figure out why the first error says the type is a redefinition and go from there. If you solve that problem the rest of them will probably go away.
INTP
“Testing can show the presence of errors, but not their absence.”
Edsger Dijkstra
|
|
|
|
|
Redefinition usually means you have included a header file more than once.
Elaine
The tigress is here
|
|
|
|
|
There is an important nuance to note: I think Elaine's answer is correct for the first errors, where redefinition is the problem, but some other errors point out that the multiple definitions have different linkage. This would mean that the multiple inclusions could have some of the conditions change. For example, if this was in a header file:
#ifdef USE_C
extern C {
#endif
typedef struct {
int x;
int y;
int z;
} Vector;
#ifdef USE_C
}
#endif
Then if one inclusion defines USE_C and the other doesn't then you may get the diferent linkage error, because one will declare the structure as C and the other as C++.
Rilhas
|
|
|
|
|
Looks like it's becase your including both "winsock2.h" and "winsock2.h". It looks you're meant to pick one or the other - I'd choose "winsock2.h".
Steve
|
|
|
|
|
I use the class CTreeCtrl Created a Tree Control.
With the member function SetImageList() I can set images to the tree contrl.
Now,I want to change the image in a paticular TREEITEM,and there is no such function.
How can do that?
Thanks
Bruspark
|
|
|
|
|
|
Friends,
I've a property sheet with two property pages. What i want is that, whenever the user tries to swich to the second page, the data in the controls of current page should be validated and if the data is wrong, user should remain in the current page and not switch to the other page. How can i do so ?
Imtiaz
|
|
|
|
|
|
can anyone tell me how do I remove a substring from a string, like i have "abc.xml" and i want to remove ".xml" from it and in turn just get abc. How do i do it?
|
|
|
|
|
Type something like this. Again I haven't tested this.
---------------------------------------
string::size_type LastDotPos = YourString.find_last_of('.');
if ( LastDotPos != -1 )
{
string BeforeDot = YourString.substr(0, LastDotPos);
}
Steve
|
|
|
|
|
can anyone tell me how to check whether a particular substring is present in a given string or not? I have a string containing file name and I have to check whether the file is an xml file or not. So I have to look for ".xml" substring in that given string. How do we do that?
|
|
|
|
|
Try something like this. NOTE: I haven't tested this so your mileage may vary:
----------------
string::size_type LastDotPos = YourString.find_last_of('.');
if ( LastDotPos != -1 )
{
string Extension = YourString.substr(LastDotPos);
transform(Extension.begin(), Extension.end(), Extension.begin(), ::tolower);
if ( Extension == ".xml" )
{
// Ends in ".xml".
}
}
Steve
|
|
|
|
|
Hello,
I currently working on a program. Suprise, suprise. And this program has to wait for a client to connect and then do something with the client. I put the wait for client, etc. stuff into a thread so that my interface is still useable, but since it's a thread my main program continues running. How can I prevent this ? So the Interface of my Main Program should keep useable but it should not continue work till a client connected.
Any Ideas or Suggestions ?
With best regards,
Benedikt
|
|
|
|
|
RedDragon2k wrote: my main program continues running
Wasn't that the whole idea of making another thread? I assume you mean you don't want the user to be able to use the UI? If this is the case just disable the main window or bring up a modal "please wait" dialog that is dismissed when the worker thread is done by sending a WM_CLOSE message to it.
Steve
|
|
|
|
|
Hello,
nice ideas. But I think they won't work, because the my app does are done silent. All in all just want the UI to be drawn correctly. And the possibility to stop the work (so interaction).
Hope this helps,
Benedikt
|
|
|
|
|
Can you use ::WaitForSingleObjectEx(...) function?
|
|
|
|
|
If he uses this API the UI will not redraw properly while the worker is running.
Steve
|
|
|
|
|
That is easy just do not return from the thread util a client has reacted. No wait a client may never react and then you end up with an infinite loop.
There are multiple ways to provide a solution to this problem, the simpilest is to disable all commands that require the client to communicate with you. That is anything that is not be dependent on an outside source, like close application. The main thread should never be disabled, because you always need the option of shuting down the program.
INTP
“Testing can show the presence of errors, but not their absence.”
Edsger Dijkstra
|
|
|
|
|
I have an API with code distributed over several DLL's. I now want to create a single DLL with functions which will be forwarded to the several existing DLL's. Very much on the same line as the Windows Kernel.DLL is implemented. Do I have to write code to generate such thing, or, are there settings in the VCPP IDE to achieve this the Microsoft way.
I am thinking of something like:
_MyFunction=Existing.Dll:?MyFunction@YKKKK@Z
LateNightsInNewry
|
|
|
|
|
You've kinda answered your own question:
"I now want to create a single DLL"
"Do I have to write code to generate such thing"
You have to write the dll.
However, it sounds like you could write a tool to generate the code from a config file with the mappings the way you want (_MyFunction=Existing.Dll:?MyFunction@YKKKK@Z).
...cmk
Save the whales - collect the whole set
|
|
|
|
|
cmk wrote: You've kinda answered your own question:
No, I've Not, you don't understand the question!
The Windows KERNAL.DLL is implemented by sending a Call to each function on to another DLL within the appropriate operating system. Kernal.DLL actually does not contain any excecutable code. There is also no secret about the Binary part of Forwarding. Microsoft has implemented this mechanism for donkies years, it ensures that a 32 bit PE Binary runs equally on systems from Win95 thru Win 2000.
The question is: Is there an existing tool to Achieve this:-
i.e.:
- Do I Achieve this through some obscure settings in the Projects\Settings Dialog? (Use a Microsoft Tool)
- Do I achieve this through some obscure .DEF File Syntax (Use a Less Known Microsoft Tool)
- Is the Only way to achieve this by writing Code which during Run time generates a Binary of a DLL to achieve the result (Develop my Own Tool)
I Will develop my Own Tool if required, but, before embarking, would like to know if there is any need to do so.
LateNightsInNewry
-- modified at 21:11 Saturday 22nd April, 2006
|
|
|
|