So I have a win32 project with the Windows procedure and everything.
I want the client to be able to connect to a server, but at the same time to be able to process window messages.
So I already figured this part out. I will Asynchronous sockets for the client.
The only question I have is, where do i put the WSADATA, server structure, and socket() declarations?
In the WinMain function? Windows procedure?
In short, how do I integrate a winsock implementation into winapi gui? How do i combine the two? All the tutorials ive found online only deal with either Winsock OR winapi, they never seem to mix the two.
Related
I have one Win32 console application which will be independent EXE and I have front-end designed in MFC.
I want to get the results of the Win32 application to be shown on my GUI. I searched a lot and found some techniques:
Named pipe
DDE
Shared memory
Are any of these an appropriate solution to my problem? Does anyone know of any other solution(s) that might be easier than those I mentioned?
If the output of the console exe is machine parsable, you can use CreateProcess() with pipes for standard input and output which you then parse and display in your UI.
You send also message from one application to another, it's quite simple. Look into WM_COPYDATA
http://msdn.microsoft.com/en-us/library/ms649011%28v=vs.85%29.aspx
I want to call some Windows API functions to manipulate Windows Input Method Editor to make my Emacs an IME-aware application. How can I call Windows API functions using Emacs lisp?
Thank you!
I dont believe its possible to directly call native code from emacs; the best you'll be able to achieve is to proxy calls to the Windows API through another process, and communicate with it through IPC
Check this stackoverflow question:
load a dynamic library from elisp
I think maybe need a proxy interface, but use w32-send-sys-command can do little things,
code 61776 can send hotkey maybe worth a try
on windows, is there any other option when programming network communication then using Winsock? There are many socket libraries for c++, are they all just winsock based?
You can consider using boost::asio. Boost is really great and well designed. Many parts of it have come already into C++0x. You will need to statically link to a lib or dll (it is not a header only template library)
Winsock are the sockets for Windows taken over from BSD (with actually exactly the same API excepting for closesocket vs close and the initialization/termination of the subsystem). Not the Win API itself has a more modern API the WSAxxx functions. C++ is socket unaware until now that means in order to do networking you MUST use the OS API, thus Winsock. There is no other low level API.
If you are trying to monitor traffic why don't you use WinPCAP?
There are other ways to program network communication, which don't use Winsock: for example, using the network file system (shared files), or using named pipes.
Software can also bypass Winsock (which is a Windows user-mode DLL) even for TCP/IP traffic, and instead interface directly with the kernel-mode drivers.
Starting from scratch, would like to create an ftp application using WinInet.
Looking for a real basic example in C++ that will compile and get me started.
Thanks.
There's a bunch of partial samples on DotNetHeaven that could be glued to together without much work.
You could potentially use the MFC CFTPConnection (Which wrap the wininet api) as well, samples here on DotNetHeaven as well.
I'm attempting to port a Linux application to Windows. The application isn't too complex, using all fairly standard code, with few external dependencies. The main dependencies are libelf (which compiles fine under mingw), pthreads (there appears to be a win32 version available), and sockets. The main problem is with sockets...Windows provides WinSock, but this is not 100% compatible with BSD (Berkeley) sockets as used by all *nixes. What I'm wondering is, has anybody written a wrapper on windows that exposes a BSD socket API, but calls Winsock on the backend, to ease porting?
I would recommend using cygwin.dll . It's built for bringing over *nixes to windows including sockets, file IO, etc.
For the most part, you'll just have to make sure that WSAStartup() and WSACleanup() are called at start and end, otherwise, basic BSD sockets will translate pretty well. You could create some static global variable that gets checked for each call to the socket calls, and call WSAStartup() and WSACleanup() accordingly. As for poll() ... well, it translates quite easily to select().