Solved

Something that U don't expect

Posted on 1998-05-26
5
160 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
Comment Utility
Why don't you use the common form properties (left,top,width,height).
0
 

Author Comment

by:finrod
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now