08. august 2005 - 08:57Der er
3 kommentarer og 1 løsning
Callback funktioner hvordan
God mandag morgen :D
Kan man bruge Callback funktioner i Navision Attain ? og i givetfald hvordan ?
Jeg har lavet et COM Object i Delphi der til genkendelse af fingere aftryk. Når man skal "optage" et nyt finger aftryk til senere genkendelse, har jeg laver en callback funktion der giver besked til bruger omkring om han/hun skal flytte fingeren, trykke hårdere etc.
functions typen er defineret således i Delphi : TOnMessage = procedure(const Value: string);
Nå så jeg opretter mit COM object i Navision, hvordan laver jeg en funktion som jeg kan bruge som callback ?
Orv ja .. Hvad er kalde konventionen i Navision ? stdcall eller pascal eller noget helt 3. ?
Kaldekonvention? I COM? Det er da rimeligt slået fast...
Jeg tror ikke at du kan angive CallBack funktioner i Attain. Det vil kræve at Attain er multithreaded og det mener jeg ikke at den er... Det er selvfølgelig min mening - jeg kunne tage fejl :D
broholm>> Jeg ved intet om Attain. Derfor spørger jeg :D Dermed har jeg også på forhånd valgt at stole på svaret.
Kaldekonventionen i COM er stdcall. Den er jeg frisk på, men der var mere hvis nu man kunne lave en callback procedure i attain, så er det ikke helt lige meget, fordi man kan ændre kaldekonventionen på en callback procedure, mn jeg forventer ikke man kan det i Attain.
Hmmm Den kan vist godt alligevel... Jeg ved dog ikke helt endnu hvad der skal til, men jeg fandt denne dokumentation:
******************* Event Triggers The following information is useful when you have enabled C/SIDE to receive events from a component that it controls, for example, an automation server.
There are certain limitations on the triggers that are automatically generated for the events, which the component provides. Furthermore, incoming data is subject to certain restrictions.
Limitations C/SIDE only supports the default outgoing, that is, source interfaces, which are defined by the automation variable. If more than one outgoing interface is defined by the automation server for a coclass, only event triggers for the default outgoing interface are generated in the C/AL code.
There can be a maximum of 39 parameters in function calls.
There can be a maximum of 1024 characters in prototype text strings for functions.
The connectable object strategy in COM is used to connect Navision and the automation server. The Sink object defined in this strategy and implemented in Navision only supports the IDispatch interface (and IUnknown). It is therefore expected that the automation server calls on IDispatch when executing events.
Parameter names will be truncated to a maximum of 30 characters.
There are no return values on event triggers.
The variable name along with "::" and the event trigger name will be truncated to a maximum of 30 characters.
Restrictions on Incoming Data All received data are copied to an internal data type, which can handle any data type that COM allows. No data is lost in this conversion and there is no check for valid AL data types.
The data will remain in this internal data type until it is used inside the trigger. When data is used, it is converted to the appropriate C/AL data type. Note, however, that if the data type is Variant, no conversion occurs. No data is lost in the conversion and all the required checks are made. If the conversion is not possible because there is an invalid data type, or because data is outside the range, the event trigger causes an error message to pop up and terminates execution. Note that if data is never used in the event trigger, no checks for valid data, data type and data range are performed.
If parameter is a VAR parameter (that is, called ByRef) and data is used inside the event trigger, there will be an implicit conversion just before the event trigger returns. A check is made of whether conversion is possible. If this is not the case, an error message is shown and the event trigger terminates.
FEDT !! Der er klart en kold bajer hvis du impelmerer det.
Jeg kan godt stille et dummy Com object til rådighed.
Jens B
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.