D Paste by CM
Description: DFLplugin: Entice Plugin using DFL (see comments below)
Hide line numbers

Create new paste
Post a reply
View replies

Paste:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
// To compile:
// 	dfl -debug dflplugin enticeplugin -ofdflplugin.dll dflplugin.def


import enticeplugin;

import std.string;

import dfl.all;


class DFLplugin: dfl.form.Form
{
	// Do not modify or move this block of variables.
	//~Entice Designer variables begin here.
	dfl.button.Button button1;
	//~Entice Designer variables end here.
	
	
	this()
	{
		initializeMyForm();
		
		//@  Other MyForm initialization code here.
		
		button1.click ~= &button1_click;
		
	}
	
	
	private void button1_click(Object sender, EventArgs ea)
	{
		close();
	}
	
	
	private void initializeMyForm()
	{
		// Do not manually modify this function.
		//~Entice Designer 0.8.5.02 code begins here.
		//~DFL Form
		controlBox = false;
		formBorderStyle = dfl.all.FormBorderStyle.FIXED_TOOLWINDOW;
		opacity = 0.79;
		showInTaskbar = false;
		startPosition = dfl.all.FormStartPosition.CENTER_PARENT;
		text = "DFLplugin";
		clientSize = dfl.all.Size(122, 48);
		//~DFL dfl.button.Button=button1
		button1 = new dfl.button.Button();
		button1.name = "button1";
		button1.text = "OK";
		button1.bounds = dfl.all.Rect(24, 16, 75, 23);
		button1.parent = this;
		//~Entice Designer 0.8.5.02 code ends here.
	}
}


export extern(Windows) void enticePluginLoaded(EnticeFunctions* efuncs)
{
	beginEnticePlugin(efuncs); // This call is required for D and must be first.
	
	Application.setInstance(pluginInstance); // IMPORTANT: needed when using DFL!
	
	(new DFLplugin()).showDialog();
}


// This function cannot use D's garbage collector.
// Only for load parameters.
// Return one of the following:
// 	0 = Successfully load.
// 	1 = Abort load due to problem.
// 	2 = Successfully unload / prevent load.
export extern(Windows) int enticePluginLoad(EnticePluginInfo* epinfo)
{
	epinfo.name ="DFLplugin" ;
	
	if(epinfo.flags & 2)
		epinfo.desc = "Plugin using DFL.";
	
	epinfo.thisMajorVersion = MAJOR_VERSION;
	epinfo.thisMinorVersion = MINOR_VERSION;
	
	return 0; // OK.
}


export extern(Windows) void enticePluginUnloaded(EnticeFunctions* efuncs, int n)
{
	// Plugin unloaded code goes here.
	
	endEnticePlugin(efuncs);
}

Replies:
Reply by CM
Notice the important function call in enticePluginLoaded added to setup DFL for use in a DLL (setInstance). This needs to be called before any use of DFL in the plugin, so is best called right after beginEnticePlugin.

Reply by CM
dflplugin.def specified in the compile command is as follows:

LIBRARY ENTICEPLUGIN
DESCRIPTION 'Entice Plugin DLL'
EXETYPE NT