Results 1 to 3 of 3

Thread: Making external calls or API

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Location
    USA
    Posts
    6
    Currently I am writing disk images to floppy with batch files to do installation routines. To write the disk image I use DITU.exe. I want to put this into a windows format and program it in VB.

    Can I call external batch files and executables to use in my VB program or should I be using API's? I have not been able to find any information on using .exe, batch files or dos type commands.

    Is there an API to to format a 1.44" floppy and make it bootable?

    Any help would be appreciated!

  2. #2
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    258
    Visual Basic 6 SP4 on win98se

    QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!

  3. #3
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    To format a floppy:
    Code:
    Const SHFD_CAPACITY_DEFAULT = 0 ' default drive capacity
    Const SHFD_CAPACITY_360 = 3 ' 360KB, applies to 5.25" drives only
    Const SHFD_CAPACITY_720 = 5 ' 720KB, applies to 3.5" drives only
    Const SHFD_FORMAT_QUICK = 0 ' quick format
    Const SHFD_FORMAT_FULL = 1 ' full format
    Const SHFD_FORMAT_SYSONLY = 2 ' copies system files only (Win95 Only!)
    Private Declare Function SHFormatDrive Lib "shell32" (ByVal hwndOwner As Long, ByVal iDrive As Long, ByVal iCapacity As Long, ByVal iFormatType As Long) As Long
    Private Sub Form_Load()
        'iDrive = The drive number to format. Drive A=0, B=1 (if present, otherwise C=1), and so on.
        SHFormatDrive Me.hwnd, 0, SHFD_CAPACITY_DEFAULT, SHFD_FORMAT_QUICK
        SHFormatDrive Me.hwnd, 0, SHFD_CAPACITY_DEFAULT, SHFD_FORMAT_SYSONLY
    End Sub
    To execute an external app:

    Code:
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    Const SW_SHOWNORMAL = 1
    Private Sub Form_Load()
      ShellExecute Me.hwnd, "open", "notepad.exe", vbNullString, "C:\WINDOWS", SW_SHOWNORMAL
    End Sub

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