|
#1
|
|||
|
|||
|
VB command prompt
Guy, I have no idea how to use VB6.0 to open command prompt and type this string in the command prompt
Bin2text test.jpg test.text 200 vbCrLf After that i want to drag this test.text entire character into a sting and display out in text box_change() |
|
#2
|
||||
|
||||
|
__________________
HTH ![]() VBCorner code: MenuCreator add-in + MenuExtended.dll - SaveToFolder add-in - my PSC code: CommonDialog Enhanced Callback - Enumerate Icon Resources - Network Change TCP/IP |
|
#3
|
||||
|
||||
|
You can pass the DOS commands directly. Then output the results to a file.
This example will pass the DIR command, enter C:\, and output the directory listing to the file C:\Dir.txt The /K switch is to keep the DOS window open but you can change it to the /C to close it. Also, SW_HIDE to make it totally transparent to the user. Code:
Option Explicit
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
Private Const SW_HIDE As Long = 0
Private Const SW_SHOWNORMAL As Long = 1
Private Sub Command1_Click()
ShellExecute Me.hwnd, "Open", "C:\Windows\System32\CMD.exe", " /K Dir C:\ > C:\Dir.txt", "C:\", SW_SHOWNORMAL
End Sub
Another is to simply shell out your batch file like in the above example except instead of the DOS commands you place the file path to your batch file. Code:
ShellExecute Me.hwnd, "Open", "C:\Windows\System32\CMD.exe", "C:\MyBatchFile.bat", "C:\", SW_SHOWNORMAL Sample: Code:
Dir C:\ > C:\Dir.txt
__________________
VB/Office Guru™ (AKA: Gangsta Yoda™ I dont answer code questions via PMs. ![]() Microsoft MVP 2006 & 2007 Office Development FAQ (VBA, VB 6, VB.NET, C#) Software Developer MCP (VB 6 & .NET) • Save Ana • Reps & Rating Posts • VS.NET on Vista (New) • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • Outlook Global Address List • API Viewer utility • |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| VB as a career choice? | steve | Careers | 8 | 08-08-2008 10:46 AM |
| Told you so.... C# replacing VB | Bob | .NET | 44 | 06-06-2008 05:39 AM |
| re: moving from VB to C# -- more reasons | Jeff Johnson | .NET | 6 | 01-18-2007 08:44 AM |
| .NET vs. Enterprise Java: Who's Got Better Security? | Glen Kunene | Talk to the Editors | 17 | 03-23-2002 01:43 AM |
| VB 6 does not get error from RAISERROR in SQL stored procdure | Allison Boughton | VB Classic | 6 | 03-05-2001 01:27 PM |