Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
1
Erster Beitrag:
vor 4 Jahren, 9 Monaten
Beteiligte Autoren:
Jeff Graham

Request for DotNetDelegate help

Startbeitrag von Jeff Graham am 05.10.2013 16:29

Greetings C# Developers,

Pardon the double post but the post on Leo's really should have been a new post.

I am having a similar problem with DotNetDelegate. I can't create a delegate that is accepted by the .NET assembly. I have a C# example that works. I can access many of the initialization functions in the .NET assembly except for setting the callbacks. See below. I show only the "Streaming" callback for example purposes.

If anyone can help, I would gladly pay for help as long as I can afford it!

Thanks,
Jeff

My WD code and procedure:

// Test button code
nResult is int

nResult = gclPalm.DNET_BioAPI_SetGUICallbacks(gnHandle, ...
DotNetDelegate(StreamingCallback, "DNET_BIOAPI_GUI_STREAMING_CALLBACK"),WIN_Pvs_Net, ...
DotNetDelegate(StateCallback, "DNET_BIOAPI_GUI_STATE_CALLBACK"),WIN_Pvs_Net)
IF nResult = PalmSecureConstant::DNET_BioAPI_OK
IF gbVerbose THEN Info("Set_GUI_Callbacks OK #1")
ReturnToCapture()
ELSE
ShowError(nResult,"DNET_BioAPI_SetGUICallbacks #1")
END

// Local procedure
PROCEDURE StreamingCallback(pclGuiStreamingCallbackCtx is object dynamic, pclBitmap is DNET_BioAPI_GUI_BITMAP)
IMG_Palm = pclBitmap.Bitmap.Data
iResult is unsigned int = 0
RESULT iResult


C# Example code:

//Set delegate methods
///////////////////////////////////////////////////////////////////////////
try
{
stResult.result = m_PalmSecureIf.DNET_BioAPI_SetGUICallbacks(
m_ModuleHandle,
StreamingCallback,
this,
StateCallback,
this
);
if (stResult.result != PalmSecureConstant.DNET_BioAPI_OK)
{
m_PalmSecureIf.DNET_PvAPI_GetErrorInfo(stResult.errInfo);
Ps_Sample_Apl_CS_ErrorMessage(stResult.errInfo);
return false;
}
}
catch (PalmSecureException e)
{
MessageBox.Show(
e.Message
+ "Error No: " + e.ErrNumber
);
return false;
}
///////////////////////////////////////////////////////////////////////////


///
/// Process when streaming callback function is called.
/// This callback only show bitmap image.
///
/// Context set by BioAPI_SetGUICallback()
/// Silhouette image
///
uint StreamingCallback(
object GuiStreamingCallbackCtx,
DNET_BioAPI_GUI_BITMAP Bitmap
)
{
//Handle a guidance image
///////////////////////////////////////////////////////////////////////////
MemoryStream silhouetteInfo = null;

silhouetteInfo = new MemoryStream();
silhouetteInfo.Write(
Bitmap.Bitmap.Data,
0,
(int)Bitmap.Bitmap.Length
);

Ps_Sample_Apl_CS_ShowSilhouette(silhouetteInfo);

silhouetteInfo.Dispose();
///////////////////////////////////////////////////////////////////////////

return PalmSecureConstant.DNET_BioAPI_OK;
}

Antworten:

Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.