SXC_OpenSource
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
SXC_OpenSource
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
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: 3549
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
- Contact:
Re: SXC_OpenSource
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.
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.
Re: SXC_OpenSource
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
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
- Paul - Tracker Supp
- Site Admin
- Posts: 6829
- Joined: Wed Mar 25, 2009 10:37 pm
- Location: Chemainus, Canada
- Contact:
Re: SXC_OpenSource
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
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
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Re: SXC_OpenSource
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?
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?
- Paul - Tracker Supp
- Site Admin
- Posts: 6829
- Joined: Wed Mar 25, 2009 10:37 pm
- Location: Chemainus, Canada
- Contact:
Re: SXC_OpenSource
I've bumped the ticket. Ivan says he'll be able to get to it soon.
hth
hth
Best regards
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Re: SXC_OpenSource
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: 3549
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
- Contact:
Re: SXC_OpenSource
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.
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.
Re: SXC_OpenSource
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: 3549
- Joined: Thu Jul 08, 2004 10:36 pm
- Location: Vancouver Island - Canada
- Contact:
Re: SXC_OpenSource
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.
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.