Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » VB.NET » HowTo » Downloads
 
Add your own
alternative version

ByPass difficult Automation and add applications "as is" in your .NET application

, 29 Dec 2004 CPOL
Fed up with automation? Need to add components as is to your application? Try this out.
bypassautomation.zip
ByPassAutomation
bin
ByPassAutomation.exe
MasteringAssmblyInfoFile.exe
ByPassAutomation.vbproj.user
interactwithapplications.zip
InteractWithApplications
bin
AxInterop.SHDocVw.dll
GetBrowserDom.exe
InteractWithApplications.exe
Interop.SHDocVw.dll
WindowsApplication2.exe
InteractWithApplications.vbproj.user
Imports System.Reflection
Imports System.Text
Imports System.Runtime.InteropServices
Public Class Win32Functions
    ' Flags of SetWindowPos
    Public Const SWP_FRAMECHANGED As Integer = &H20
    Public Const SWP_NOACTIVATE As Integer = &H10
    Public Const SWP_NOMOVE As Integer = &H2
    Public Const SWP_NOSIZE As Integer = &H1
    Public Const SWP_NOZORDER As Integer = &H4
    Public Const SWP_SHOWWINDOW As Integer = &H40
    Public Const SWP_NOSENDCHANGING As Integer = &H400
    Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As System.IntPtr) As Integer
    Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As System.IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
    Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As System.IntPtr, ByVal nIndex As Integer) As Integer
    Declare Function SetParent Lib "user32" (ByVal hWndChild As System.IntPtr, ByVal hWndNewParent As System.IntPtr) As System.IntPtr
    Declare Function SetWindowPos Lib "user32" (ByVal hwnd As System.IntPtr, ByVal hWndInsertAfter As System.IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
    Declare Ansi Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As IntPtr, ByVal lpClassName As StringBuilder, ByVal nMaxCount As Int32) As Int32
    Delegate Function EnumChildProc(ByVal hWnd As IntPtr, ByRef lParam As IntPtr) As Int32
    Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As IntPtr, ByVal lpEnumFunc As EnumChildProc, ByRef lParam As IntPtr) As Int32
    Declare Ansi Function RegisterWindowMessage Lib "user32" Alias "RegisterWindowMessageA" (ByVal lpString As String) As Int32
    Declare Ansi Function SendMessageTimeout Lib "user32" Alias "SendMessageTimeoutA" (ByVal hWnd As IntPtr, ByVal msg As Int32, ByVal wParam As Int32, ByVal lParam As Int32, ByVal fuFlags As Int32, ByVal uTimeout As Int32, ByRef lpdwResult As Int32) As Int32
    Declare Function ShowWindow Lib "user32" (ByVal hWnd As System.IntPtr, ByVal nCmdShow As Integer) As Boolean
    Public Const SMTO_ABORTIFHUNG As Int32 = &H2

    Public Shared Function removeTitleBarAndRescale(ByVal p As IntPtr)
        Dim dwNewLong As Long = GetWindowLong(p, -16)

        dwNewLong = dwNewLong And (Not &H40000) And (Not &H400000)
        Call SetWindowLong(p, -16, dwNewLong)
    End Function
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Armoghan Asif
Architect
Pakistan Pakistan
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150327.1 | Last Updated 29 Dec 2004
Article Copyright 2004 by Armoghan Asif
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid