PDA

View Full Version : ساخت Autorun



IamOverlord
سه شنبه 18 اسفند 1388, 23:54 عصر
سلام دوستان!
من یه اتوران ساختم. تنها مشکلش اینه که بعضی Widnows ها کنترل Rich Text Box یا RICHTX32.OCX رو ندارن. (:متعجب:!)
بهترین راه حل این مشکل چیه؟ یعنی تو همه ی Windows ها جواب بده.
ضمنا نمی خوام واسه برنامه ام که تو CD هست فایل نصب بسازیم.

IamOverlord
چهارشنبه 19 اسفند 1388, 01:02 صبح
سلام دوستان!
خودم راهش رو پیدا کردم :

Option Explicit

Private Declare Function CopyFile Lib "kernel32" _
Alias "CopyFileA" (ByVal lpExistingFileName As String, _
ByVal lpNewFileName As String, ByVal bFailIfExists As Long) _
As Long



Public Function APIFileCopy(src As String, dest As String, _
Optional FailIfDestExists As Boolean) As Boolean

'PURPOSE: COPY FILES
'PARAMETERS: src: Source File (FullPath)
'dest: Destination File (FullPath)Public Function APIFileCopy(src As String, dest As String, _
Optional FailIfDestExists As Boolean) As Boolean

'PURPOSE: COPY FILES
'PARAMETERS: src: Source File (FullPath)
'dest: Destination File (FullPath)
'FailIfDestExists (Optional):
'Set to true if you don't want to
'overwrite the destination file if
'it exists

'Returns (True if Successful, false otherwise)

'EXAMPLE:
'dim bSuccess as boolean
'bSuccess = APIFileCopy ("C:\MyFile.txt", "D:\MyFile.txt")

Dim lRet As Long
lRet = CopyFile(src, dest, FailIfDestExists)
APIFileCopy = (lRet > 0)

End Function
'FailIfDestExists (Optional):
'Set to true if you don't want to
'overwrite the destination file if
'it exists

'Returns (True if Successful, false otherwise)

'EXAMPLE:
'dim bSuccess as boolean
'bSuccess = APIFileCopy ("C:\MyFile.txt", "D:\MyFile.txt")

'Dim lRet As Long
'lRet = CopyFile(src, dest, FailIfDestExists)
'APIFileCopy = (lRet > 0)

'End Function




بعد با این Module فایل RICHTX32.OCX که از قبل کنار برنامه است رو تو "Environ("WidDir")+"\System32 کپی می کنیم.

با تشکر
:چشمک: