🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Urgent FindWindow() with minimized window!!

#14290
From: Remy Lebeau (TeamB)
Date: Wed, 20 Aug 2003 15:42
75 lines
3267 bytes
"Schandler" <theslider@programmer.net> wrote in message
news:3f433f98@newsgroups.borland.com...

> I'm not expierenced with memory mapped file, so if there is
> an example or something that demonestrates the usage of
> CreateFileMapping() and MapViewOfFile(), it would be
> nice if u tell me where can I find it

    struct _HookInfo
    {
        HHOOK hHook;
        HWND hWnd;
    } HOOKINFO, *PHOOKINFO;

    HANDLE hFileMapping = NULL;
    PHOOKINFO pHookInfo = NULL;

    BOOL WINAPI DllEntryPoint(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID
lpvReserved)
    {
        switch( fdwReason )
        {
            case DLL_PROCESS_ATTACH:
                hFileMapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL,
PAGE_READWRITE, 0,  sizeof(HOOKINFO), "MyHook");
                if( hFileMapping )
                    pHookInfo = (MyStruct*)MapViewOfFile(hFileMapping,
FILE_MAP_WRITE, 0, 0, 0);
                break;

            case DLL_PROCESS_DETACH:
                UnmapViewOfFile(pHookInfo);
                pHookInfo = NULL;
                CloseHandle(hFileMapping);
                hFileMapping = NULL;
                break;
        }

        return TRUE;
    }

    extern "C" __declspec(dllexport) int __stdcall SetHook(HWND hWnd)
    {
        if( pHookInfo )
        {
            if( pHookInfo->hHook == NULL )
                pHookIno->hHook = SetWindowsHookEx(...);
            pHookInfo->hWnd = hWnd;
            return ( pHookInfo->hHook != NULL );
        }
        return FALSE;
    }

    extern "C" __declspec(dllexport) void __stdcall UnsetHook()
    {
        if( pHookInfo )
        {
            if( pHookInfo->hHook )
            {
                UnhookWindowsHookEx(pHookIno->hHook);
                pHookInfo->hHook = NULL;
            }
        }
    }


Gambit



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.510 / Virus Database: 307 - Release Date: 8/14/03
Technical Details
Message-ID: <3f43a370@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!green.readfreenews.net!news.readfreenews.net!cox.net!news-xfer.cox.net!in.100proofnews.com!in.100proofnews.com!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f41defb@newsgroups.borland.com> <3f425676$1@newsgroups.borland.com> <3f428826@newsgroups.borland.com> <3f42a13b$1@newsgroups.borland.com> <3f433f98@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,2982d6ee34563d56
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-20 09:41:24 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f41defb@newsgroups.borland.com> <3f425676$1@newsgroups.borland.com> <3f428826@newsgroups.borland.com> <3f42a13b$1@newsgroups.borland.com> <3f433f98@newsgroups.borland.com>
Subject: Re: Urgent FindWindow() with minimized window!!
Date: Wed, 20 Aug 2003 08:42:50 -0700
Lines: 77
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.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3f43a370@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1061397360 207.175.226.26 (20 Aug 2003 09:36:00 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!green.readfreenews.net!news.readfreenews.net!cox.net!news-xfer.cox.net!in.100proofnews.com!in.100proofnews.com!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail