Learn how to a build a cloud-first strategyRegister Now


How to make my form a desktop window

Posted on 2007-10-18
Medium Priority
Last Modified: 2010-04-23
Hi, I want to ask how can I make my form in visual basic become a desktop windows. Cause I want to make a shell replacement for windows. Does any body know how to make it? Thank you.
Question by:zmartnet

Expert Comment

ID: 20105780
The form is a desktop windows without the need of doing nothing special.
What kind of Form do you want? a MDI form for multiple documents?
LVL 15

Accepted Solution

JackOfPH earned 2000 total points
ID: 20105946
here you go...

Option Explicit

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

Private Const GW_CHILD = 5
Private Sub Form_Load()
    Dim lngHandle As Long
    lngHandle = FindWindow("ProgMan", vbNullString)
    lngHandle = GetWindow(lngHandle, GW_CHILD)
    lngHandle = GetWindow(lngHandle, GW_CHILD)
    Call SetParent(Me.hwnd, lngHandle)
End Sub

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month21 days, 7 hours left to enroll

810 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