Create a program to install programs
Create a program to install programs
Create a program to install programs
Create a program to install programs
Create a program to install programs
Create a program to install programs Create a program to install programs Create a program to install programs Create a program to install programs Create a program to install programs Create a program to install programs Create a program to install programs Create a program to install programs
Create a program to install programs Create a program to install programs
Create a program to install programs
Go Back  Xtreme Visual Basic Talk > > > Create a program to install programs


Reply
 
Thread Tools Display Modes
  #1  
Old 08-07-2011, 02:29 AM
--crafter-- --crafter-- is offline
Newcomer
 
Join Date: Jun 2011
Posts: 16
Post Create a program to install programs


Hello,

I would like to create a program that would install a program depending on the checkbox selected. Does anyone have any idea where to start with this?

Thanks in advance.
Reply With Quote
  #2  
Old 08-07-2011, 10:52 AM
Roger_Wgnr's Avatar
Roger_Wgnr Roger_Wgnr is offline
CodeASaurus Hex

Forum Leader
* Expert *
 
Join Date: Jul 2006
Location: San Antonio TX
Posts: 2,427
Default

I use NSIS (Nullsoft Scriptable Install System) but any installer would work.
Inno Setup

It is always best to use the tool for the job.
Installers were developed to install programs.

Unelss I am not understanding your issue.
__________________
Code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. ~Martin Golding
The user is a peripheral that types when you issue a read request. ~Peter Williams
MSDN Visual Basic .NET General FAQ
Reply With Quote
  #3  
Old 08-07-2011, 04:56 PM
xer0syk0 xer0syk0 is offline
Centurion
 
Join Date: Oct 2004
Posts: 145
Default

Are you talking about something like this: http://ninite.com/?

If you want to make an application that automates other software installers, you can try looking into pinvoke methods such as FindWindow and Postmessage.

Here's an example of what I'm talking about:
Code:
Module mdlAPI Public Declare Auto Function PostMessage Lib "user32" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer <DllImport("user32.dll")> _ Public Function GetMenu(ByVal hWnd As IntPtr) As IntPtr End Function <DllImport("user32.dll")> _ Public Function GetSubMenu(ByVal hMenu As IntPtr, ByVal nPos As Integer) As IntPtr End Function <DllImport("user32.dll")> _ Public Function GetMenuItemID(ByVal hMenu As IntPtr, ByVal nPos As Integer) As UInteger End Function <DllImport("user32.dll")> _ Public Function EnableMenuItem(ByVal hMenu As IntPtr, ByVal wIDEnableItem As UInteger, ByVal wEnable As UInteger) As IntPtr End Function <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _ Private Function FindWindow( _ ByVal lpClassName As String, _ ByVal lpWindowName As String) As IntPtr End Function <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _ Private Function FindWindowEx(ByVal parentHandle As IntPtr, _ ByVal childAfter As IntPtr, _ ByVal lclassName As String, _ ByVal windowTitle As String) As IntPtr End Function <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _ Public Function GetWindowTextLength(ByVal hwnd As IntPtr) As Integer End Function <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _ Public Function GetWindowText(ByVal hwnd As IntPtr, ByVal lpString As String, ByVal cch As Integer) As Integer End Function <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _ Public Function GetWindow(ByVal hWnd As IntPtr, ByVal uCmd As UInt32) As IntPtr End Function 'Constants Private Const GW_HWNDFIRST As Integer = 0 Private Const GW_HWNDNEXT As Integer = 2 Private Const WM_COMMAND As Integer = &H111 Private Const BM_CLICK As Integer = &HF5 Private Const WM_CLOSE As Integer = &H10 Private Const MF_GRAYED As Integer = &H1 Public Function FindWindowLike(ByVal sText As String) As IntPtr Dim lHandle As IntPtr Dim lTextLength As Integer Dim sWText As String Dim bContinue As Boolean ' Default returns zero FindWindowLike = 0 ' Find the first window lHandle = FindWindow(vbNullString, vbNullString) bContinue = True ' Start looping Do While bContinue And lHandle <> 0 ' Get the textlength of the window lTextLength = GetWindowTextLength(lHandle) sWText = Space(lTextLength) ' Get the text GetWindowText(lHandle, sWText, lTextLength + 1) ' If the text we search is in the windowtext then return the handle ' and stop looping. (Searching case INsensitive here) If InStr(1, UCase(sWText), UCase(sText)) Then FindWindowLike = lHandle bContinue = False End If ' Get the next window lHandle = GetWindow(lHandle, GW_HWNDNEXT) Loop End Function End Module

This code will find a Notepad window and click on one of it's menu items:
Code:
'Find our window Dim mainWin_hWnd As IntPtr = IntPtr.Zero 'Wait for it to appear While (mainWin_hWnd = IntPtr.Zero) mainWin_hWnd = FindWindowLike("Notepad") End While 'Get the handle of the window's menu Dim hMenu As IntPtr = GetMenu(mainWin_hWnd) 'Get the handle of the window's submenu Dim hSubMenu As IntPtr = GetSubMenu(hMenu, 0) 'Get third item of submenu (index 2) Dim lngID As UInteger = GetMenuItemID(hSubMenu, 2) 'WM_COMMAND is sent when a menu item is selected. Use WM_COMMAND instead of BM_CLICK; remember this! 'Pass MenuItemID as first parameter, pass original menu (top) as second PostMessage(mainWin_hWnd, WM_COMMAND, lngID, hMenu)

Basically, you'll need to use PostMessage with BM_CLICK after finding the handle of the checkbox control on the target window. You can modify the code above to search for particular elements to get what you need.
Reply With Quote
  #4  
Old 08-09-2011, 02:00 AM
--crafter-- --crafter-- is offline
Newcomer
 
Join Date: Jun 2011
Posts: 16
Default

Yes i would like to create my own installer. kinda like ninite.

Thanks guys
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Create a program to install programs
Create a program to install programs
Create a program to install programs Create a program to install programs
Create a program to install programs
Create a program to install programs
Create a program to install programs Create a program to install programs Create a program to install programs Create a program to install programs Create a program to install programs Create a program to install programs Create a program to install programs
Create a program to install programs
Create a program to install programs
 
Create a program to install programs
Create a program to install programs
 
-->