Results 1 to 2 of 2

Thread: Help add to this code.

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2005
    Posts
    58

    Help add to this code.

    hey well i basically wanna make the Child window that is open Not appear in the task manager. Also i want the child window to be open'd just by Knowing the name of the .exe not the window name. can i make it open by just the .exe. So if i renamed anyfile it would open it in child window.

    VB Code:
    1. Option Explicit
    2. 'Add a slider control to the project (Slider1)
    3.  
    4. Private Declare Function SetParent Lib "user32" ( _
    5. ByVal hWndChild As Long, _
    6. ByVal hWndNewParent As Long _
    7. ) As Long
    8.  
    9. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
    10. ByVal lpClassName As String, _
    11. ByVal lpWindowName As String _
    12. ) As Long
    13.  
    14. Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" _
    15. (ByVal lpLibFileName As String) As Long
    16.  
    17. Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, _
    18. ByVal lpProcName As String) As Long
    19.  
    20. Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
    21.  
    22. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
    23. (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    24.  
    25. Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, _
    26. ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
    27.  
    28. Private Const GWL_EXSTYLE = (-20)
    29. Private Const WS_EX_LAYERED = &H80000
    30. Private Const LWA_ALPHA = &H2
    31.  
    32. Public Sub AlphaBlendForm(ByVal lhWnd As Long, ByVal intTranslucenceLevel As Integer)
    33.     If APIExists("SetLayeredWindowAttributes", "User32") Then
    34.         SetWindowLong lhWnd, GWL_EXSTYLE, WS_EX_LAYERED
    35.         SetLayeredWindowAttributes lhWnd, 0, intTranslucenceLevel, LWA_ALPHA
    36.     Else
    37.         MsgBox "Your OS does not support Alpha Blending.", vbExclamation, "Alpha Blend"
    38.     End If
    39. End Sub
    40.  
    41. Public Function APIExists(ByVal pstrFunctionName As String, ByVal pstrDllName As String) As Boolean
    42.     Dim lngHandle   As Long
    43.     Dim lngAddr     As Long
    44.     lngHandle = LoadLibrary(pstrDllName)
    45.     If Not (lngHandle = 0) Then
    46.         lngAddr = GetProcAddress(lngHandle, pstrFunctionName)
    47.         FreeLibrary lngHandle
    48.     End If
    49.     APIExists = Not (lngAddr = 0)
    50. End Function
    51.  
    52. Private Sub Command1_Click()
    53. Dim lhWnd As Long
    54.  'get handle to notepad
    55.  lhWnd = FindWindow(vbNullString, "Untitled - Notepad")
    56.  'if not open, launch Notepad
    57.  If lhWnd = 0 Then
    58.     Shell "notepad.exe"
    59.     lhWnd = FindWindow(vbNullString, "Untitled - Notepad")
    60.  End If
    61.  'make it a child
    62.  Call SetParent(lhWnd, Me.hwnd)
    63. End Sub
    64.  
    65.  
    66. Private Sub Form_Load()
    67. AlphaBlendForm Me.hwnd, 190 'MAX VALUE = OPAIC/ MIN VALUE = 0 CANT SEE
    68. End Sub
    69.  
    70. Private Sub Slider1_Scroll()
    71.     AlphaBlendForm Me.hwnd, Slider1.Value
    72. End Sub

  2. #2

    Thread Starter
    Member
    Join Date
    Jan 2005
    Posts
    58

    Re: Help add to this code.

    Anyone Help me?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width