Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:
  #1  
Old 10-25-2009, 10:43 AM
ericyeoh ericyeoh is offline
Registered User
 
Join Date: Sep 2009
Posts: 4
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()
Attached Files
File Type: doc hard.doc (36.0 KB, 13 views)
Reply With Quote
  #2  
Old 10-25-2009, 12:23 PM
gibra's Avatar
gibra gibra is offline
Registered User
 
Join Date: Mar 2009
Location: Italy - Breganze (VI)
Posts: 75
http://www.dreamincode.net/forums/showtopic17098.htm

Reply With Quote
  #3  
Old 10-28-2009, 04:37 AM
RobDog888's Avatar
RobDog888 RobDog888 is offline
Super Moderator
 
Join Date: Mar 2005
Location: Los Angeles, Calif. AKA: Gangsta Yoda™
Posts: 454
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
Note: you would want to use the GetSystemDirectory API to dynamically get the directory where the CMD.EXE program is located.

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
A batch file is nothing more then a text file with the DOS commands in it.

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 PostsVS.NET on Vista (New)Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6Outlook Global Address ListAPI Viewer utility •
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT -4. The time now is 10:35 PM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.