I want to make a telnet console program like the one that comes with win2000 but to use WSAAsyncSelect you need a handle to a window to that receives messages telling it when there is data to read from a socket. is there any way around this?
A windows app might be defined as one you didn't define with a console window, ie, any windows app may also have a console. I use this trick all the time for debugging. There is also nothing keeping you from creating a window inside a console app to receive messages. You'll probably want to keep it invisible, but its message loop and hwnd will still be quite valid. Mind you, I do not know nor care about sockets. There may be another windowless callback method available without the overhead of creating the window.
I thought about sticking in a window in the console application but I'm worried about what extra messages I would have to handle along side it. Would the invisible window get keyboard messages that I want my console to get? I figured there must be a way of creating a procedure that only gets socket messages.
Yes there is a method of using an winsock callback instead of a windows message loop. Mind you I've never done it, but I've read it in the documentaion... take look through your documentation for a winsock callback routine... Good luck! See ya, Ben
The only way the invisible window can get the keyboard messages is if it has focus, and it ain't gettin that while it's invisible. It will do just what you need. However, if as Satrukaan noted, if there is a windowless callback API, that is preferable (less sys resources needed)