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, Sean - Tracker, Chris - Tracker Supp, Tracker Supp-Stefan

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

SXC_OpenSource

Post by jeffp » Tue Oct 23, 2012 8:59 pm

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

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

Re: SXC_OpenSource

Post by Ivan - Tracker Software » Tue Oct 23, 2012 10:23 pm

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: 857
Joined: Wed Sep 30, 2009 6:53 pm

Re: SXC_OpenSource

Post by jeffp » Tue Oct 23, 2012 10:30 pm

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: 4965
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: SXC_OpenSource

Post by Paul - Tracker Supp » Tue Oct 23, 2012 10:54 pm

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
_________________
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com

jeffp
User
Posts: 857
Joined: Wed Sep 30, 2009 6:53 pm

Re: SXC_OpenSource

Post by jeffp » Tue Oct 23, 2012 11:09 pm

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: 4965
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: SXC_OpenSource

Post by Paul - Tracker Supp » Wed Oct 24, 2012 10:52 pm

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

hth
_________________
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com

jeffp
User
Posts: 857
Joined: Wed Sep 30, 2009 6:53 pm

Re: SXC_OpenSource

Post by jeffp » Thu Oct 25, 2012 1:15 am

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.

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

Re: SXC_OpenSource

Post by Ivan - Tracker Software » Thu Oct 25, 2012 6:27 pm

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: 857
Joined: Wed Sep 30, 2009 6:53 pm

Re: SXC_OpenSource

Post by jeffp » Thu Oct 25, 2012 9:45 pm

Do I need to use a GlobalLock on it before I do anything with it. Then GlobalUnlock it after?

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

Re: SXC_OpenSource

Post by Ivan - Tracker Software » Fri Oct 26, 2012 4:12 pm

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