Avatar billede Slettet bruger
05. oktober 2001 - 08:30 Der er 10 kommentarer og
1 løsning

Help.. skal have en fil til at eksekvere et dos program

Hejsa.. jeg skal have eksekveret et dos program så som tlntadmn.exe i win2k, og under dette skal den starte telnet services, med \"4\" jeg kan ikke rigtigt lavet det så det virker.. nogen som kan hjælpe?
Avatar billede terry Ekspert
05. oktober 2001 - 08:35 #1
shell or shellexe
Avatar billede terry Ekspert
05. oktober 2001 - 08:36 #2
Place th efolllowing in a module:

Public 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


Public Const SW_HIDE = 0
Public Const SW_SHOW = 5

Then this is how you use it.

        result = ShellExecute(0, \"Open\", \"PathAndName\", \"\", \"Path\", SW_SHOW)

Avatar billede Slettet bruger
05. oktober 2001 - 08:37 #3
tester det lige :o)..he
Avatar billede terry Ekspert
05. oktober 2001 - 08:37 #4
And we are talking VB and NOT vbs
Avatar billede Slettet bruger
05. oktober 2001 - 08:42 #5
yep.., but where do the option 4 come in??
Avatar billede Slettet bruger
05. oktober 2001 - 08:46 #6
When I run tlntadmn.exe I get this:

0) Quit this application
1) List the current users
2) Terminate a user session ...
3) Display / change registry settings ...
4) Start the service
5) Stop the service

Type an option number [0 - 5] to select that option:

Then i have to select option number 4.. how do I do this?
Avatar billede terry Ekspert
05. oktober 2001 - 08:51 #7
its empty!
Have you declared the function?
Public 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


Avatar billede terry Ekspert
05. oktober 2001 - 08:51 #8
Avatar billede Slettet bruger
05. oktober 2001 - 08:53 #9
I have no ideer of what you do mean.. how do I select the option 4 so that the service start
Avatar billede Slettet bruger
05. oktober 2001 - 09:07 #10
forget it
Avatar billede terry Ekspert
05. oktober 2001 - 09:14 #11
Option 4 CAN BE EMPTY!

This code MUST be placed in a module.


Public 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


Public Const SW_HIDE = 0
Public Const SW_SHOW = 5


and then you call the function like this:

result = ShellExecute(0, \"Open\", \"PathAndName\", \"\", \"Path\", SW_SHOW)

YOU have to replace PathAndName with the FULL path and file name for example: \"C:\\temp\\runme.exe\"
and you also have to replace path with \"C:\\TEMP\"
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester