I figured since this forum didn't have a FAQ part to it, we should make one, since a lot of questions asked are constantly asked. So here are a few things I came up with. Please feel free to add your own API code that you think would benifit someone else.

How to get a windows HWND
Since many tasks through API can be used on other windows, such as changing a caption or getting a caption, it'd
be important to first now how to obtain the HWND (which is used in most API) of another window. There are two methods
explored below:

Get HWND from caption
This example requires that you know the exact caption of the window, such as 'Untitled' with Notepad.

VB Code:
  1. Option Explicit
  2.  
  3. 'declare API:
  4. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
  5.   (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  6.  
  7. Private Sub Form_Load()
  8. Dim strCaption As String, lhWnd As Long
  9.  
  10.   'Exact caption of the window:
  11.   strCaption = "Untitled - Notepad"
  12.   lhWnd = FindWindow(vbNullString, strCaption)
  13.  
  14.   'if the result is 0, window was not found:
  15.   If lhWnd = 0 Then
  16.     MsgBox "Could not find Notepad..."
  17.   Else
  18.     MsgBox "Notepad found: " & lhWnd
  19.   End If
  20. End Sub

Get HWND from class name
The other method would be to use the window's class name:

VB Code:
  1. Option Explicit
  2.  
  3. 'declare API:
  4. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
  5.   (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  6.  
  7. Private Sub Form_Load()
  8. Dim strClassName As String, lhWnd As Long
  9.  
  10.   'Class Name of the window:
  11.   strClassName = "Notepad"
  12.   lhWnd = FindWindow(strClassName, vbNullString)
  13.  
  14.   'if the result is 0, window was not found:
  15.   If lhWnd = 0 Then
  16.     MsgBox "Could not find Notepad..."
  17.   Else
  18.     MsgBox "Notepad found: " & lhWnd
  19.   End If
  20. End Sub

Bring a window to the top
The following example brings our project form to the top of the Z-order chain. This does NOT make it stay on top. For
Always On Top, see the next example:

VB Code:
  1. Option Explicit
  2.  
  3. 'declare api function:
  4. Private Declare Function BringWindowToTop Lib "user32" _
  5.   (ByVal hwnd As Long) As Long
  6.  
  7. 'this code brings our window to the top every half a second:  
  8. Private Sub Form_Load()
  9.   'setup our timer's interval:
  10.   Timer1.Interval = 500
  11. End Sub
  12.  
  13. Private Sub Timer1_Timer()
  14.   'bring our project to the top:
  15.   BringWindowToTop Me.hwnd
  16. End Sub

Set window to be top most (always on top)
This code will allow you to toggle your window as being always on top or not always on top, as seen in things like AIM
and HTML Help.

VB Code:
  1. Option Explicit
  2.  
  3. 'declare constants:
  4. Private Const HWND_TOPMOST = -1
  5. Private Const HWND_NOTOPMOST = -2
  6.  
  7. Private Const SWP_NOSIZE = &H1
  8. Private Const SWP_NOMOVE = &H2
  9. Private Const SWP_NOACTIVATE = &H10
  10. Private Const SWP_SHOWWINDOW = &H40
  11.  
  12. 'declare API:
  13. Private Declare Sub SetWindowPos Lib "User32" (ByVal hWnd As Long, _
  14.   ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, _
  15.   ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
  16.  
  17. Private Sub Command1_Click()
  18.   'set topmost:
  19.   SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or _
  20.     SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
  21. End Sub
  22.  
  23. Private Sub Command2_Click()
  24.   'set not topmost:
  25.   SetWindowPos Me.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or _
  26.     SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
  27. End Sub
  28.  
  29. Private Sub Form_Load()
  30.   'project requires 2 commandbuttons:
  31.   Command1.Caption = "Top Most"
  32.   Command2.Caption = "Not Top Most"
  33. End Sub

Get/Set Window Caption AND Get Topmost Window
This code will first allow you to get the HWND of the foreground window, or the window with focus. Then it will capture
the title of the window and reverse it.

VB Code:
  1. Option Explicit
  2.  
  3. 'Declare API:
  4. Private Declare Function GetForegroundWindow Lib "user32" () As Long
  5. Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
  6.   (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
  7. Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" _
  8.   (ByVal hwnd As Long, ByVal lpString As String) As Long
  9.  
  10. Private Sub Command1_Click()
  11. Dim lhWnd As Long, strCaption As String
  12.  
  13.   'create our buffer for the caption:
  14.   strCaption = String(100, Chr$(0))
  15.   'get the topmost window:
  16.   lhWnd = GetForegroundWindow()
  17.    
  18.   'get the caption
  19.   GetWindowText lhWnd, strCaption, 100
  20.  
  21.   'clear the buffer:
  22.   strCaption = Left(strCaption, InStr(strCaption, Chr(0)) - 1)
  23.  
  24.   'reverse the string and set the new caption:
  25.   strCaption = StrReverse(strCaption)
  26.   SetWindowText lhWnd, strCaption
  27. End Sub

Set Window Parent
This code, although not pretty, makes the VB form the parent of an instance of notepad, thus making notepad "trapped"
into that window.

VB Code:
  1. Option Explicit
  2.  
  3. 'declare API:
  4. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
  5.   (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  6.  
  7. Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, _
  8.   ByVal hWndNewParent As Long) As Long
  9.  
  10. Private Sub Form_Load()
  11. Dim lhWnd As Long
  12.  
  13.   'Get Notepads HWND:
  14.   lhWnd = FindWindow("Notepad", vbNullString)
  15.  
  16.   'if the result is 0, window was not found:
  17.   If lhWnd = 0 Then
  18.     MsgBox "Could not find Notepad..."
  19.   Else
  20.     'set the parent:
  21.     SetParent lhWnd, Me.hwnd
  22.   End If
  23. End Sub

Execute a file in it's default program
This example opens a text file in notepad (if that's the default program)

VB Code:
  1. Option Explicit
  2.  
  3. 'declare constants:
  4. Private Const SW_SHOWNORMAL = 1
  5.  
  6. 'declare API:
  7. Private Declare Function ShellExecute Lib "shell32.dll" Alias _
  8.   "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
  9.   ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As _
  10.   String, ByVal nShowCmd As Long) As Long
  11.  
  12. Private Sub Form_Load()
  13. Dim lError As Long
  14.  
  15.   'launch C:\movies.txt, given that it exists:
  16.   lError = ShellExecute(Me.hwnd, vbNullString, "C:\movies.txt", vbNullString, _
  17.     "C:\", SW_SHOWNORMAL)
  18.  
  19.   'if returns 2:
  20.   If lError = 2 Then
  21.     MsgBox "File does not exist!"
  22.   End If
  23. End Sub