Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Something that U don't expect

Posted on 1998-05-26
5
Medium Priority
?
169 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 400 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…
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…
Suggested Courses

886 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