Post by Izy Coder on Feb 16, 2015 21:47:26 GMT 10
I use this code : Shared Sub OpenApplication(ByVal ApplicationPath As String) Dim p As Process Dim ShowForm As New Form Dim FormPanel As New Panel FormPanel.Dock = DockStyle.Fill ShowForm.Controls.Add(FormPanel) p = Process.Start(ApplicationPath) Threading.Thread.Sleep(500) SetParent(p.MainWindowHandle, FormPanel.Handle) ShowForm.Show() End Sub but it run the application inside the panel with the border. if i make my own virtual operating system, how do i change the border to none? like windows 7 have their own form border, windows 8 and mac too. (It's window skin not border) but I make my own form border. it's graphic, how can I make the application use my border? this is some example(i can post image) : Windows 8 Notepad with Their UI Design (it's Form Border for me): Windows 7 Notepad with Their UI Design And this is my UI Design (Window skin) : how can I Make like this when double click notepad.exe or another .exe file in my virtual os? (this is edited version !) : it's run the exe but with my own Window Skin. How can I do like that? oh ya... and this is my original post from Stack Overflow - How to launch any application with own UI Design vb.netI post this in here because no response in stackoverlow.com
Check Out My Project At VSlang InternetTM. More Project : - Poroxnoss Text Editor 2 - Added soon...
- TAP 2D Game Maker - Coming really soon...
- Easy Desktop - Discontinue..
|
|
Post by oniii on Feb 16, 2015 23:50:36 GMT 10
|
|
Post by Nathan Lecompte on Feb 17, 2015 15:04:35 GMT 10
I don't think you can change the settings of the system programs, well that is without hacking into the system and bypassing all the security and stuff...
|
|
Post by Prezence on Feb 17, 2015 23:53:35 GMT 10
Well Krypton controls and I think DotNetBar have done a custom form border, same as chrome and Firefox . I don't have the faintest idea how though
Check out our website here. Check out AirBrowse here. Follow us on GitHub here.
|
|
Post by Nathan Lecompte on Feb 18, 2015 15:10:37 GMT 10
I think that's different to what Izy is looking for though... What you could try though Izy Coder , how about you just set some margins or even easier; just change the size of the form so the edges hide off the side...
|
|
Post by Prezence on Feb 18, 2015 22:22:51 GMT 10
Ok so this is how you can do that: Declare these functions: Declare Auto Function SetParent Lib "user32.dll" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Integer Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer Private Const WM_SYSCOMMAND As Integer = 274 Private Const SC_MAXIMIZE As Integer = 61488
Private Const SC_RESTORE As Integer = 61728
Public Const GWL_STYLE = -16 Public Const WS_CAPTION = &HC00000 Public Const WS_BORDER = &H800000 Public Const SWP_FRAMECHANGED = &H20 Public Const SWP_NOMOVE = &H2 Public Const SWP_NOZORDER = &H4 Public Const SWP_NOSIZE = &H1 Public Const SWP_SHOWWINDOW = &H40
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As IntPtr, ByVal nIndex As Integer) As Integer Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer Public p as Process 'make sure you have this as a field
Then slightly modify the code above: Shared Sub OpenApplication(ByVal ApplicationPath As String) Dim ShowForm As New Form Dim FormPanel As New Panel FormPanel.Dock = DockStyle.Fill ShowForm.Controls.Add(FormPanel) p = Process.Start(ApplicationPath) Threading.Thread.Sleep(500) SetParent(p.MainWindowHandle, FormPanel.Handle) 'embeds the process, but size is off SendMessage(p.MainWindowHandle, WM_SYSCOMMAND, SC_RESTORE, 0) 'quickly restores the process before maximizing. This must be called before maximizing or the process will not change because it is already maximized. SendMessage(p.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0) 'maximizes the process
Dim style As Integer style = GetWindowLong(p.MainWindowHandle, GWL_STYLE) 'gets current style for process style = style And Not WS_CAPTION And Not WS_BORDER 'removes border and title bar from style SetWindowLong(p.MainWindowHandle, GWL_STYLE, style) 'sets new style to process, and now there should be no title bar or borders.
ShowForm.Show() End Sub
This will work but if you want the process to always size with the form, add the following: Private Sub FormSizeChanged(sender As Object, e As EventArgs) Try SendMessage(p.MainWindowHandle, WM_SYSCOMMAND, SC_RESTORE, 0) 'restores the process (like above) SendMessage(p.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0) 're-maximizes the process according to new window size Catch ex As NullReferenceException Catch ex As Exception End Try End Sub
'Above in the previous sub,
AddHandler ShowForm.SizeChanged,AddressOf FormSizeChanged
Should be straightforward, hope that helped.
Check out our website here. Check out AirBrowse here. Follow us on GitHub here.
Last Edit: Feb 18, 2015 22:25:57 GMT 10 by Prezence
|
|