|
Hi!
I have a program that only runs the way I want it to from cmd line. Such as:
> myprogram "c:\mydirectory\file.dll"
Now, I want to automate running this program against a lot of dll's so the argument in the cmd line is bound to change. And the other thing is, I need to parse the output of the program dumped to standard out. So essentially, what would be great is if i can call something like:
> myprogram "c:\mydirectory\file.dll" > output.txt
I have the following code so far
---------------------------------------------------
Dim p As New Process()
Dim p_info As New ProcessStartInfo()
p_info = p_info.RedirectStandardOutput = False
p_info.UseShellExecute = True
p_info.FileName = "myprogram.exe"
p_info.Arguments = "c:\mydirectory\file.dll"
p.Start(p_info)
---------------------------------------------------
I tried setting UseShellExecute to false and for some reason, myprogram doesn't launch properly.
I can't have UseShellExecute and RedirectStandardOutput both true. So how do I accomplish getting this standard out?
Thanks for the help!
|
|
|
|
|
never mind
i found how it works
http://www.devx.com/dotnet/Article/7914/0/page/5
|
|
|
|
|
Hi,
I'm having a little problem sorting a 2 dimensional array, and I was wondering if someone could help. I want to sort the information in my array in decending numerical order. An example of my information is as follows: -
[50] [Bananas]
[10] [Lemons]
[30] [Oranges]
[100] [Apples]
I'd like it to sort the information from highest to lowest.
I'm using VB6, is this possible? Any help would be much appreciated.
Cheers
Ben
|
|
|
|
|
I'm afraid that there's no quick to way to do this, you'd have to do some coding. The best way, of course, if to implement a bubble sort through the first dimension, and change the second dimension accordingly
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
I always sort arrays using For loops. It might be a little slow for large arrays, but it always works for me:
Dim myNewArray() As String, q As Integer, r As Integer, s As Integer, t As Integer
ReDim myNewArray(UBound(myOldArray, 0), UBound(myOldArray, 1))
r = 9999999 'Just a big number (bigger than the biggest number in your array)
s = 0
For q = 0 To UBound(myOldArray, 0)
If myOldArray(q, 0) <= r Then
For t = 0 To UBound(myOldArray, 1)
myNewArray(s, t) = myOldArray(q, t)
Next
s = s + 1
r = myOldArray(q, 0)
End If
Next
I haven't tested this code, since I don't have VB6 installed at the place I currently am, but it should work. Just replace myOldArray by your array. You could even put this in a function, returning a String() .
"Make peace, not war"
|
|
|
|
|
I've a problem when using a command control in a form who is linked to a code that opens a executable program (Windows Media Player) and a Mp3's file. The Mp3's file is located in a folder that has spaces on it. The problem is the file doesn't open and the WMPlayer sends a message (file extension not recognized).
I know that the problem is in the spaces in the folder. Tanks a lot.
Here is the code:
Private Sub cmdPlay_Click()
On Error GoTo Err_cmdPlay_Click
Dim stAppName As String
Dim PlayFullName As String
PlayFullName = "G:\MP3\045- Mp3\test.mp3"
stAppName = "D:\Program Files\Windows Media Player\wmplayer.exe " & PlayFullName
Call Shell(stAppName, vbMinimizedFocus)
Exit_cmdPlay_Click:
Exit Sub
Err_cmdPlay_Click:
MsgBox Err.Description
Resume Exit_cmdPlay_Click
End Sub
|
|
|
|
|
The problem is the spaces, your right. But solution is also pretty easy. The problem comes because the spaces are seen as command-line argument seperators. This is the command-line your sending to Shell:
D:\...\wmplayer.exe g:\mp3\045- mp3\test.mp3
Your actually telling wmplayer that there are 2 command-line parameters:
'g:\mp3\045-' and 'mp3\test.mp3'
The solution is to put quotes around both parts of the command-line:
PlayFullName = chr$(34) & "G:\MP3\045- Mp3\test.mp3" & chr$(34)
stAppName = chr$(34) & "D:\Program Files\Windows Media Player\wmplayer.exe" & chr$(34) & " " & PlayFullName
Now your sending the command-line as:
"D:\...\wmplayer.exe" "G:\mp3\045- mp3\test.mp3"
The quotes will prevent the spaces from becoming argument seperators.
RageInTheMachine9532
|
|
|
|
|
I am chaning default printer using WshNetwork. In my project there is a printer pool and machine is Win2k. My code works fine on my machine(XP). But when i try to change the printer on Win2K it doesn't work, if one of the printer is turned off on the printer pool.
Here is the code:
Dim WshNetwork = CreateObject("WScript.Network")
WshNetwork.SetDefaultPrinter(cbobwprinter.Text)
MsgBox("Success")
Catch ex As Exception
MsgBox(ex.ToString)
MsgBox("Can't set the default printer!", MsgBoxStyle.Critical)
Any idea why it won't work in Win2K! .Net framework is installed on Win2K box. Thanks
Zulfikar Ali
|
|
|
|
|
Hello coders,
You know in VB6 there were some apis like
CreateREctRgn
CreateEllipticRgn
...
Is there any equivalent in VB.NET of one of those?
How do I use them?
Thank you
Have a nice day
Best Regards
Emre YAZICI
|
|
|
|
|
The following code can be used to change the shape of a control. It may give you some ideas about how to use regions:
Dim intDiameter As Integer = 200
Me.Height = intDiameter
Me.Width = intDiameter
Dim p As New Drawing2D.GraphicsPath()
p.AddEllipse(0, 0, intDiameter, intDiameter)
Me.Region = New Region(p)
Hope it helps
Regards
Wayne Phipps
|
|
|
|
|
Thank you very much..
I have another problem.
How can I combine two or more RGNs?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim intDiameter As Integer = 200
Me.Height = intDiameter
Me.Width = intDiameter
Dim p As New Drawing2D.GraphicsPath()
Dim r As New System.Drawing.Rectangle(0, 0, 80, 80)
p.AddRectangle(r)
p.AddEllipse(0, 0, intDiameter, intDiameter)
Me.Region = New Region(p)
End Sub
But there is a problem. It cuts off the region (which already created before)
There was an api called CombineRgn
in the api there was a mode that you can set the combining property
Best Regards
Emre YAZICI
|
|
|
|
|
It's been divided into 5 methods:
Region.Complement
Region.Xor
Region.Union
Region.Exclude
Region.Intersect
So instead of:
Me.Region = New Region(p)
do:
Me.Region.Complement(p)
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
THANK YOU
regards
Best Regards
Emre YAZICI
|
|
|
|
|
Hi....I have a datagrid that as the user finishes entering a row, a duplicate of the row will pop up. When the user saves (updates) sometimes the extra row is saved sometimes not. Very strange behavior. I found a post on another site where a developer expressed the same behavior and said that he "had to detach the grid prior to messing with the dataset". I don't understand what he means (I've asked him but haven't received a reply). Does anyone want to take a stab at what they thing this means and how you would detach a grid? Thanks in advance.
Thanks,
Mike
|
|
|
|
|
I tried to access MS insert data from my VB code... The following Sql String gives error.....
insert into table (name) values ('MyName')
Note - the select, other queries work right... The querry executed in the MS Access worked to insert a record....
Help
I was born intelligent Education ruined me!.
|
|
|
|
|
What was the error (exception) that you got back?
Can you show some code? The DB structure?
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
Ray Cassick wrote:
Can you show some code
Dim db As Database
Dim rs As Recordset
Dim SQLString As String
Set db = OpenDatabase("c:\temp\home.mdb")
SQLString = "insert into expense (ExpName) values ('Hai')"
Set rs = db.OpenRecordset(SQLString)
If rs.BOF = True And rs.EOF = True Then
MsgBox ("No Data")
........
The DB structure is simple.. with PKey as a auto number, ExpName as a text. Thats it...
Any idea of my error....
Ray Cassick wrote:
What was the error (exception) that you got back
Run time error:3219
Invalid exception!!
I was born intelligent Education ruined me!.
|
|
|
|
|
Try using the Execute method of the dataabse object instead of the OpenRecordset method.
db.Execute(SQLString)
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
Will give it a try...
Thanks
I was born intelligent Education ruined me!.
|
|
|
|
|
I can pass an ArrayList of myClassObjects to a DataGrid and it obligingly displays it but it shows all of the Columns at the default Width including the ID Column. It also labels the Columns with myVariable names.
myDataGrid.DataSource = myClass.myFunction
Where myFunction is returning an ArrayList of MyClassObjects.
I have tried using a DataGrid Table Style Object etc. to no avail. How can I hit those pesky Column Objects directly to set their Widths and Headings?
|
|
|
|
|
How do I check if the logged onm user is an administrator in VB.Net?
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
Try something like:
Imports System.Security.Principal
...
Dim identity As WindowsIdentity = WindowsIdentity.GetCurrent()
Dim principal As New WindowsPrincipal(identity)
Dim isAdmin As Boolean = principal.IsInRole(WindowsBuiltInRole.Administrator)
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Hi....
How do I set the number of lines in a RichTexxtboxControl or limmit the number of lines?
/Fleischen
|
|
|
|
|
Hi...
I am a beginer to VB.. and a basic question....
Any code or snippet for accessing MS access database from VB, on a button click action... I tried this....
Private Sub Command1_Click()
Dim DBCon As ADODB.Connection
Dim rsTemp As ADODB.Recordset
Dim objMail
Set DBCon = New ADODB.Connection
Set rsTemp = New ADODB.Recordset
On Error GoTo errhandle
DBCon.Open dsn.Text, username.Text, password.Text
rsTemp.CursorLocation = adUseClient
rsTemp.Open SQLstr.Text, DBCon, adOpenForwardOnly, adLockReadOnly
mailbody = body.Text
For i = 1 To CInt(paramnum.Text)
mailbody = Replace(mailbody, "[x" & i & "]", rsTemp.Fields("x" & i))
Next i
MsgBox "From = " & from_txt.Text & Chr(10) & Chr(13) & _
"To = " & rsTemp("toemail") & Chr(10) & Chr(13) & _
"Subject = " & subjfield.Text & Chr(10) & Chr(13) & _
"Body =" & mailbody
Exit Sub
errhandle:
MsgBox Err.Description
End Sub
But it says....
Compile Error, User defined type not defined in the very first line of the code. Should I make/modify any configurations??
Thanks
I was born intelligent Education ruined me!.
|
|
|
|
|
Did you add Microsoft ActiveX Data Objects to your references? To do this, Click Project | References on the menu, and check the check box beside it in the dialog box.
Do unto others as you would have them do unto you - Jesus
An eye for an eye only makes the whole world blind - Mahatma Gandhi
|
|
|
|