[Help] python ctypes to process C pointer!

2011-10-30 Thread Korobase
A c code snippet,the c file compiled to a dll file named libxxx.dll:

typedef void* HND;
typedef unsigned char UCHAR;
typedef short int  SWORD;
...
int Connect(
   HND* hnd,
   UCHAR* ipaddr,
   SWORD port){
..
return 1;
}

then How to handle function Connect using python and ctypes. especially the
parameter hnd?

My python code:

from ctypes import *
xxx = cdll.libxxx
xxx.Connect.restype=c_int
xxx.Connect.argstype=[c_wchar_p,c_wchar_p,c_int]

hnd=c_char_p()

buf=create_string_buffer("127.0.0.1\0")
ipaddr=cast(buf,POINTER(c_char))

xxx.Connect(byref(hnd),ipaddr,8000)

But I always result a error:
WindowsError: exception: access violation writing 0x

How to fix this problem?

Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Help] The pywinauto Can't select the MDI's menu using the MenuItems() which return [].

2009-01-09 Thread Korobase
2008/12/22 Simon Brunning 

> 2008/12/21  :
> > The code below opens the Choose Font dialog on my Spanish Windows
> version:
> >
> > py> from pywinauto.application import Application
> > py> app = Application.start("Notepad.exe")
>
> Notepad's menus are build with MFC. Word's menus are not. Trust me,
> give it up. For automating Word, COM (with Mark Hammond's excellent
> Python/COM bridge) is the only way to go.


Yeah.
But the GuiLib program also don't work.
You can dowload sample from http://www.beyondata.com/
and use the pywinauto to test it.
I want to know how to do the GuiLib's automation.


>
>
> --
> Cheers,
> Simon B.
> si...@brunningonline.net
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
"OpenBookProject"-开放图书计划邮件列表
详情: http://groups.google.com/group/OpenBookProject
维基: http://wiki.woodpecker.org.cn/
--
http://mail.python.org/mailman/listinfo/python-list