hi!
i'm using textract.dll for capturing the font
information for my project. i'm enclosing the
textract.h file which exposes the functions for
capturing the font information.
in my python file i coded as:
from ctypes import *
class txtRact:
def __init__(self):
self.txtrct =
windll.LoadLibrary("C:\\Textract\\textract.dll")
self.src = self.txtrct.TextractSource()
the last line is giving the following error:
"
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File
"C:\Python23\lib\site-packages\ctypes\__init__.py",
line 250, in __getattr__
func = self._StdcallFuncPtr(name, self)
AttributeError: function 'TextractSource' not found
"
now how can i create an object for that class so tht i
can access the methods in tht class?
can anyone help..
=====
thanks and regards,
Karthik.
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/// Textract Screen Text Capture Library. Textract.DLL C++ API
// Textract.H
// Copyright 1996-2002 by Structu Rise, [EMAIL PROTECTED]
// Written Mar'99 by Pavel Senatorov, [EMAIL PROTECTED]
#ifndef TextractH
#define TextractH
#ifndef assert
#include <assert.h>
#endif
#ifndef cdef
#define cdef extern "C"
#endif
#define TextractExport cdef __declspec(dllexport)
TextractExport const char *TextractIniFileName();
TextractExport const char *TextractBaseFileName();
TextractExport const char *TextractBitmapFileName();
TextractExport const char *TextractFakeResFileName();
typedef long TextractSuccess;
// success returning code for Textract functions
enum { // value definitions for TextractSuccess
tsOK = 0,
tsReject = -1000,
tsBadArgs,
tsBadBitmap,
tsOutOfWindow,
tsIniNotFound,
tsBaseNotFound,
tsBitmapNotFound,
tsFakeResNotFound,
tsInitFailed,
tsTermFailed,
tsFormat,
tsNoAccess,
tsDouble,
tsTooMany,
tsCrash,
};
TextractExport TextractSuccess TextractInit();
TextractExport TextractSuccess TextractTerm();
TextractExport TextractSuccess TextractBuild();
TextractExport TextractSuccess TextractBuildWithDialog();
class TextractSource {
public:
TextractSource();
TextractSource& BmpFile(const char *bmpFileName);
TextractSource& Wnd(HWND);
TextractSource& Rect(int ax, int ay, int bx, int by);
TextractSource& DesktopWnd();
TextractSource& TopWnd(const char *windowClass, const char *windowText);
TextractSource& DeepWnd(const char *windowClass, const char *windowText);
TextractSource& SubWnd(const char *windowClass, const char *windowText);
TextractSource& SubDeepWnd(const char *windowClass, const char *windowText);
TextractSource& FindLargestWindow();
const char *BmpFileName; // used if != NULL
HWND W; // used if != NULL
int AX, AY, BX, BY; // used if BmpFileName == NULL and Wnd == NULL
};
class TextractDest {
public:
TextractDest(const char *destFileName);
TextractDest();
~TextractDest();
const char *FileName; // NULL if area specifeid, else dest file name
void *Area; // NULL if file name specified, else memory area
int AreaSize;
};
TextractExport TextractSuccess TextractDestFree(TextractDest&);
enum TextractDestFormat {
dfText,
dfRtf,
dfVerbose,
dfBinary,
dfBmp,
dfBol = 0x0100,
dfEol = 0x0200,
dfSpace = 0x0400,
dfChar = 0x0800,
dfFont = 0x1000,
dfCharHex = 0x2000,
dfCharFont = 0x4000,
dfCharColor = 0x8000
};
enum TextractItemType {
itChar, // ordinary character
itSpace, // character gap, defined as space
itLineStart, // start of the new line
itLineTerm, // end of the currect line
itFont // change to another font face/name/style
};
class TextractItem {
public:
TextractItemType Type :8;
short OffsetX, OffsetY; // relative to upper left corner of the image
unsigned short FontIndex; // internal Textract font index, suitable for font compare
const char *FontName;
char Ch;
unsigned long Color; // RGB color, coded as COLORREF
unsigned char Pitch; // font picth size
short Spacing;
int IsExactSpacing : 8;
};
TextractExport TextractSuccess Textract(TextractSource&, TextractDest&,
TextractDestFormat);
TextractExport void TextractSourceLargestWnd(TextractSource*);
TextractExport void TextractSourceDeepWnd(TextractSource*, HWND,
const char *windowClass, const char *windowText);
TextractExport void TextractSourceDesktopWnd(TextractSource*);
TextractExport void TextractSourceTopWnd(TextractSource*,
const char *windowClass, const char *windowText);
TextractExport void TextractSourceSubWnd(TextractSource*, HWND,
const char *windowClass, const char *windowText);
// ---- inline implementations
inline TextractSource::TextractSource(){
BmpFileName = NULL;
W = NULL;
AX = 0;
AY = 0;
BX = 0;
BY = 0;
}
inline TextractSource& TextractSource::BmpFile(const char *bmpFileName){
assert(BmpFileName == NULL && W == NULL);
BmpFileName = bmpFileName;
return *this;
}
inline TextractSource& TextractSource::Rect(int ax, int ay, int bx, int by){
assert(BmpFileName == NULL && W == NULL);
AX = ax;
AY = ay;
BX = bx;
BY = by;
return *this;
}
inline TextractSource& TextractSource::Wnd(HWND wnd){
assert(BmpFileName == NULL && W == NULL);
W = wnd;
return *this;
}
inline TextractSource& TextractSource::DesktopWnd(){
assert(BmpFileName == NULL && W == NULL);
TextractSourceDesktopWnd(this);
return *this;
}
inline TextractSource& TextractSource::TopWnd(const char *windowClass,
const char *windowText){
assert(BmpFileName == NULL && W == NULL);
TextractSourceTopWnd(this, windowClass, windowText);
return *this;
}
inline TextractSource& TextractSource::DeepWnd(const char *windowClass,
const char *windowText){
assert(BmpFileName == NULL && W == NULL);
TextractSourceDeepWnd(this, GetDesktopWindow(), windowClass, windowText);
return *this;
}
inline TextractSource& TextractSource::SubDeepWnd(const char *windowClass,
const char *windowText){
assert(BmpFileName == NULL && W != NULL);
TextractSourceDeepWnd(this, W, windowClass, windowText);
return *this;
}
inline TextractSource& TextractSource::SubWnd(const char *windowClass,
const char *windowText){
assert(BmpFileName == NULL && W != NULL);
TextractSourceSubWnd(this, W, windowClass, windowText);
return *this;
}
inline TextractSource& TextractSource::FindLargestWindow(){
assert(BmpFileName == NULL && W == NULL);
TextractSourceLargestWnd(this);
return *this;
}
inline TextractDest::TextractDest(const char *destFileName){
FileName = destFileName;
Area = 0;
}
inline TextractDest::TextractDest(){
FileName = 0;
Area = 0;
}
inline TextractDest::~TextractDest(){
TextractDestFree(*this);
}
#endif
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/