|
|
Programm3r wrote: I would like to know which function I can use to count the number of threads associated with a specific thread. i.e. How many threads does a specific process have?
Along with the reply that you already got see this link[^] too.
|
|
|
|
|
|
Hello.
I'm new in Socket Programming and I found that the sample program in this page is easy to understand.
Attached sample project is working fine in Microsoft Visual C++ Express Edition.
But I had a problem when trying to make an exact copy of the program,
by creating new empty project and add the sources ( attached "sock.h", "sock.cpp", and "main.cpp" ) to the project.
When I trying to build the project, there's some errors as below.
1>Compiling...
1>main.cpp
1>sock.cpp
1>Generating Code...
1>Linking...
1>sock.obj : error LNK2019: unresolved external symbol _WSAStartup@8 referenced in function "public: static void __cdecl openutils::CWinSock::Initialize(void)" (?Initialize@CWinSock@openutils@@SAXXZ)
1>sock.obj : error LNK2019: unresolved external symbol _WSACleanup@0 referenced in function "public: static void __cdecl openutils::CWinSock::Finalize(void)" (?Finalize@CWinSock@openutils@@SAXXZ)
1>sock.obj : error LNK2019: unresolved external symbol _closesocket@4 referenced in function "public: void __thiscall openutils::CServerSocket::Close(void)" (?Close@CServerSocket@openutils@@QAEXXZ)
1>sock.obj : error LNK2019: unresolved external symbol _htons@4 referenced in function "private: void __thiscall openutils::CServerSocket::Init(void)" (?Init@CServerSocket@openutils@@AAEXXZ)
1>sock.obj : error LNK2019: unresolved external symbol _inet_ntoa@4 referenced in function "public: char const * __thiscall openutils::CSocketAddress::GetIP(void)" (?GetIP@CSocketAddress@openutils@@QAEPBDXZ)
1>sock.obj : error LNK2019: unresolved external symbol _gethostbyname@4 referenced in function "public: char const * __thiscall openutils::CSocketAddress::GetName(void)" (?GetName@CSocketAddress@openutils@@QAEPBDXZ)
1>sock.obj : error LNK2019: unresolved external symbol _connect@12 referenced in function "public: void __thiscall openutils::CSocket::Connect(char const *,int)" (?Connect@CSocket@openutils@@QAEXPBDH@Z)
1>sock.obj : error LNK2019: unresolved external symbol _socket@12 referenced in function "public: void __thiscall openutils::CSocket::Connect(char const *,int)" (?Connect@CSocket@openutils@@QAEXPBDH@Z)
1>sock.obj : error LNK2019: unresolved external symbol _WSAGetLastError@0 referenced in function "public: void __thiscall openutils::CSocket::Connect(char const *,int)" (?Connect@CSocket@openutils@@QAEXPBDH@Z)
1>sock.obj : error LNK2019: unresolved external symbol _send@16 referenced in function "public: int __thiscall openutils::CSocket::Send(char const *)" (?Send@CSocket@openutils@@QAEHPBD@Z)
1>sock.obj : error LNK2019: unresolved external symbol _recv@16 referenced in function "public: int __thiscall openutils::CSocket::Read(char *,int)" (?Read@CSocket@openutils@@QAEHPADH@Z)
1>sock.obj : error LNK2019: unresolved external symbol _accept@12 referenced in function "public: class openutils::CSocket * __thiscall openutils::CServerSocket::Accept(void)" (?Accept@CServerSocket@openutils@@QAEPAVCSocket@2@XZ)
1>sock.obj : error LNK2019: unresolved external symbol _listen@8 referenced in function "public: class openutils::CSocket * __thiscall openutils::CServerSocket::Accept(void)" (?Accept@CServerSocket@openutils@@QAEPAVCSocket@2@XZ)
1>sock.obj : error LNK2019: unresolved external symbol _bind@12 referenced in function "public: class openutils::CSocket * __thiscall openutils::CServerSocket::Accept(void)" (?Accept@CServerSocket@openutils@@QAEPAVCSocket@2@XZ)
I suppose that the errors came from different "Project Properties".
Anybody could help me?
I using Microsoft Visual C++ Express Edition 2005 with Microsoft Platform SDK for Windows Server 2003 R2 installed.
|
|
|
|
|
You need to link to the winsock library: go into the project properties -> 'Linker' -> 'Input' and in 'Additional dependencies' you need to add 'ws2_32.lib'.
|
|
|
|
|
maglev_tgv wrote: I suppose that the errors came from different "Project Properties".
Your guess it is right.
You have to add Ws2_32.lib to the LINKER library list.
On my system (VS 2003) this can be done by selecting 'Project->Properties" menu and then (on the newly shown window), after selecting the 'Linker->Command Line', add Ws2_32.lib to the 'Additional Options' TextBox.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
It Works!!
Thank you very much( for both Cedric Moonen and Pallini ).
You just made my day.
I also added "odbc32.lib", "odbccp32.lib", "wsock32.lib" to Additional Dependencies,
and it works. But it was derived from yours, so thanks.
There were no error anymore when building,
but when I debug it, there was a dialog bog:
image
I chose OK and there were no problem ( and the server worked fine ).
Just curious. Any suggestions?
|
|
|
|
|
You started to debug your program (you pressed F5 probably) but your program was build in release mode probably. That means that it doesn't contain any debugging information and you won't be able to use the debugger.
|
|
|
|
|
What is release mode? how to set it so i get no more warnings?
-- modified at 23:29 Monday 30th July, 2007
----------
C++ Learner
|
|
|
|
|
swscanf_s(strVial, _T("%d%*s"), &vialNumber)
How many characters does %*s takes in the above line of code
|
|
|
|
|
that should be "%s" as in _T("%d%s")
%s takes in a string, so you're missing an argument.
Yours Truly, The One and Only!
|
|
|
|
|
I think your reply is incorrect. See here[^].
An asterisk (*) following the percent sign suppresses assignment of the next input field, which is interpreted as a field of the specified type. The field is scanned but not stored.
|
|
|
|
|
humm thanks for pointing that out
I've never used that options, that is to be able to skip the next scanned data.
Yours Truly, The One and Only!
|
|
|
|
|
That should read in the numeric field (however many characters it is, within reason), and then skips forward the next non-whitespace set of characters and stops.
So if the data being scanned is 12345 abcdefg hijkl , your code should scan in the 12345 into vialNumber , and then skip past the abcdefg and stop. I believe...
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> 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! See DeleteFXPFiles
|
|
|
|
|
I've designed an ActiveX control,this time,i wanna this control can receive the input from other application.For more detail, I wanna the web page can give parameters to such control,how do i modify my control?use property and event?By the way, how does the web page to use my control's property and event?Thanks a lot.
Later buggers harm more.
|
|
|
|
|
Implement an IDispatch interface on your control to expose any methods and properties you want.
Steve
|
|
|
|
|
I'm using the "MFC ActiveX DLL" wizard to produce my control,has it implement IDispatch interface on default?
Later buggers harm more.
|
|
|
|
|
hi i am having stl model of a diamond which is meshed. i have to write a code to display the dimensions of its elemnts. im new to this stl files. is there any materials or links that guide me. pls help me
|
|
|
|
|
the STL formats are very simple, either ASCII or binary.
have a look at http://www.ennex.com/~fabbers/StL.asp[^] for the format.
as for the dimensions, I'm not certain what you mean by "elements", but if you need the dimension of the diamond, you will need to find the enclosing bound box.
|
|
|
|
|
Hi,
I'm trying to emulate Folder Tree View like one in Windows Explorer and I'm using IShellFolder interface and EnumObjects() function to enumerate shell folders. I'm storing
pointer to ITEMIDLIST for each tree node so that it can be used later for showing context
menus etc.
Now, whenever I browse a removable drive (USB drive) through it, i'm unable to unmount it.
Is this possible because some of the ITEMIDLIST structures aren't freed up? Does that keeps
the drive locked?
|
|
|
|
|
i usually just pull the plug out
Yours Truly, The One and Only!
|
|
|
|
|
The ancient BorlandC++ - that I first made a program - have a set of functions to access low level structure of magnetic media:
biosdisk(), absread(), abswrite()
Are any equivalent in VisualC++6?
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
I've never heard of those, but judging by the description, I highly doubt there are any equivalents in VC++.
Windows Calculator told me I will die at 28.
|
|
|
|
|
I want to phisically format a writable device, such as floppy, usb drive, etc.
If Windows Calc told you that, you must be 30. Oh, by the way:
"If you date a girl that says she's 25 and looks 18, be sure she's 12." (I read this on a subway wall)
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
RomTibi wrote: Are any equivalent in VisualC++6?
Perhaps, but only if you wanted to write a device driver to do the low-level access. I think the HAL would restrict your access to the hardware.
What exactly are you trying to do (there may be a VC++ equivalent)?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|