From: ralph on
On Sat, 31 Jul 2010 13:57:19 -0700, BeeJ <nospam(a)nowhere.com> wrote:

>When I said I needed to pass the fImage form I was suggesting use of
>This sub in the ActiveX EXE.
>
>Public Function SetOwner(ByVal hwndToUse, ByVal hwndOfOwner) As Long
>
> SetOwner = SetWindowLong(hwndToUse, GWL_HWNDPARENT, hwndOfOwner)
>
>End Function 'SetOwner
>
>Does this also set the Z Order?
>

[With the usual reservations - as in I'm not exactly sure what you're
trying to do... <g>]

Normally clients manage the display/presentation and servers just
supply services. It looks like you are trying to force or control the
wrong player.

1) The easiest way to communicate instructions to an ActiveX
component/exe is to have the service provide a 'config' interface
(class) or simply add the additional instructions to the existing
Interface.

2) As Z-Order is pretty much only valid for (and should be controlled
by) the client, create an object to wrap these facilities. Something
like
a) Send the ActiveX information on how to construct and create an
object. (If needed)
b) Retrieve the object
c) Sort display as needed.
d) Return the object/clean-up

-ralph
From: BeeJ on
dug this out

' Declare Function SetWindowPos Lib "user32.dll" (ByVal hwnd As Long,
ByVal hWndInsertAfter As Long, _
ByVal x As Long, ByVal y As Long, _
ByVal cx As Long, ByVal cy As Long, _
ByVal wFlags As Long) As Long
'
' hwnd The handle of the window to move.
' hWndInsertAfter Either the handle of the window to position this
window behind,
' Or exactly one of the following flags stating where in the Z-order
to put the window:
' HWND_BOTTOM = 1 Put the window at the bottom of the Z-order.
' HWND_NOTOPMOST = -2 Put the window below all topmost windows and
above all non-topmost windows.
' HWND_TOP = 0 Put the window at the top of the Z-order.
' HWND_TOPMOST = -1 Make the window topmost (above all other
windows) permanently.
' x The x coordinate of where to put the upper-left
corner of the window.
' y The y coordinate of where to put the upper-left
corner of the window.
' cx The x coordinate of where to put the
lower-right corner of the window.
' cy The y coordinate of where to put the
lower-right corner of the window.
' wFlags Zero or more of the following flags stating how
to move the window:
' SWP_DRAWFRAME = &H20 Same as SWP_FRAMECHANGED.
' SWP_FRAMECHANGED = &H20 Fully redraw the window in its new
position.
' SWP_HIDEWINDOW = &H80 Hide the window from the screen.
' SWP_NOACTIVATE = &H10 Do not make the window active after
moving it unless it was already the active window.
' SWP_NOCOPYBITS = &H100 Do not redraw anything drawn on the
window after it is moved.
' SWP_NOMOVE = &H2 Do not move the window.
' SWP_NOSIZE = &H1 Do not resize the window.
' SWP_NOREDRAW = &H8 Do not remove the image of the window
in its former position, effectively leaving a ghost image on the
screen.
' SWP_NOZORDER = &H4 Do not change the window's position in
the Z-order.
' SWP_SHOWWINDOW = &H40 Show the window if it is hidden.
'


From: David Youngblood on
"BeeJ" <nospam(a)nowhere.com> wrote in message
news:i322na$cqk$1(a)speranza.aioe.org...
> When I said I needed to pass the fImage form I was suggesting use of
> This sub in the ActiveX EXE.
>
> Public Function SetOwner(ByVal hwndToUse, ByVal hwndOfOwner) As Long
> SetOwner = SetWindowLong(hwndToUse, GWL_HWNDPARENT, hwndOfOwner)
> End Function 'SetOwner
>
> Does this also set the Z Order?

Yes and no. It sets the owner of a window, but you may need to 'force' an
update to the ZOrder for it to be shown. The below example changes the owner
of Notepad (if running), Me.ZOrder forces an update. If called from the
Form_Load, ZOrder isn't needed.


Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long

Private Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Const GWL_HWNDPARENT = (-8)
Private hwndOldOwner As Long

Private Sub Command1_Click()

Dim h As Long

h = FindWindow("Notepad", vbNullString)
If h Then
hwndOldOwner = SetWindowLong(h, GWL_HWNDPARENT, Me.hwnd)
End If
Me.ZOrder

End Sub


From: MikeD on


"BeeJ" <nospam(a)nowhere.com> wrote in message
news:i3222h$c23$1(a)speranza.aioe.org...
> I want to stack forms in a certain order.
> Z pos - Form
> 0 - Main App Form
> 1 - Image Form (launched from Main Form, sits on top of Main App
> Form)
> 2 - Small Image Form #1
> 2 - Small Image Form #2.
> Note that Z2 only means above Z1 and Small Image Form #1 can be above or
> below #2 (not mandatory).
> Now the way I would do this is to use the following in the Main App Form.
> This works. Hope I got the following code right.
>
> fImage.Show , Me ' on top of main
> fSmallImage1.Show , fImage
> fSmallImage2.Show , fImage
>
> But, unfortunately, this not the new architecture.
>
> fSmallImage1 and fSmallImage2 are now each contained in ActiveX EXEs.
> One ActiveX EXE for each fSmallImageN.

Why? Are these going to be shared among multiple applications? If not,
there's probably no reason to have them in ActiveX anything. And why did you
chose ActiveX EXE?

> I have a class that all works except for setting the owner of the
> fSmallImage form.
>

Gonna be difficult (or at least more complex) since being ActiveX EXEs, they
are a different process. Even ActiveX DLLs wouldn't be so bad since they run
in the same process as the main app (or whatever's loading the DLL).

It sounds like everything was functioning as you wanted it before. So why
did you change things? Not everything needs to be in its own separate
component.

--
Mike


From: BeeJ on
It happens that MikeD formulated :
>
> "BeeJ" <nospam(a)nowhere.com> wrote in message
> news:i3222h$c23$1(a)speranza.aioe.org...
>> I want to stack forms in a certain order.
>> Z pos - Form
>> 0 - Main App Form
>> 1 - Image Form (launched from Main Form, sits on top of Main App
>> Form)
>> 2 - Small Image Form #1
>> 2 - Small Image Form #2.
>> Note that Z2 only means above Z1 and Small Image Form #1 can be above or
>> below #2 (not mandatory).
>> Now the way I would do this is to use the following in the Main App Form.
>> This works. Hope I got the following code right.
>>
>> fImage.Show , Me ' on top of main
>> fSmallImage1.Show , fImage
>> fSmallImage2.Show , fImage
>>
>> But, unfortunately, this not the new architecture.
>>
>> fSmallImage1 and fSmallImage2 are now each contained in ActiveX EXEs.
>> One ActiveX EXE for each fSmallImageN.
>
> Why? Are these going to be shared among multiple applications? If not,
> there's probably no reason to have them in ActiveX anything. And why did you
> chose ActiveX EXE?
>
>> I have a class that all works except for setting the owner of the
>> fSmallImage form.
>>
>
> Gonna be difficult (or at least more complex) since being ActiveX EXEs, they
> are a different process. Even ActiveX DLLs wouldn't be so bad since they run
> in the same process as the main app (or whatever's loading the DLL).
>
> It sounds like everything was functioning as you wanted it before. So why
> did you change things? Not everything needs to be in its own separate
> component.

For one thing it is an excellent self-tutorial.
Since no one else seems to be able to help with ActiveX EXE in any
significant way.
The main app has many timing operations going on and the ActiveX
components now carry that to a new thread.
It also helps me see what is going on by isolating certain timing
operations to ActiveX EXEs.
So maybe in the future I can bring them all back if I can figure out
how to make all the timing considerations work together in the main
app.
I have six distinct ActiveX apps. Two of them are instantiated
multiple times. All are isolated on there own thread and that allows
me to see what is going on. One of the ActiveX EXEs is a debug app
that all other app can pass debugging messages to. That all works.
All the ActiveX EXEs are working but I still have some timing issues I
am trying to understand. e.g. using a loop to delay or use
CreateWaitableTimer to delay. The loop method is not consistent so I
am going to try CreateWaitableTimer and see if the WIN OS can do a
better job.
Yes, a real-time OS would help but I am stuck with Window XP and on.


First  |  Prev  | 
Pages: 1 2
Prev: RegClean
Next: MMControl (.wait = False Problem)