|
includeh10 wrote: ShellExecute()==ERROR_FILE_NOT_FOUND
for your info ShellExecute returns ERROR_FILE_NOT_FOUND if the specified file is not found.i typecasted into int though i didn't store into the HINSTANCE....
still waiting for the reply....
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
Hi QuickDeveloper,
I run your code(127.0.0) and ping run also a messagebox that ping failed yes?Is your problem?
|
|
|
|
|
WhiteSky wrote: Is your problem
Yes
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
QuickDeveloper,
maybe I mistake but,I think you need to change afxmessage(succes) with afxmessage(fail) because ping is run
ping is run (show Messagebox(successful))and show window ping that is reply from...
Hope I understood your question
|
|
|
|
|
If you just want to check if the IP address itself is a valid IPV4 address, you can use:
unsigned long ip = inet_addr("10.37.8.4");
if (ip == INADDR_NONE)
{
}
else
{
}
inet_addr() is to dotted quads what gethostbyname() is for host names.
Matt Godbolt
Engineer, ProFactor Software
StyleManager project
|
|
|
|
|
Three problems:
One, your comparison is buggy. ! has higher precedence than == so the comparison isn't doing what you want. Rewrite it to use != which is clearer.
Two, your check of the return value is wrong. From the ShellExecute() docs:Returns a value greater than 32 if successful, or an error value that is less than or equal to 32 otherwise. Three (and most significant) ShellExecute() 's return value only tells you if the app was launched. It tells you nothing about what the app did.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
I'll take a slightly different tack from the other responses.
Try checking out the IcmpSendEcho [^] function in the IP Helper library. This performs a 'ping' for you, and you don't have to worry about running a separate program.
Software Zen: delete this;
|
|
|
|
|
Hello.
1.How to modification VSS label or VSS comment in VS.NET 2003?
2.how VSS auto add the keyword on check in?
$Archive: /1.cpp $
$Revision: 5 $
$Date: 12/02/06 10:22 $
$Author: none $
Thanks.
|
|
|
|
|
hi.....
i want to know how to search a file for a keyword. the problem that i am facing is that the file may be of any extension i.e. .doc, .txt, .html, .ppt etc......\
is there any way to do so......as some search engine searches for files..
plz guide me according to MFC...thanx
RabiaAslam
|
|
|
|
|
Hi RabiaAslam,
if you want to searches a directory for a file use FindFirstFile
|
|
|
|
|
Assalamoalaikum
Rabia!
Your question has some ambiquity. Do you want to search a file or search a word in a specific file?
Explain exactly what do you want to do?
Good luck
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
yes u got the right point ... i want to search for a word in s specific file
RabiaAslam
|
|
|
|
|
|
|
|
|
|
For the source code to 5 different kinds of balanced binary trees see http://www.5trees.com. Please enjoy.
5Trees
|
|
|
|
|
what if we want an optimized imbalanced binary tree? (otherwise known as a splay tree) I do normally use AVL trees, but not always.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Jeffry J. Brickley wrote: what if we want an optimized imbalanced binary tree? (otherwise known as a splay tree) I do normally use AVL trees, but not always.
I have looked at splay trees but I have not researched them in depth. Personally I am very fond of the original AVL Algorithms. AVL algorithms are rock solid and may be applied to finite ordered sets, dynamic arrays, maps and tables (see http://www.5trees.com for definitions of these terms). I intend to stick with AVL trees rather than research on Splay Trees or RedBlack Trees - I'll leave that to others. Interestingly, the STL standard for Maps uses RedBlack Trees. 5Trees uses AVL to implement associative arrays.
Cheers,
Ben.
5Trees
|
|
|
|
|
I favor Ternary Search Trees.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
Hi I'm using a CAsyncSocket to create a TCP socket and connect to a server. Everytime I connect, the error code I get is a WSAEWOULDBLOCK, whether the server is there or not. So, the only way I know if I am connected or not is to send a message to the server, and I have to look to see if I have a send error of WSAENOTCONN to determine if my connection was a success or not. Is there any way, to know if I am really connected or not when I try to do a 'connect', instead of the approach that I'm taking right now?
Thank you,
//Code
m_pSock.Create(); //Create the socket
if (!m_pSock.Connect(IP, PORT))
{
DWORD error1 = GetLastError();
if(error1 == WSAEWOULDBLOCK)
{
iSent = m_pSock.Send((void *)messages[0],32);
if(iSent == SOCKET_ERROR)
{
DWORD error2 = GetLastError();
if(error2 == WSAENOTCONN )
{
MessageBox("SOCKET NOT CONNECTED",NULL,NULL);
}
}
}
}
-- modified at 20:30 Friday 7th April, 2006
|
|
|
|
|
The mistake you're making is that you are trying to use asynchronous sockets synchronously.
In synchronous sockets, you tell the socket what to do, step by step.
In asynchronous sockets, the socket tells you that it's ready to do something, and then you tell it to try.
If an asynchronous socket can't do what you tell it to, then it returns SOCKET_ERROR and WSAGetLastError returns WSAEWOULDBLOCK. This signifies that the requested operation cannot be performed without blocking (which you don't want), and that the socket will tell you later, when it's ready, to try again. Then, later (and asynchronously), the socket will send an FD_CONNECT message to your message loop (or something similar, like FD_READ, depending on circumstances), which eventually filters down to your override of the virtual OnConnect function.
So, WSAEWOULDBLOCK is very common and must be programmed for. In your case, you start the whole process by calling Connect. If it succeeds, then great, do the next thing. But it probably will fail with WSAEWOULDBLOCK. In this case, at some later time in the future, your OnConnect function will be called, signifying that the socket is ready for you to try again. Inside OnConnect, try calling Connect again, but again be ready for the (much lowered) possibility that WSAEWOULDBLOCK might be returned again.
You need to do this for each significant event that you are interested in, like OnReceive, OnSend, OnClose etc.
Mike
|
|
|
|
|
I want to display series of numbers from 1 to 50 (that handled by variable i) use CPaintDC.TextOut();
Please help me !
Thanks !
Lgx
-- modified at 19:05 Friday 7th April, 2006
|
|
|
|
|
To display the series on the same line, simply construct the string and use TextOut() to display it, as in:
CString strNumbers;
for (int nNum=1; (nNum <= 50); nNum++) {
CString strNum;
strNum.Format ("%d ", nNum);
strNumbers += strNum;
}
VERIFY (pDC->TextOut (10, 10, strNumbers));
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|