Solved

Communication from DLL to a application

Posted on 1998-06-15
2
196 Views
Last Modified: 2013-11-20
How can I call a function in the application from the DLL ?
Is it possible thro CALLBACK? If so please specify how?
Thank U
0
Comment
Question by:aac
2 Comments
 
LVL 1

Accepted Solution

by:
IgorGrebnev earned 10 total points
ID: 1317957
Dear aac,

You can transfer the pointer to funciton in executable to DLL through pointer to function. The following code can be used
In EXE:

int ExportedFromEXEFunc()

{ return 0;
}

In DLL you should implement the following:

typedef int (*typePtrExpFunc)();

static typePtrExpFunc stm_pFunc = NULL;
 
declspec(_dllexport) void SetEXE_ExportedFunc( typePtrExpFunc pfExpFunc )

{stm_pFunc = pfExpFunc;
}

After calling the SetEXE_ExportedFunc from EXE and setting of static pointer to funciton in executable you can call the function through pointer anywhere in DLL:

(*stm_pFunc)();

0
 

Author Comment

by:aac
ID: 1317958
Instead of using declspec to export the function can I use it directly in my .def file?
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 86
matchUp  challenge 6 48
pre4 challenge 19 88
zeroMAx challenge 20 76
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now