[python-win32] WSAAsyncSelect

david.briant at ubs.com david.briant at ubs.com
Wed Jan 5 17:40:15 CET 2011


I'm looking for a little help on using WSAAsyncSelect via ctypes. I
imagine this has been asked before but I couldn't figure out how to
search the archives (and trawling through them randomly didn't really

So basically I want to receive winsock events in a windows message proc
(which I do have working). Just not familiar with how to convert the ms

int WSAAsyncSelect(
  __in  SOCKET s,
  __in  HWND hWnd,
  __in  unsigned int wMsg,
  __in  long lEvent

into a ctypes one. Would it be something like the following?

winsock = ctypes.windll.ws2_32
s = 12345
hWnd = 1234

socketErrorOrZero = winsock.WSAAsyncSelect(s, hWnd, wMsg, lEvent)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20110105/53d44670/attachment.html>
-------------- next part --------------
Visit our website at http://www.ubs.com 

This message contains confidential information and is intended only 
for the individual named. If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail. Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system. 

E-mails are not encrypted and cannot be guaranteed to be secure or 
error-free as information could be intercepted, corrupted, lost, 
destroyed, arrive late or incomplete, or contain viruses. The sender 
therefore does not accept liability for any errors or omissions in the 
contents of this message which arise as a result of e-mail transmission. 
If verification is required please request a hard-copy version. This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities 
or related financial instruments. 

UBS Limited is a company limited by shares incorporated in the United 
Kingdom registered in England and Wales with number 2035362. 
Registered office: 1 Finsbury Avenue, London EC2M 2PP.  UBS Limited 
is authorised and regulated by the Financial Services Authority. 

UBS AG is a public company incorporated with limited liability in 
Switzerland domiciled in the Canton of Basel-City and the Canton of 
Zurich respectively registered at the Commercial Registry offices in 
those Cantons with Identification No: CH- and having 
respective head offices at Aeschenvorstadt 1, 4051 Basel and 
Bahnhofstrasse 45, 8001 Zurich, Switzerland.  Registered in the 
United Kingdom as a foreign company with No: FC021146 and having a 
UK Establishment registered at Companies House, Cardiff, with No:  
BR 004507.  The principal office of UK Establishment: 1 Finsbury Avenue, 
London EC2M 2PP.  In the United Kingdom, UBS AG is authorised and 
regulated by the Financial Services Authority.

UBS reserves the right to retain all messages. Messages are protected 
and accessed only in legally justified cases. 

More information about the python-win32 mailing list