{"id":457,"date":"2009-07-27T08:00:45","date_gmt":"2009-07-27T11:00:45","guid":{"rendered":"http:\/\/leandroascierto.com\/blog\/?p=457"},"modified":"2011-08-27T08:24:09","modified_gmt":"2011-08-27T11:24:09","slug":"poner-un-formulario-mdi-en-fullscreen","status":"publish","type":"post","link":"https:\/\/leandroascierto.com\/blog\/poner-un-formulario-mdi-en-fullscreen\/","title":{"rendered":"Poner un Formulario MDI en Fullscreen"},"content":{"rendered":"<p style=\"text-align: justify;\">Este es un m\u00f3dulo que nos permitir\u00e1 poner un formulario MDI en modo FullScreen cuando est\u00e1 maximizado, la ventaja de esto es ganarle un poco m\u00e1s de espacio al monitor, y sobre todo cuando el software tiene un papel protag\u00f3nico en el PC que lo ejecuta.<\/p>\n<p style=\"text-align: justify;\">C\u00f3digo del m\u00f3dulo bas \u00abMdiFullScreen\u00bb<\/p>\n<p\/>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nOption Explicit\r\n \r\nPrivate Declare Function CallWindowProc Lib &quot;user32&quot; Alias &quot;CallWindowProcA&quot; (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long\r\nPrivate Declare Function SetWindowPos Lib &quot;user32.dll&quot; (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\r\nPrivate Declare Function GetWindowLong Lib &quot;user32&quot; Alias &quot;GetWindowLongA&quot; (ByVal hwnd As Long, ByVal nIndex As Long) As Long\r\nPrivate Declare Function SetWindowLong Lib &quot;user32&quot; Alias &quot;SetWindowLongA&quot; (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long\r\nPrivate Declare Function RegisterHotKey Lib &quot;user32&quot; (ByVal hwnd As Long, ByVal ID As Long, ByVal fsModifiers As Long, ByVal vk As Long) As Long\r\nPrivate Declare Function UnregisterHotKey Lib &quot;user32&quot; (ByVal hwnd As Long, ByVal ID As Long) As Long\r\nPrivate Declare Function SendMessage Lib &quot;user32.dll&quot; Alias &quot;SendMessageA&quot; (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long\r\n \r\nPrivate Const HWND_TOPMOST          As Long = -1\r\nPrivate Const HWND_NOTOPMOST        As Long = -2\r\n \r\nPrivate Const SWP_NOACTIVATE        As Long = &amp;H10\r\nPrivate Const SWP_NOSIZE            As Long = &amp;H1\r\nPrivate Const SWP_NOMOVE            As Long = &amp;H2\r\nPrivate Const SWP_SHOWWINDOW        As Long = &amp;H40\r\n \r\nPrivate Const WS_MAXIMIZEBOX        As Long = &amp;H10000\r\nPrivate Const WS_MINIMIZEBOX        As Long = &amp;H20000\r\nPrivate Const WS_THICKFRAME         As Long = &amp;H40000\r\nPrivate Const WS_SYSMENU            As Long = &amp;H80000\r\nPrivate Const WS_CAPTION            As Long = &amp;HC00000\r\n \r\nPrivate Const SC_RESTORE            As Long = &amp;HF120&amp;\r\n \r\nPrivate Const WM_ACTIVATEAPP        As Long = &amp;H1C\r\nPrivate Const WM_HOTKEY             As Long = &amp;H312\r\nPrivate Const WM_SYSCOMMAND         As Long = &amp;H112\r\n \r\nPrivate Const GWL_STYLE             As Long = (-16)\r\nPrivate Const GWL_WNDPROC           As Long = (-4)\r\n \r\nConst MyHotKey                      As Long = &amp;H1000\r\n \r\nDim WndStyle As Long\r\nDim bFullScreen As Boolean\r\nDim PrevProc As Long\r\n \r\n \r\nPublic Sub ShowFullScreen(hwnd As Long) \r\n    If Not bFullScreen Then \r\n        bFullScreen = True \r\n        Call RegisterHotKey(hwnd, MyHotKey, 0, vbKeyEscape) \r\n        WndStyle = GetWindowLong(hwnd, GWL_STYLE) \r\n        SetWindowLong hwnd, GWL_STYLE, WndStyle And Not WS_MAXIMIZEBOX And Not WS_MINIMIZEBOX And Not WS_THICKFRAME And Not WS_CAPTION\r\n        SetWindowPos hwnd, HWND_TOPMOST, 0, 0, Screen.Width \/ 15, Screen.Height \/ 15, SWP_NOACTIVATE \r\n        PrevProc = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf WindowProc) \r\n    End If \r\nEnd Sub\r\n \r\nPublic Sub EndFullScreen(hwnd)\r\n    If bFullScreen Then\r\n        bFullScreen = False\r\n \r\n        SetWindowLong hwnd, GWL_STYLE, WndStyle \r\n        SendMessage hwnd, WM_SYSCOMMAND, SC_RESTORE, ByVal 0&amp; \r\n        SetWindowLong hwnd, GWL_WNDPROC, PrevProc\r\n \r\n        Call UnregisterHotKey(hwnd, MyHotKey)\r\n \r\n    End If\r\nEnd Sub\r\n \r\nPublic Function WindowProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long\r\n    WindowProc = CallWindowProc(PrevProc, hwnd, uMsg, wParam, lParam)\r\n \r\n    If uMsg = WM_ACTIVATEAPP Then\r\n        EndFullScreen hwnd\r\n    End If\r\n \r\n    If uMsg = WM_HOTKEY Then\r\n        If wParam = MyHotKey Then\r\n            EndFullScreen hwnd\r\n        End If\r\n    End If\r\n \r\nEnd Function\r\n<\/pre>\n<p\/>\n<p\/>\n<p style=\"text-align: justify;\">C\u00f3digo en el Formulario MDI\u00bb<\/p>\n<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nOption Explicit\r\n \r\nPrivate Sub MDIForm_Load()\r\nForm1.Show\r\nEnd Sub\r\n \r\nPrivate Sub MDIForm_Resize()\r\n    If Me.WindowState = vbMaximized Then\r\n        ShowFullScreen Me.hwnd\r\n    Else\r\n        EndFullScreen Me.hwnd\r\n    End If\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Este es un m\u00f3dulo que nos permitir\u00e1 poner un formulario MDI en modo FullScreen cuando est\u00e1 maximizado, la ventaja de esto es ganarle un poco m\u00e1s de espacio al monitor, y sobre todo cuando el software tiene un papel protag\u00f3nico en el PC que lo ejecuta. C\u00f3digo del m\u00f3dulo bas \u00abMdiFullScreen\u00bb Option Explicit Private Declare <a href='https:\/\/leandroascierto.com\/blog\/poner-un-formulario-mdi-en-fullscreen\/' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[5],"class_list":["post-457","post","type-post","status-publish","format-standard","hentry","category-modulos","tag-mdi","category-29-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/leandroascierto.com\/blog\/wp-json\/wp\/v2\/posts\/457","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/leandroascierto.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/leandroascierto.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/leandroascierto.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/leandroascierto.com\/blog\/wp-json\/wp\/v2\/comments?post=457"}],"version-history":[{"count":2,"href":"https:\/\/leandroascierto.com\/blog\/wp-json\/wp\/v2\/posts\/457\/revisions"}],"predecessor-version":[{"id":516,"href":"https:\/\/leandroascierto.com\/blog\/wp-json\/wp\/v2\/posts\/457\/revisions\/516"}],"wp:attachment":[{"href":"https:\/\/leandroascierto.com\/blog\/wp-json\/wp\/v2\/media?parent=457"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/leandroascierto.com\/blog\/wp-json\/wp\/v2\/categories?post=457"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/leandroascierto.com\/blog\/wp-json\/wp\/v2\/tags?post=457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}