RE: Integrate JDE with vb dll

Eric

Active Member
RE: Integrate JDE with vb dll

From: Chandra Nath <[email protected]>
To: "'[email protected]'" <[email protected]>,
[email protected]
Subject: RE: Integrate JDE with vb dll
Date: Fri, 2 Feb 2001 15:29:04 +0530

Hi Bell

I hope following information helps you in calling a
function from DLL. The
Following example shows creating a sample DLL and then
passing a call to a
function exported from this DLL.

How to Call a non-OneWorld DLL from OneWorld

1. Open Microsoft Visual C++ and File-> New

2. Create a new project by selecting Win32 Dynamic-Link
Library to produce
a DLL instead of executables
Type a Project Name and click OK to save

3. Select an empty DLL project and click on FINISH
button and click OK if
message box appears.

4. Select Workplace from the view menu, and select File
View tab

5. Right mouse click on Source File -> add file to
folder to import your
source code.

Sample Code:
*******************************
#include <windows.h>
#include <stdio.h>

void _declspec(dllexport) test(char *szUserId, char
*szBatchNumber,double
dLineNumber,char *szTransactionType,char
*szOrderType,double dSequenceNumber);
BOOL WINAPI DllMain(HINSTANCE hInst,DWORD dw,LPVOID lpv)
{
}

void _declspec(dllexport) test(char *szUserId, char
*szBatchNumber,double
dLineNumber,char *szTransactionType,char
*szOrderType,double dSequenceNumber)
{
MessageBox(NULL,"Can you see me?","",MB_OK);
}
********************************

Note: The dllexport and dllimport storage-class
attributes are
Microsoft-specific extensions to the C and C++
languages. They enable you to
export and import
functions, data, and objects to and from a DLL. These
attributes explicitly
define the DLL's interface to its client, which can be
the executable file
or another DLL.
Declaring functions as dllexport eliminates the need for
a module-definition
(.DEF) file, at least with respect to the specification
of exported
functions. Note that
dllexport replaces the __export keyword.

The declaration of dllexport and dllimport uses extended
attribute syntax.

Example

// Example of the dllimport and dllexport class
attributes
__declspec( dllimport ) int i;
__declspec( dllexport ) void func();

6. Build -> rebuild all to produce the DLL.



Call the DLL from OneWorld Application

1. Go to OL or OMW to create a new application.

2. Go to Design of your application, and create a new
find/browse form
(delete the grid )

3. Add a push button on your form (insert -> push
button)

4. Right mouse Click on the button, and select Event
Rules.

5. at Button Clicked, call a BSFN (B0000192 - Outbound)
-Select F(B) and
type B0000192 at the Source Module.

6. Pass parameters to the BSFN:
test --> szFunctionName
c:\test\test.dll --> szFunctionLibrary
(location of your DLL)
*Pass <blank> or <zero> to all the other
data items

7. Save your application and run it.

8. Push the push button, and you should see a "Can you
see me?" message
box.


Best Regards

Chandra S. Nath
(Systems Engineer)
AristaSoft Corporation
Tel: +91 (40) 311-9800x5811 (Work)
+91 98490-31826 (Mobile)
Fax: +91 (40) 311-9801
 
Back
Top