home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 2692
Discussions: 188,384, Posts: 2,243,501, Members: 232,614
Old December 2nd, 2001, 09:44 PM   Digg it!   #1 (permalink)
Senior Member
 
PonzSpyder's Avatar
 
Join Date: Oct 2001
Location: New Jersey
Posts: 707
Send a message via AIM to PonzSpyder Send a message via Yahoo to PonzSpyder
using DOS commands from VB?

I have seen a lot of programs out there that seem to be using typical DOS and network type commands to run... analogx has a few like NetstatLive and also I am thinking about Netswitcher ( a program for setting different network settings on boot depending on your current network ). I look at these programs and think how I would love to be able to make them, change things i dont like and combine a few features, my question is how??? Is there a way to use and record settings for DOS commands? is this how these programs work?

I know a bit about networking and I have been learning VB, this would really be a great area to start doing some projects in for me! I tried searching a few websites but I havnt found much. Can anyone please give me a few links so that I can learn more about this, please

Edit:

Hmmmm, I just found a site with some sample code and it looks like I am over my head, heh. I wont let it stop me though, I just have something new to learn about now. I thought maybe I could just run a known DOS command and have it write to a text file and then display the results in a form, can I?

Here is what I found that leads me to believe I have a lot more to learn still:

http://1javastreet.com/xq/ASP/txtCod...s/ShowCode.htm

http://1javastreet.com/xq/ASP/txtCod...s/ShowCode.htm
__________________
"It's only after we've lost everything that we're free to do anything"

www.rjponzio.com


Last edited by PonzSpyder : December 2nd, 2001 at 11:20 PM.
PonzSpyder is offline   Reply With Quote
Old December 3rd, 2001, 12:35 AM     #2 (permalink)
Ultimate Member
 
Join Date: Oct 2001
Posts: 21,019
There was a lot of fluff in there
lol just kidding, but what you really want out of that app was the line...

ExecCmdPipe(TabStrip1.SelectedItem.ToolTipText)

Now mind you "TabStrip1.SelectedItem.ToolTipText"

is just getting the text from the tool tip of the selected tab strip.
he's using that to store the command line that he wants to execute, they put it together somewhere else (didn't look for that part)

But really all ya gotta have is ExecCmdPipe("Ping 127.0.0.1")

Me.txtNS = ExecCmdPipe("Ping 127.0.0.1")
This is how you would get the output from ping into a text box...

This is referring to a text box that he is using on the form
Me = simple way to refer to the current form
txtNS is the name of the text box he is using.
They could of named it ShirlyTemple if they really wanted to!

If you open it in a MS VB 6.0 its really not as difficult as it looks
If you have any other questions on what's going on in there feel free to post back


Oh and the stuff on the very top before the first sub, are api calls to start a process, and some "UDT" or User Defined Types ... makes some things easier to keep organized

Hope it helps!!

vass0922 is offline   Reply With Quote
Old December 3rd, 2001, 10:30 AM     #3 (permalink)
Senior Member
 
PonzSpyder's Avatar
 
Join Date: Oct 2001
Location: New Jersey
Posts: 707
Send a message via AIM to PonzSpyder Send a message via Yahoo to PonzSpyder
Thank You vass0922!

I think it is the whole API thing that is getting to me. I have built a few programs already ( calculators & automating MS Office type programs ) but I have not yet delt with these little API things. Also he used a few meathods of writing that I was not used to seeing, I think that was the UDT thing.

PonzSpyder is offline   Reply With Quote
Old December 3rd, 2001, 08:04 PM     #4 (permalink)
Ultimate Member
 
Join Date: Oct 2001
Posts: 21,019
Yep UDT's are nice to keep things organized

You define a type
then declare several types beneath it.


Code:
Private Type PROCESS_INFORMATION
    hProcess As Long
    hThread As Long
    dwProcessId As Long
    dwThreadID As Long
End Type
Now he can easily access information all regarding the same "PROCESS_INFORMATION"

Then when you go into a procedure you can access the info by declaring a variable as UDTName

Dim udtVariable As PROCESS_INFORMATION

udtVariable.hProcess = 34
udtVariable.hThread = 90000
udtVariable.dwProcessId = 45 etc

You can see I got the udtVariable.<look above in the intial declaration>





WHOOPS
Brain fart

The function I mentioned above is a declared function he created , however he does make an api call
Code:
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
then later calls that function

ShellExecute frmMain.hwnd, "Open", "http://www.geocities.com/netviewer2002", 0&, 0&, SW_SHOWMINNOACTIVE


Hmmm interesting...
http://www.vbapi.com/ref/s/shellexecute.html

Some info on that API call....

So I do believe that would be closer to what you would use...

Sorry bout that, maybe I should try reading a little more



--- edit ---
whoops blew out the frames, had to fix it
vass0922 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Most Active Discussions
Is It Just Me? (2896)
CPU wont boot (5)
3-days in and no threads about Gaza (160)
The United States Debt (20)
I think I just killed my computer w.. (24)
Upgrading RAM (5)
hp compaq nc6000 problems (138)
Folderchat Weekday thread (441)
Antec 300 bulk purchase? (11)
Recent Discussions
CPU wont boot (5)
Creative T-3000 Subwoofer (3)
ACPI controller halt on boot (2)
Building a gaming computer advi.. (3)
Worth the upgrade?? (15)
Folderchat Weekday thread (441)
ADVICE (0)
How to increase my ram? (5)
Help with an Ati Radeon HD 4850.. (27)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 10:04 PM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28