Discussion:
½Ð°Ý¦p¦óÅý shell ©Ò°õ¦æªº¬Y¤@ Dos ¤Uªºµ{¦¡ ¡A°õ¦æ¹Lµ{¤@ª½§ó·s°T®§¦b Form ¤º©O¡H
(时间太久无法回复)
Bruce_Wu
2004-06-19 08:51:04 UTC
Permalink
½Ð°Ý¦p¦óÅý shell ©Ò°õ¦æªº¬Y¤@ Dos ¤Uªºµ{¦¡ ¡A°õ¦æ¹Lµ{¤@ª½§ó
·s°T®§¦b Form ¤º©O¡H

¦p¡G °õ¦æ WinRAR À£ÁYµ{¦¡¡AÀ£
EricTsai - œ²©v¿«
2004-06-19 16:30:01 UTC
Permalink
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim t As Thread = New Thread(AddressOf RAR)
t.Start()
End Sub


Sub RAR()
Dim p As System.Diagnostics.Process = New System.Diagnostics.Process
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.FileName = "C:\Program Files\WinRAR\rar.exe"
p.StartInfo.Arguments = "a C:\system32.rar C:\Windows\system32\*.*"
p.Start()
Dim s As String
Do
s = p.StandardOutput.ReadLine()
If Not IsNothing(s) Then ListBox1.Items.Add(s)
Loop
p.WaitForExit()
End Sub
·s°T®§Šb Form €º©O¡H
Šp¡G °õŠæ WinRAR À£ÁYµ{Š¡¡AÀ£ÁY¹Lµ{·|šqŠb Form €ºªº¡H
Thanks~
Bruce_Wu
2004-06-21 00:56:30 UTC
Permalink
·PÁ±zªº¦^´_¡ã
¦ý·Q½Ð±Ð±z¡ã
¦b ½sĶ®É·|¥X²{¿ù»~¡ã
¿ù»~¦æ¡GDim t As Thread = New Thread(AddressOf RAR)
¿ù»~°T®§¬°¡G «¬§O Thread ¥¼©w¸q

¶¶±a°Ý¤@­Ó°ÝÃD¡G

Private Declare Function ChangeDisplaySettings
Lib "user32" _
Alias "ChangeDisplaySettingsA" _
(lpDevMode As Any, _
ByVal dwflags As Long) As Long

³o¦b VB6 ¤¤¥i¥H¥¿±`

¦ý¬O¦b VB .Net ¤¤ ½sĶ®É´N·|¥X²{
«¬ºA Any ¥¼³Q©w¸q

Thanks~
-----­ì©l¶l¥ó-----
Private Sub Button2_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim t As Thread = New Thread(AddressOf RAR)
t.Start()
End Sub
Sub RAR()
Dim p As System.Diagnostics.Process = New
System.Diagnostics.Process
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.FileName = "C:\Program
Files\WinRAR\rar.exe"
p.StartInfo.Arguments = "a C:\system32.rar
C:\Windows\system32\*.*"
p.Start()
Dim s As String
Do
s = p.StandardOutput.ReadLine()
If Not IsNothing(s) Then ListBox1.Items.Add(s)
Loop
p.WaitForExit()
End Sub
¥ó·s»D
ª½§ó
Post by Bruce_Wu
·s°T®§¦b Form ¤º©O¡H
¦p¡G °õ¦æ WinRAR À£ÁYµ{¦¡¡AÀ£ÁY¹Lµ{·|¨q¦b Form ¤ºªº¡H
Thanks~
.
EricTsai - œ²©v¿«
2004-06-21 01:19:42 UTC
Permalink
³Ì«e­±­nImports System.Threading
²Ä€G­Ó°ÝÃDœÐ±zŠÛŠæ°ÑŠÒ¬Ý¬Ýhttp://vbcity.com/forums/topic.asp?tid=2371

"Bruce_Wu" <***@discussions.microsoft.com> Œ¶Œg©ó¶l¥ó·s»D
:1f14e01c4572a$97184690$***@phx.gbl...
·PÁ±zªºŠ^Ž_¡ã
Šý·QœÐ±Ð±z¡ã
Šb œsĶ®É·|¥X²{¿ù»~¡ã
¿ù»~Šæ¡GDim t As Thread = New Thread(AddressOf RAR)
¿ù»~°T®§¬°¡G «¬§O Thread ¥Œ©wžq

¶¶±a°Ý€@­Ó°ÝÃD¡G

Private Declare Function ChangeDisplaySettings
Lib "user32" _
Alias "ChangeDisplaySettingsA" _
(lpDevMode As Any, _
ByVal dwflags As Long) As Long

³oŠb VB6 €€¥i¥H¥¿±`

Šý¬OŠb VB .Net €€ œsĶ®ÉŽN·|¥X²{
«¬ºA Any ¥Œ³Q©wžq

Thanks~
-----­ì©l¶l¥ó-----
Private Sub Button2_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim t As Thread = New Thread(AddressOf RAR)
t.Start()
End Sub
Sub RAR()
Dim p As System.Diagnostics.Process = New
System.Diagnostics.Process
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.FileName = "C:\Program
Files\WinRAR\rar.exe"
p.StartInfo.Arguments = "a C:\system32.rar
C:\Windows\system32\*.*"
p.Start()
Dim s As String
Do
s = p.StandardOutput.ReadLine()
If Not IsNothing(s) Then ListBox1.Items.Add(s)
Loop
p.WaitForExit()
End Sub
¥ó·s»D
ªœ§ó
·s°T®§Šb Form €º©O¡H
Šp¡G °õŠæ WinRAR À£ÁYµ{Š¡¡AÀ£ÁY¹Lµ{·|šqŠb Form €ºªº¡H
Thanks~
.
Bruce_Wu
2004-06-21 01:40:46 UTC
Permalink
Sorry~
¦]¬°§Ú¬O·s¤â¡A©Ò¥H¤£ª¾¹D­n±N©R¦WªÅ¶¡µ¹ Imports ¶i¨Ó
²{¦b¤w¸g¥i¥H¤F¡ãÁÂÁ¡ã
¦ý¦³2­Ó°ÝÃD¡ã
1.°õ¦æ®É¥i¥HÅý¥L¤£·|¥X²{ dos ªºµøµ¡¶Ü?
2.°õ¦æ§¹²¦«á«ö¤U¦¹ Windows From ¥k¤WÃ䪺 ¡uÃö³¬¡v«á
µ{¦¡ÁÙ¬O¦b¨t²Îªº³B²zµ{§Ç¤º¡A½Ð°Ý¸Ó©M¸Ñ¨M©O¡H

·PÁ¡ã
-----­ì©l¶l¥ó-----
³Ì«e­±­nImports System.Threading
²Ä¤G­Ó°ÝÃD½Ð±z¦Û¦æ°Ñ¦Ò¬Ý¬Ý
http
EricTsai - œ²©v¿«
2004-06-21 16:11:09 UTC
Permalink
1. p.StartInfo.WindowStyle=System.Diagnostics.ProcessWindowStyle.Hidden
2. ±Ntªº«Å§i²ŸšìClass Level¥h¡AŠbFormªºClosingšÆ¥ó°µt.Abort()
Post by Bruce_Wu
Sorry~
Š]¬°§Ú¬O·s€â¡A©Ò¥H€£ªŸ¹D­n±N©RŠWªÅ¶¡µ¹ Imports ¶išÓ
²{Šb€wžg¥i¥H€F¡ãÁÂÁ¡ã
ŠýŠ³2­Ó°ÝÃD¡ã
1.°õŠæ®É¥i¥HÅý¥L€£·|¥X²{ dos ªºµøµ¡¶Ü?
2.°õŠæ§¹²Š«á«ö€UŠ¹ Windows From ¥k€WÃ䪺 ¡uÃö³¬¡v«á
µ{Š¡ÁÙ¬OŠbšt²Îªº³B²zµ{§Ç€º¡AœÐ°ÝžÓ©MžÑšM©O¡H
·PÁ¡ã
-----­ì©l¶l¥ó-----
³Ì«e­±­nImports System.Threading
²Ä€G­Ó°ÝÃDœÐ±zŠÛŠæ°ÑŠÒ¬Ý¬Ý
http://vbcity.com/forums/topic.asp?tid=2371
Bruce_Wu
2004-06-23 01:21:11 UTC
Permalink
·PÁ±zªº¦^´_¡ã
1.¤w¸g¦bsub RAR ¤º¥[¤J p.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Hidden ¦ý¬O¡A°õ¦æÁÙ¬O
·|¥X²{ dos ªºµøµ¡¡A°õ¨ì°õ¦æµ²§ô

2.¤w¸g¸Ñ¨M¡ã

·s°ÝÃD¡ã
1.½Ð°Ý¥i§_ÅýÄdºI¥X¨Ó¦b¤º®e¡AÅã¥Ü¦b ListBox1 ®É¡AListBox1 ªº
¬O·|°±¦b³Ì¤U­±¤@¦æ¡C

2.§Ú·Q­n³]©w¦¨©T©w¨C 10 ¤ÀÄÁ·|°õ¦æ¤@¦¸À£ÁY¤@¦¸¡A¬G§Úªº§@ªk
¬°¡A©Ô¤@­Ó Timer ¦b Timer1.Tick ªº Sub ¤º©ñ¤@­Ó t.Start()
¦ý¬O¡A³£·|¥X²{¿ù»~¡A¿ù»~°T®§¦p¤U¡G
±zªºÀ³¥Îµ{¦¡µo¥ÍµLªk³B²zªº¨Ò¥~ª¬ªp¡C¦pªG±z«ö¤@¤U¡u½T©w¡v¡A
À³¥Îµ{¦¡·|©¿²¤¿ù»~¹Á¸ÕÄ~Äò¡C¦pªG±z«ö¤@¤U¡uµ²§ô¡v¡A«h·|¥ß§Y
Ãö³¬À³¥Îµ{¦¡¡C
°õ¦æºü¥¿¦b°õ¦æ©Î¤w¸g²×¤î; µLªk­«·s±Ò°Ê¡C

½Ð°Ý³o¬O¤°»ò°ÝÃD©O¡H¸Ó¦p¸Ñ¨M©O¡H

Thanks~
-----­ì©l¶l¥ó-----
1.
p.StartInfo.WindowStyle=System.Diagnostics.ProcessWindowSty
le.Hidden
2. ±Ntªº«Å§i²¾¨ìClass Level¥h¡A¦bFormªºClo
EricTsai - œ²©v¿«
2004-07-19 14:09:21 UTC
Permalink
p.StartInfo.CreateNoWindow=true;
Post by EricTsai - œ²©v¿«
·PÁ±zªºŠ^Ž_¡ã
1.€wžgŠbsub RAR €º¥[€J p.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Hidden Šý¬O¡A°õŠæÁÙ¬O
·|¥X²{ dos ªºµøµ¡¡A°õšì°õŠæµ²§ô
2.€wžgžÑšM¡ã
·s°ÝÃD¡ã
1.œÐ°Ý¥i§_ÅýÄdºI¥XšÓŠb€º®e¡AÅã¥ÜŠb ListBox1 ®É¡AListBox1 ªº
Šý¬O¡A³£·|¥X²{¿ù»~¡A¿ù»~°T®§Šp€U¡G
Ãö³¬À³¥Îµ{Š¡¡C
°õŠæºü¥¿Šb°õŠæ©Î€wžg²×€î; µLªk­«·s±Ò°Ê¡C
œÐ°Ý³o¬O€°»ò°ÝÃD©O¡HžÓŠpžÑšM©O¡H
Thanks~
-----­ì©l¶l¥ó-----
1.
p.StartInfo.WindowStyle=System.Diagnostics.ProcessWindowSty
le.Hidden
2. ±Ntªº«Å§i²ŸšìClass Level¥h¡AŠbFormªºClosingšÆ¥ó°µ
t.Abort()
Bruce_Wu
2004-06-23 01:24:44 UTC
Permalink
¹ï¤F¡A¤W¤@«ÊÁÙ¦³¤@­Ó°ÝÃD¡A¨º´N¬O
¨Ï¥Î Abort µ²§ô°õ¦æ§Ç¡A
Bruce_Wu
2004-06-30 07:07:01 UTC
Permalink
½ÐÀ°¦£¬Ý¤@¤U¡ã«e¨â«Êªº¤º®e¡ã

¥Ø«e¤p§Ì¤w¸gµL¸Ñ¤F¡ã

T
Microsoft Community Star(Taiwan & HK)--Ken Lin
2004-06-30 07:44:50 UTC
Permalink
Dear Bruce_Wu,

I think that you have to create one Windows Service Component and then call
this Component from Dos Application and also throw message to Message Queue
and then keep monitor in this message queue to read the new message.

Also, there are many other way to do so.
This is related to your applications design and pattern. You may have to
rewrite your application or re-design it.
--
--------Hope this may help you--------
Regards,
·L³nªÀžs€§¬P
Microsoft(Taiwan & Hong Kong) Community Star
³sÀA¶¯Ken Lin(HK)
Vice President of Hong Kong .NET User Group(www.hknetug.com)
MCP, MCP+I, MCDST, MCSA, MCSE(NT4 & Win2K), MCSE+I,
MCDBA(SQL7 & SQL2K), MCSD(VB6, VB.NET), MCAD(VB.NET)
MCT2004

Åý§Ú­Ì§â·L³n§K¶O§Þ³NªA°È¶Ç¥X¥h
šÓŠÛ·L³n§Þ³NªÀžs(Technical Communities)¡AšSŠ³ªÅ¶¡­­šîªº§K¶O§Þ³N€äŽ©ªA°È !

¡u¥Î€ß¡v€~¥i¥Hµo²{¡B¡uŒç¯à¡v€~·|µL­­
=========================================================================
¥Ø«e€p§Ì€wžgµLžÑ€F¡ã
Thanks~
继续阅读narkive:
Loading...