View Single Post
Old 04-21-2007, 09:11 AM   #50
zechs
Junior Member
zechs began at the beginning.
 
zechs's Avatar
 
Posts: 8
Karma: 10
Join Date: Apr 2007
Location: Philippines
Device: PRS-500
Getting XylogParser.DLL to Work

Quote:
Originally Posted by esperanc
Has anyone tried to do this? I have tried it in python using the following code (which didnīt work):

Code:
from ctypes import *
xylog = windll.LoadLibrary("XylogParser.dll")

check = xylog.MSXML_InitInstance()

if check:
    success = xylog.XYP_Create()
    print "create=",success
    xylog.XYP_SetTextCompressionFlag(0)
    xylog.XYP_SetPCMCompressionFlag(0)
    xylog.XYP_SetFontEncFlag(0)
    xylog.XYP_SetProducerName(u"test")
    #XYP_SetMsgWnd(wnd);
    #XYP_SetMsgID(WM_USER + 100)
    parse = xylog.XYP_ParseDocument(u"test.lrs")
    print "parse=",parse
    xylog.XYP_Release()
Incidentally, the output is

create= 1
parse= 0
The way I got XYP_ParseDocument to work was:

1) make sure the filename supplied is in unicode format. i.e. if your Filename is "Test.lrs", the contents of filename should be:

(c notation - sorry I am not familiar with Python)
ushort *Filename = {0x0054, 0x0065, 0x0073, 0x0074, 0x002e, 0x006c, 0x0072, 0x0073, 0x000}

2) Change the BookID (especially if you are using the sony supplied LRS files). The first 2 characters has to be: "FB"

Good luck !!!!

zechs
zechs is offline   Reply With Quote