Windows screen saver and toplevel -use option



Hi All,

I'm trying to create a WinXP screen saver using a TclApp wrapped
executable. So far, I don't see any stumbling blocks except for
supporting the small "preview" mode of most screen savers.

In this mode, Windows calls the screen saver application with a "/p
####" command line switch, where the "####" is the decimal
representation of the HWND for the small preview window shown in the
screen saver dialog. The application is supposed to create a window
that's a child of that HWND and display itself (scaled down) in the
new window.

I can' seem to figure out how to get my newly created toplevel window
properly parented to the passed HWND argument. I've tried to create
the new window like this:

set parentID <passed_HWND>
set child [toplevel .child-use $parentID]
set childID [winfo id $child]

Using the above code, I don't get any errors, which I do if I pass an
invalid HWND, so Tk seems to understand what I'm trying to do, but I
don't seem to get the results I expect. In fact, using twapi, if I
do:

puts [twapi::window_is_child $parentID $childID]

it returns "0", indicating that my new window is indeed *not* a child
of the passed parent. I thought I could maybe reparent my new window
using twapi's "Win32 Raw API" support via the windows "SetParent"
function, but it doesn't seem to be in the available Win API commands
supported by twapi. I *think* it'd be possible to access "SetParent"
and friends via ffidl, though I've never used ffidl.

So, am I missing something simple, or do I need to get a bigger hammer
(some other twapi functions, or ffidl)? If that's the case, any tips
on getting my window properly parented would be appreciated.

Thanks,

Jeff


.



Relevant Pages

  • Re: How add buton onto title bar of any external active window?
    ... I want to add buttons ontoany active window. ... int sm_CXSIZE; ... static int WindowsFeaturesWidth(HWND hwnd, DWORD style) ... LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ...
    (microsoft.public.win32.programmer.gdi)
  • Re: MFC and Worker Thread issue
    ... situations such as the thread has terminated before the window was created but has no way ... CWnd* which is the message sink and it is created before the thread (with its HWND value) ... which does never see PostMessage or HWND. ... Callbacks add their own problems; I try to avoid them if at all possible. ...
    (microsoft.public.vc.mfc)
  • Re: Are VBA userforms always child of Windows desktop?
    ... I only need this Hwnd of the parent, ... GetAncestor API (with GA_PARENT) to get Parent. ... I suppose which window you need will depend on the overall objective. ... Private Declare Function GetDesktopWindow Lib "user32" As Long ...
    (microsoft.public.excel.programming)
  • Re: Why doesnt this recursive function return the right value?
    ... sClassName Like ClassName & "*" Then FindWindowHwndLike_B = hwnd lHolder = hwnd ... Couldn't find anything for the ClassName comparison. ... Dim s1 As String, s2 As String ... 'finds the first window where the class name start with ClassName ...
    (microsoft.public.excel.programming)
  • Re: Creating new appointment & setting its properties
    ... The window and process subclassing I've seen with WordMail is horrendous, it's miles of code just to get a true hWnd for a WordMail window usually. ... Private Declare Function GetForegroundWindow Lib "User32.dll" As Long ... Private Declare Function FindWindowEx Lib "User32.dll" Alias "FindWindowExA" (ByVal hwndParent As Long, ByVal hwndChildAfter As Long, ByVal lpszClass As String, ByVal lpszWindow As String) As Long ...
    (microsoft.public.outlook.program_vba)