| 
| Auteur | Message |  
| jawilli1 Newbie
 
 
 Inscrit le: 07 Juin 2006
 Messages: 12
 
 
   | 
|  Posté le:
Vendredi 7 Juillet 2006 03:00:54 |   |  
| I'm trying to open K!TV within a panel in VB.Net Application. I can open up other exe's and such (like notepad), but it won't actually open K!TV within the panel specified. What it is doing is opening up K!TV outside of the application (like if you opened it from the start menu), not within the application. I really need some way to open it this software within a panel on the canvas. Any help is appreciated! Merci!
 
 
 
| Code: |  
| Public Class Form1 Inherits System.Windows.Forms.Form
 
 #Region " Windows Form Designer generated code "
 
 Public Sub New()
 MyBase.New()
 
 'This call is required by the Windows Form Designer.
 InitializeComponent()
 
 'Add any initialization after the InitializeComponent() call
 
 End Sub
 
 'Form overrides dispose to clean up the component list.
 Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
 If disposing Then
 If Not (components Is Nothing) Then
 components.Dispose()
 End If
 End If
 MyBase.Dispose(disposing)
 End Sub
 
 'Required by the Windows Form Designer
 Private components As System.ComponentModel.IContainer
 
 'NOTE: The following procedure is required by the Windows Form Designer
 'It can be modified using the Windows Form Designer.
 'Do not modify it using the code editor.
 Friend WithEvents m_clsAreaPanel As System.Windows.Forms.Panel
 
 
 <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
 Me.m_clsAreaPanel = New System.Windows.Forms.Panel
 Me.SuspendLayout()
 '
 'm_clsAreaPanel
 '
 Me.m_clsAreaPanel.Location = New System.Drawing.Point(0, 0)
 Me.m_clsAreaPanel.Name = "m_clsAreaPanel"
 Me.m_clsAreaPanel.Size = New System.Drawing.Size(880, 528)
 Me.m_clsAreaPanel.TabIndex = 0
 '
 'Form1
 '
 Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
 Me.ClientSize = New System.Drawing.Size(880, 533)
 Me.Controls.Add(Me.m_clsAreaPanel)
 Me.Name = "Form1"
 Me.Text = "Form1"
 Me.ResumeLayout(False)
 
 End Sub
 
 #End Region
 
 Private m_clsProcess As System.Diagnostics.Process = Nothing
 
 Private Const GWL_STYLE As Integer = -16
 Private Const WS_CAPTION As Integer = &HC00000
 Private Const WS_BORDER As Integer = &H800000
 Private Const SWP_FRAMECHANGED As Integer = &H20
 Private Const SWP_NOMOVE As Integer = &H2
 Private Const SWP_NOZORDER As Integer = &H4
 Private Const SWP_NOSIZE As Integer = &H1
 Private Const SWP_SHOWWINDOW As Integer = &H40
 Private Const SWP_NOACTIVATE As Integer = &H10
 
 <System.Runtime.InteropServices.DllImport("user32", EntryPoint:="GetWindowLongA", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
 Private Shared Function GetWindowLong(ByVal hwnd As IntPtr, ByVal nIndex As Integer) As Integer
 End Function
 
 <System.Runtime.InteropServices.DllImport("user32", EntryPoint:="SetWindowLongA", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
 Private Shared Function SetWindowLong(ByVal hwnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
 End Function
 
 <System.Runtime.InteropServices.DllImport("user32", EntryPoint:="SetParent", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
 Private Shared Function SetParent(ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
 End Function
 
 <System.Runtime.InteropServices.DllImport("user32", EntryPoint:="SetWindowPos", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
 Private Shared Function SetWindowPos(ByVal hwnd As IntPtr, ByVal hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Long
 End Function
 
 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 LoadProcess("C:\Program Files\Advertise HD\ktv\K!TV.exe")
 End Sub
 Public Sub LoadProcess(ByVal FileName As String)
 
 ' check for existing process...
 If Not m_clsProcess Is Nothing Then
 Throw New System.Exception("A process is already associated with this panel. Use ReleaseProcess first.")
 End If
 
 ' set up process...
 Dim clsProcessInfo As System.Diagnostics.ProcessStartInfo = New System.Diagnostics.ProcessStartInfo(FileName)
 clsProcessInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal
 
 ' launch process...
 m_clsProcess = System.Diagnostics.Process.Start(clsProcessInfo)
 'Try
 ' m_clsProcess.WaitForInputIdle()
 'Catch
 'System.Threading.Thread.Sleep(50)
 'End Try
 ' set parent of process to content area...
 SetParent(m_clsProcess.MainWindowHandle, Me.m_clsAreaPanel.Handle)
 
 ' remove the caption and border...
 SetWindowLong(m_clsProcess.MainWindowHandle, GWL_STYLE, GetWindowLong(m_clsProcess.MainWindowHandle, GWL_STYLE) And (Not WS_CAPTION) And (Not WS_BORDER))
 
 ' resize the window...
 Me.ResizeWindow(True)
 
 End Sub
 
 Private Sub ResizeWindow(ByVal ShowWindow As Boolean)
 ' position the window...
 Dim Flags As Integer = SWP_FRAMECHANGED Or SWP_NOZORDER
 If ShowWindow Then
 Flags = Flags Or SWP_SHOWWINDOW
 Else
 Flags = Flags Or SWP_NOACTIVATE
 End If
 SetWindowPos(m_clsProcess.MainWindowHandle, 0, 0, 0, Me.m_clsAreaPanel.Width, Me.m_clsAreaPanel.Height, Flags)
 End Sub
 
 Public Sub ReleaseProcess()
 If Not m_clsProcess Is Nothing Then
 m_clsProcess.CloseMainWindow()
 m_clsProcess.Close()
 m_clsProcess.Dispose()
 m_clsProcess = Nothing
 End If
 End Sub
 
 
 End Class
 
 |  |  
|  |  |  
|   |  
|  |  
| Cricri Dévelo
 
  
 Inscrit le: 06 Avr 2002
 Messages: 11926
 
 
   | 
|  Posté le:
Vendredi 7 Juillet 2006 07:22:52 |   |  
| First have a look in the item "Faq" of the help of K!TV, there is some command line argument which may help you.
 
 Anyway here it is a generalist forum, the forum dedicated to developpement is there :
 http://ForumDev.fr.st
 |  
| _________________
 Config  .
 |  |  
|    |  
|  |  
| jawilli1 Newbie
 
 
 Inscrit le: 07 Juin 2006
 Messages: 12
 
 
   | 
|  Posté le:
Vendredi 7 Juillet 2006 13:24:06 |   |  
| Unfortunately this is entirely in french with no english posts... can you tell me what post it may be in, that way I can start to translate it as best as I can.
 
 J
 |  
|  |  |  
|   |  
|  |  
| Cricri Dévelo
 
  
 Inscrit le: 06 Avr 2002
 Messages: 11926
 
 
   | 
|  Posté le:
Vendredi 7 Juillet 2006 14:04:13 |   |  |  
|    |  
|  |  
| jawilli1 Newbie
 
 
 Inscrit le: 07 Juin 2006
 Messages: 12
 
 
   | 
|  Posté le:
Vendredi 7 Juillet 2006 14:45:20 |   |  
| I've looked through those FAQ at great length to try to find the answer, but have been unable to discover a solution from the command line arguements. Right now I move thigns where they need to be using the -x and -y commands (both in the .ini file and at the command line), but that is causing problems. Basically I need to make sure that the KTV window is within its own place in the entire program that I'm writing. The only way that I have found to do this with vb.net is to put it into a panel window on a application canvas. if there are other ways to make sure that it fits within it's own window in a program I'm open to suggestion.
 
 The problem We are running into is,  with the absolute references (-x -y -w -h, etc...) is that sometimes when the computer reboots those values change (I don't know how...but they do), meaning that the KTV window will then appear over what I put around the KTV Window.
 |  
|  |  |  
|   |  
|  |  
|  |  
| 
 
 
 
 | Voir le sujet suivant
 Voir le sujet précédent
 Vous ne pouvez pas poster de nouveaux sujets dans ce forum
 Vous ne pouvez pas répondre aux sujets dans ce forum
 Vous ne pouvez pas éditer vos messages dans ce forum
 Vous ne pouvez pas supprimer vos messages dans ce forum
 Vous ne pouvez pas voter dans les sondages de ce forum
 
 |  
Powered by phpBB  
© 200-2008 phpBB Group :: FI Theme  ::
Toutes les heures sont au format GMT + 1 Heure 
Traduction par : phpBB-fr.com
 |