ok, im not the best at this kind of thing, but here goes
In this quick tut you will learn how to make a small simple dialog dll with PureBasic.
ok, frist thing you need to do is open PureBasic and create a new blank project, now goto Menu>>Compiler>>Compiler Options, in the first tab "Compiler Options" find "Executable Format" and set it to shared dll and then click ok.
now add the below code to the PB project
now open a blank ams project, add a button and add the below code to the buttons on click event
now, i usally save the pure basic file source file in the same folder as the ams project, this just keeps the source files togeather, so save the pure basic project and then make the dll file (Menu>>Compiler>>Make Executable) save the dll to the docs folder of the ams project
now preview the project and click the button, you should be looking at your first ams/dll dialog, if not then you did something wrong, read the above again
now we pass some arguments to the dll
edit your pb code to look like this
save and complie the dll
edit your ams code to look like this
now preview and click the button, see the dialog and the text, if not then you did something wrong, read the above again.
now lets get a return from the dll
for this we are going to change the message type to yes/no/cancel dialog so we can get differaqnt return values
edit your purebasic code to look like this
save and complie the dll
add a label to the ams project and edit the code to look like this
now save and preview the ams project, see how all the buttons have differant return values,
there you have it, your first dll
In this quick tut you will learn how to make a small simple dialog dll with PureBasic.
ok, frist thing you need to do is open PureBasic and create a new blank project, now goto Menu>>Compiler>>Compiler Options, in the first tab "Compiler Options" find "Executable Format" and set it to shared dll and then click ok.
now add the below code to the PB project
Code:
ProcedureDLL MyFunctionName() MessageRequester("Hello", "This is a PureBasic DLL !", 0) EndProcedure
now open a blank ams project, add a button and add the below code to the buttons on click event
Code:
result = DLL.CallFunction("AutoPlay\\Docs\\MyDLL.dll", "MyFunctionName", "", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
now, i usally save the pure basic file source file in the same folder as the ams project, this just keeps the source files togeather, so save the pure basic project and then make the dll file (Menu>>Compiler>>Make Executable) save the dll to the docs folder of the ams project
now preview the project and click the button, you should be looking at your first ams/dll dialog, if not then you did something wrong, read the above again
now we pass some arguments to the dll
edit your pb code to look like this
Code:
ProcedureDLL MyFunctionName(strTitle$,strText$) MessageRequester(strTitle$,strText$, 0) EndProcedure
edit your ams code to look like this
Code:
strTitle="Hello" strText="This is a PureBasic dll with arguments passed from AMS" result = DLL.CallFunction("AutoPlay\\Docs\\MyDLL.dll", "MyFunctionName", "\""..strTitle.."\",\""..strText.."\"", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
now lets get a return from the dll
for this we are going to change the message type to yes/no/cancel dialog so we can get differaqnt return values
edit your purebasic code to look like this
Code:
ProcedureDLL MyFunctionName(strTitle$,strText$) Ret=MessageRequester(strTitle$,strText$, #PB_MessageRequester_YesNoCancel) ProcedureReturn Ret EndProcedure
add a label to the ams project and edit the code to look like this
Code:
strTitle="Hello" strText="This is a PureBasic dll with arguments passed from AMS\r\n\r\nCheck the label for the return result." result = DLL.CallFunction("AutoPlay\\Docs\\MyDLL.dll", "MyFunctionName", "\""..strTitle.."\",\""..strText.."\"", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL); Label.SetText("Label1", result);
there you have it, your first dll
Comment