Results 1 to 7 of 7

Thread: Createdirectiory

  1. #1
    Blacknight
    Guest

    Createdirectiory

    I found this one in the api veiwer tool.
    It requirs :
    1.pathname-easy
    2.SECURITY_ATTRIBUTES
    what do i write in the second one?
    Public Type SECURITY_ATTRIBUTES
    nLength As Long
    lpSecurityDescriptor As Long
    bInheritHandle As Long
    End Type

  2. #2
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    AS I put in your thread in General VB

    Why not use MkDir

    anyway answering ur question:
    VB Code:
    1. Private Declare Function CreateDirectory Lib "kernel32.dll" Alias "CreateDirectoryA" (ByVal lpPathName As String, lpSecurityAttributes As SECURITY_ATTRIBUTES) As Long
    2. Private Type SECURITY_ATTRIBUTES
    3.         nLength As Long
    4.         lpSecurityDescriptor As Long
    5.         bInheritHandle As Long
    6. End Type
    7. Private Sub Form_Load()
    8. Dim secAttr As SECURITY_ATTRIBUTES  ' security attributes structure
    9. Dim retval As Long  ' return value
    10. secAttr.nLength = Len(secAttr)  ' size of the structure
    11. secAttr.lpSecurityDescriptor = 0  ' default (normal) level of security
    12. secAttr.bInheritHandle = 1  ' this is the default setting
    13.  
    14. ' Create the directory.
    15. retval = CreateDirectory("C:\NewDir", secAttr)
    16. End Sub

  3. #3
    Megatron
    Guest
    da_silvy, since we're not really using SECURITY_ATTRIBUTES structure, you can shorten you code to this:
    VB Code:
    1. Private Declare Function CreateDirectory Lib "kernel32.dll" Alias "CreateDirectoryA" (ByVal lpPathName As String, lpSecurityAttributes As Any) As Long
    2.  
    3. Private Sub Command1_Click()
    4.     CreateDirectory "C:\NewDir", 0
    5. End Sub

  4. #4
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Cool,

    Where can i find out more about the API and it's functions?

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

  6. #6
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    And MSDN is the best, but it's not aimed at VB.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  7. #7
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    I know those sites,

    That's where i got the ^^^ above example.

    I wanted sites which cut to the chase

    etc.

    MSDN is good, if you can work out how to put C++ in VB

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