|
-
September 4th, 2005, 09:16 PM
#1
A HWND without a Window
I'd like to create a HWND to process messages (to give to Winsock applications). I'd like to use as little memory as possible.
-
September 4th, 2005, 09:23 PM
#2
Re: A HWND without a Window
http://www.codeproject.com/internet/winsockintro03.asp
Does that article help you at all? What you're asking about is having a message pump, but without a window. You can't really have a HWND without a window, but you can create a window that simply never appears. However, before you go through all that trouble, why not see if that article helps If not, post a reply and we'll see what we can do.
-
September 4th, 2005, 09:29 PM
#3
Re: A HWND without a Window
I know Winsock, and that's a nice article, I could still learn stuff from it (like command line arguments). I've built a few client/server programs before, but this is how my newest app will work.
The program loads a DLL. The DLL does all the work, including intercepting the Winsock Messages it wants.
It would be kinda messy if the user had to code the messages in their own WinProc, plus then it would be limited to Windows and GUI apps.
-
September 5th, 2005, 12:59 AM
#4
Re: A HWND without a Window
Did I understand you well, that you are the author of that Dll?
Then may ::GetActiveWindow() help you. It retrieves the HWND of the thread's active window.
-
September 5th, 2005, 02:17 AM
#5
Re: A HWND without a Window
As my understanding u have a dll which deals with socket sending and receiving and u want to pass a HWND to ur dll to get intercept when any message is received or want to send a message.
Why u did not use function pointers, set your OnReceive function pointer in ur dll and get your dll's OnSend function pointer in ur code. and its not limited to GUI or HWND.
A Person who is polite is given goodness and a person who is away from Politeness is away from Goodness.
NAUMAAN
-
September 5th, 2005, 03:57 AM
#6
Re: A HWND without a Window
I don't know if I understood you:
Do you want the HWND to process the winsock notifications from WSAAsyncSelect() ?
If you don't have a window you can also use event objects with WSAEventSelect() and create a thread which waits for the events.
Please don't forget to rate users who helped you!
-
September 5th, 2005, 08:14 AM
#7
Re: A HWND without a Window
I want to create a HWND inside the DLL for use with the DLL.
I don't want the person using the DLL have anything to do with passing a HWND, because I might port this to Linux, or it may be a Win32 console app.
For that reason, I need to create my OWN HWND.
-
September 5th, 2005, 08:20 AM
#8
Re: A HWND without a Window
Do you need an HWND or are you just looking for asynch (non-blocking) sockets so you can do other things while waiting for a receive? If so, you can do that with winsock. Do a search for: select winsock asynchronous
the select function will probably get you what you want without requiring a window. In fact, if you do some research and see that it will get you what you want (without requiring a HWND) I'll attach a TFTP (trivial file transfer protocol) server/client I had to do back in college. It's pretty, well, trivial, so it might help you see how it's done
-
September 5th, 2005, 08:22 AM
#9
Re: A HWND without a Window
I know about ASYNC Winsock, as I've used it in a couple apps now.
I also will probably use a timer, and maybe other things I might need one for.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|