473,468 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Dynamic Link Library & Function Pointers

3 New Member
Hello all. I'm writing a Push To Talk radio program. As such I have a DLL that uses SetWindowsHookEx to set a callback function. This works, and is called when keyboard events take place.

Client programs using this DLL wish to know when a keyboard event takes place (even if said client program is not in the foreground).

So in my DLL I store a function pointer in a shared data section), and the DLL allows the clients to pass in a function pointer to be called when a keyboard event is raised.

If the client program has focus, the callback works as expected. If the client does not have focus, the callback method is called but never returns. I suspect this is because the client's function is in a different address space then all the DLL instances except the one it explicitly creates.

So my question is, how do you send data from a DLL to a client which may not have focus? Is a pipe the best bet?
Mar 3 '08 #1
4 1737
AdrianLP
3 New Member
...I hope this isn't off topic as it refers to DLLs. I would not find a Windows-specific programming forum on this site.

I suspect this question is less about DLLs and more about how to share data between applications using C++ (but perhaps even that is OS-specific) :(
Mar 3 '08 #2
weaknessforcats
9,208 Recognized Expert Moderator Expert
This is covered in Windows via C/C++ by Jeffrey Richter 2008.

The aopplications are separate processes ?? Or os one a child proecess of the other?

Most likely, you will use a mutex.
Mar 3 '08 #3
AdrianLP
3 New Member
This is covered in Windows via C/C++ by Jeffrey Richter 2008.

The aopplications are separate processes ?? Or os one a child proecess of the other?

Most likely, you will use a mutex.
There is one client, and it uses LoadLibrary to get the DLL (which installs a global keyboard hook).

As long as the client is in focus, the DLL can call a callback function which the client provides it with. If however the client is not in focus, the callback never returns.

The trouble is, what I understand from the MSDN, the DLL is duplicated many times (once for each running application) to handle the keyboard hooking. Only one instance has access to the callback method though.
Mar 3 '08 #4
weaknessforcats
9,208 Recognized Expert Moderator Expert
Focus may not be the issue. Are the Windows on separate threads?

I expect they will have to be to support multi-processing.
Mar 4 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: toton | last post by:
Hi, I have little confusion about static memory allocation & dynamic allocation for a cluss member. I have class like class Bar{ public: explicit Bar(){ cout<<"bar default"<<endl; }
7
by: Jo | last post by:
Hi, How can i differentiate between static and dynamic allocated objects? For example: void SomeFunction1() { CObject *objectp = new CObject; CObject object;
3
polymorphic
by: polymorphic | last post by:
I have succeeded in embedding PDF files in a dynamic iframe. The problem is that I need the PDF to cache. If the PDF remains the same from page load to page load then the pdf is somehow cached with...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.