के साथ इनो सेटअप से कॉल सी # डीएलएल मेरे पास एक चल रही इनो सेटअप स्क्रिप्ट है, जिसमें मैं शेरलॉक सॉफ्टवेयर द्वारा innocallback.dll का उपयोग करता हूं।कॉलबैक
यह डीएलएल मेरी प्रक्रिया को लपेटता है ताकि इसे सी # डीएलएल में पारित किया जा सके।
मैं इस डीएलएल का उपयोग नहीं करना चाहता, मैं सीधे अपने निर्यात किए गए सी # विधि को कॉल करना चाहता हूं और कॉलबैक प्रक्रिया को पास करना चाहता हूं।
मेरा प्रश्न है:
मैं अपने सी # DLL करने के लिए अपने Inno सेटअप प्रक्रिया (@mycallback
) पारित कर सकते हैं ताकि मैं अपने delegate
/UnmanagedFunctionPointer
के रूप में उपयोग कर सकते हैं?
जैसा कि मैंने कहा था कि यह कोड काम करता है, लेकिन मैं जितना संभव हो सके बाहरी डीएलएल के रूप में उपयोग करना चाहता हूं।
यहाँ मेरी कोड है:
Inno सेटअप स्क्रिप्ट
type
TTimerProc=procedure();
TProgressCallback=procedure(progress:Integer);
function WrapProgressProc(callback:TProgressCallback; paramcount:integer):longword;
external '[email protected]:innocallback.dll stdcall';
function Test(callback:longword): String;
external '[email protected]:ExposeTestLibrary.dll stdcall';
var
endProgram : Boolean;
procedure mycallback(progress:Integer);
begin
MsgBox(IntToStr(progress), mbInformation, MB_OK);
if progress > 15 then
begin
endProgram := True;
end
end;
function InitializeSetup:boolean;
var
progCallBack : longword;
callback : longword;
msg : longword;
msg2 : widestring;
begin
endProgram := False;
progCallBack:= WrapProgressProc(@mycallback,1); //Our proc has 1 arguments
Test(progCallBack);
result:=true;
end;
और ये मेरे सी # कोड
public class TestClass
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void ReportProgress(uint progress);
public static ReportProgress m_reportProgess;
static uint m_iProgress;
[DllExport("Test", CallingConvention = CallingConvention.StdCall)]
static int Test(ReportProgress rProg)
{
m_iProgress = 0;
m_reportProgess = rProg;
System.Timers.Timer pTimer = new System.Timers.Timer();
pTimer.Elapsed += aTimer_Elapsed;
pTimer.Interval = 1000;
pTimer.Enabled = true;
GC.KeepAlive(pTimer);
return 0;
}
static void aTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
m_iProgress++;
m_reportProgess(m_iProgress);
}
}
मैं सिर्फ देखा आप Inno सेटअप सोने बिल्ला मिला । बधाई :) – Bongo