Solved

Something that U don't expect

Posted on 1998-05-26
5
163 Views
Last Modified: 2006-11-17
How can I change the position & size of a window that
runs an AVI file by the  MMCONTROL
(I tried to change the SETWINDOWPOS  from the API
and couldn't do the job)
0
Comment
Question by:finrod
5 Comments
 
LVL 3

Expert Comment

by:fguerreiro_inix
ID: 1461725
Why don't you use the common form properties (left,top,width,height).
0
 

Author Comment

by:finrod
ID: 1461726
fguerreiro_inix your answer hasen't beed of satisfactory result
we alredy past this point

try someting advanced next time!!
0
 
LVL 5

Accepted Solution

by:
bin_huwairib earned 200 total points
ID: 1461727
finrod,

Use  GetForegroundWindow API function to get the output window's handle first then use SetWindowPos.

Example
=======
1- Add form1 to project1.
2- Add mmcontrol1 and command1 to form1.
3- Paste this code:

Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function SetWindowPos Lib "user32" (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
Private Const HWND_TOP = 0
Private Const SWP_SHOWWINDOW = &H40

Private Sub Command1_Click()
 Dim MyHandle As Long
 
 MMControl1.Command = "Close"
 MMControl1.Wait = False
 MMControl1.DeviceType = "AVIVideo"
 MMControl1.filename = "d:\winnt\clock.avi"
 MMControl1.Command = "Open"
 MMControl1.Command = "play"
 
 MyHandle = GetForegroundWindow()
 Call SetWindowPos(MyHandle, HWND_TOP, 0, 0, 100, 100, SWP_SHOWWINDOW)
End Sub


Best regards
Bin Huwairib
0
 
LVL 7

Expert Comment

by:kamall
ID: 1461728
finrod,
There is a much simpler way to do what you want. It enables you to play the AVI file directly inside your form (or another VB form). Then, you can set the position and size of your form as you normally do in VB.
If the currently proposed answer is satisfactory to you, please grant bin_huwairib the points. Otherwise, re-open the question to let me give you the code.
Regards
0
 
LVL 5

Expert Comment

by:bin_huwairib
ID: 1461729
kamall,

Initially I thought of suggesting your idea, but I've provided my code because finrod's question shows an interest of the AVI window itself besides directing AVI to a form will loose the AVI sizing feature.

So if finrod is interest on your idea I can provide it as well.

Bin Huwairib
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question