A window handle, that will act as the Source's parent, means Me.Handle or this.Handle.

In most applications, you can use nothing, but on Citrix and WTS this must be a top-level window or a child of a top-level window.






In This Topic

TwainOpenDefaultSource(IntPtr) Method

In This Topic
Opens the default source (the TWAIN device) previously selected in the Source Manager's Select Source dialog box for further usage. Be aware, that if some source is already opened, this method does nothing and returns true.

Please note that you need to call this method for each scanning process in order to ensure your TWAIN session is executed correctly. You can also run this method if you need to set the TWAIN state to TwainStatus.TWAIN_SOURCE_OPEN (State 4) from previous states, which can only be TwainStatus.TWAIN_SM_OPEN (State 3), TwainStatus.TWAIN_SM_LOADED (State 2) or TwainStatus.TWAIN_PRESESSION (State 1). For more details on TWAIN states, please refer to the TWAIN Specification.

Syntax
'Declaration
 
Public Overloads Function TwainOpenDefaultSource( _
   ByVal HANDLE As IntPtr _
) As Boolean
public bool TwainOpenDefaultSource( 
   IntPtr HANDLE
)
public function TwainOpenDefaultSource( 
    HANDLE: IntPtr
): Boolean; 
public function TwainOpenDefaultSource( 
   HANDLE : IntPtr
) : boolean;
public: bool TwainOpenDefaultSource( 
   IntPtr HANDLE
) 
public:
bool TwainOpenDefaultSource( 
   IntPtr HANDLE
) 

Parameters

HANDLE
A window handle, that will act as the Source's parent, means Me.Handle or this.Handle.

In most applications, you can use nothing, but on Citrix and WTS this must be a top-level window or a child of a top-level window.

Return Value

true if the method has been followed successfully, otherwise false. It is recommend to use the TwainGetLastResultCode and the TwainGetLastConditionCode methods to identify the specific reason for the method's failure, if any.
Remarks
Just to inform you, that the current TWAIN state is TwainStatus.TWAIN_SOURCE_OPEN (State 4) after successfully following this method. Use the TwainGetState method to find out the current TWAIN state within the on-going session.

This method requires the Document Capture (TWAIN / WIA) component to run.

See Also