🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #10454

Re: How to catch mouseclicks from another application?

#10454
From: Remy Lebeau (TeamB)
Date: Thu, 08 Apr 2004 20:32
24 lines
2189 bytes
"Henk" <h.van.winkoop@wxs.nl> wrote in message
news:4075a4df$1@newsgroups.borland.com...

> Why doesn't the function 'BringWindowToFront(HWND)' (and
> others from same group) don't do anything when called inside a
> dll-function but DO work when called in an application?

The hook DLL is injected into the address space of every application(s) that
you are hooking.  Unless the calling application currently has focus, it
can't bring any windows into focus.  This way whatever the user is currently
doing is not interrupted.

It could also be caused your use of a static HWND, since every DLL instance
is going to get its own local copy of the HWND, but you are only setting the
HWND for the DLL instance that is loaded by your own application.  If you
look at the function's return value, I will bet you that it is reporting an
invalid handle.  To share an HWND (or anything else, for that matter)
between all of the instances of your DLL, you need to store the data in
shared memory.  Look at the CreateFileMapping() and MapViewOfFile()
functions for that.


Gambit
Technical Details
Message-ID: <4075b6bd$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <407421ef@newsgroups.borland.com> <40743aad$1@newsgroups.borland.com> <40754399$1@newsgroups.borland.com> <40758801$1@newsgroups.borland.com> <4075a4df$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,e0858ea1c0821ca
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-04-08 13:40:10 PST
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <407421ef@newsgroups.borland.com> <40743aad$1@newsgroups.borland.com> <40754399$1@newsgroups.borland.com> <40758801$1@newsgroups.borland.com> <4075a4df$1@newsgroups.borland.com>
Subject: Re: How to catch mouseclicks from another application?
Date: Thu, 8 Apr 2004 13:32:08 -0700
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 67.22.138.253
Message-ID: <4075b6bd$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1081456317 67.22.138.253 (8 Apr 2004 13:31:57 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail