Solved

Something that U don't expect

Posted on 1998-05-26
5
162 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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 …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

776 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