SXC_OpenSource

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
jeffp
User
Posts: 914
Joined: Wed Sep 30, 2009 6:53 pm

SXC_OpenSource

Post by jeffp »

The call to SXC_OpenSource is failing in my Delphi application.

I opened your Delph demo called ..DelphiExamples\ScannerDemo and tried it out. Same thing. SXC_OpenSource throws the following error.

Unknown Error (code: -2113329382)

--Jeff
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: SXC_OpenSource

Post by Ivan - Tracker Software »

Have you called SXC_InitTwain or SXC_InitTwainEx functions?
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
jeffp
User
Posts: 914
Joined: Wed Sep 30, 2009 6:53 pm

Re: SXC_OpenSource

Post by jeffp »

Yes. I do call SXC_InitTwain.

However, I think I found the issue.

Before I call SXC_OpenSource, I am calling SXC_SelectDefaultSource which seems to open the source so I don't need to call SXC_OpenSource. SXC_OpenSource seems only to fail if the source is already open. May want to check that for sure.

Now I have discoverd a new issue. If I use the call SXC_SetCurrentPageSize, my scan crashes after the first page. If I don't call SXC_SetCurrentPageSize, the scan works fine.

I believe SXC_SetCurrentPageSize is a newer procedure since it's not in the help file. Have there been issues with SXC_SetCurrentPageSize? Or do I need to call something else first?

Also, just tried something similar by calling SXC_SetImageLayout(FTwain, @AFrame); and it made the scan process crash as well.


--Jeff
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6829
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: SXC_OpenSource

Post by Paul - Tracker Supp »

Hi Jeff,

Ivan asked me to raise a ticket for this: RT#1664: SXC_OpenSource

I'm not sure if he's seen your response yet but it will all be in the ticket if on this thread so feel ffree to add detail here if needed.

hth
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
jeffp
User
Posts: 914
Joined: Wed Sep 30, 2009 6:53 pm

Re: SXC_OpenSource

Post by jeffp »

I've been digging a little deeper and have found the the crashing is happening when I handle the results from

procedure GetData(userData: LongWord; pData: pointer; DataSize: LongWord); stdcall;

Inside my event that handles this, I am freeing the pData.

What do you do with pData after it returns. Do you free it on your end?
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6829
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: SXC_OpenSource

Post by Paul - Tracker Supp »

I've bumped the ticket. Ivan says he'll be able to get to it soon.

hth
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
jeffp
User
Posts: 914
Joined: Wed Sep 30, 2009 6:53 pm

Re: SXC_OpenSource

Post by jeffp »

Ok. But I'd just like a confirmation that you are freeing the pData in the GetData event. If I free it, it seems to cause issues.
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: SXC_OpenSource

Post by Ivan - Tracker Software »

Yes, you don't have to free the pData. We allocate and free the memory inside the library.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
jeffp
User
Posts: 914
Joined: Wed Sep 30, 2009 6:53 pm

Re: SXC_OpenSource

Post by jeffp »

Do I need to use a GlobalLock on it before I do anything with it. Then GlobalUnlock it after?
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: SXC_OpenSource

Post by Ivan - Tracker Software »

No, you have to do nothing extra in your callback with this pointer. If you need to store this date for later (outside of this function) usage, you have to allocate your own buffer and copy the data into it.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Post Reply