Solved

Something that U don't expect

Posted on 1998-05-26
5
165 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

752 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