Article View: borland.public.cppbuilder.nativeapi
Article #3448Re: Message-Only Invisible Window
From: Bob Gonder
Date: Sun, 11 Jun 2006 15:39
Date: Sun, 11 Jun 2006 15:39
43 lines
2911 bytes
2911 bytes
Mike Collins wrote: >Basically a ProcessA calls my DLL and makes available some functions for my >DLL by passing my DLL a pointer to a specific structure. My DLL has two >threads, it's main thread (threadM) and a secondary one that examines some >hardware (threadH). If a certain hardware condition occurs, I need to call >one of the functions in the calling processA. However, if threadH calls the >exported function, the whole system can, on occasion stop working correctly >or work sporadically. So, really, your dll creates One thread (threadH), and your theadM is actually ProcessA? So, you want ProcessA to call the function. You could tell the author of ProcessA to handle your special message. Or you could create a global hook that gets injected into ProcessA's message handling. See SetWindowsHookEx() You might Google for code that Remy has posted several times. >1) Are there any specific properties, other than HWND_MESSAGE as the >hWndParent, that I need to set in either WNDCLASS / WNDCLASSEX or >RegisterClass / RegisterClassEx in my specific situation? I don't think so. >2) Do I need to call ShowWindow() or UpdateWindow in this particular context >as I don't really have a window to show? I don't think so, or maybe with SW_SHOW_HIDDEN >3) Do I specifically have code the while(GetMessage()) loop or can I rely on Yes >the WndProc to detect and capture my custom messages? I only ask this No >because it would seem to me that if I have a while loop in the start-up of >my DLL's main thread, it would then in effect pause the thread as it would >be sitting in that loop. Yes. That's why you used CreateProcess or CreateThread >4) I want to ensure that no other processes can attempt to close or >terminate this hidden window - what is the best way to prevent this. Best way to prevent that is to not do it this way.
Technical Details
Message-ID:
<i7do82h01e88f5hkl6sfbukbi0hbd19m59@4ax.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!atl-c05.usenetserver.com!news.usenetserver.com!peer01.west.cox.net!cox.net!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<448c3299@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,80c772113b1e51c1 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Message-Only Invisible Window Date: Sun, 11 Jun 2006 08:39:47 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <i7do82h01e88f5hkl6sfbukbi0hbd19m59@4ax.com> References: <448c3299@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 67.77.144.198 X-Trace: newsgroups.borland.com 1150040387 67.77.144.198 (11 Jun 2006 08:39:47 -0700) Lines: 45 Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!atl-c05.usenetserver.com!news.usenetserver.com!peer01.west.cox.net!cox.net!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail