|
This is the code I am using
'myProcess.StartInfo.FileName = "C:\Program Files\PDFcheck\pdffonts.exe " 'Full pathname to including file name
'myProcess.StartInfo.Arguments = filename ' If the program takes args as string
'myProcess.StartInfo.CreateNoWindow = True ' Does not create a window DOS program
'myProcess.StartInfo.UseShellExecute = False ' Must be false to redirect output
'myProcess.StartInfo.RedirectStandardOutput = True
'myProcess.Start() ' Start the DOS program
'myProcess.WaitForExit() ' Wait until it completes before moving on
'prgOutput = myProcess.StandardOutput.ReadToEnd ' Get the DOS output
'pdffonts = prgOutput
'f.Close()
|
|
|
|
|
include the full path to your program.
Greetings from Germany
|
|
|
|
|
Could it be that the filepath you are supplying contains spaces? If it is a dos program, they generally don't support spaces within filenames, and "c:\documents and settings\user\desktop" does contain spaces. You could try:
c:\docume~1\user\desktop\filename.ext to see if this is the problem.
|
|
|
|
|
is there a way to convert the path from the standard to the dos path version within vb.net
|
|
|
|
|
you can go here:
http://bytes.com/forum/thread349072.html[^]
or copy/paste
Private Declare Auto Function GetShortPathName Lib "kernel32" (ByVal lpszLongPath As String, ByVal lpszShortPath As System.Text.StringBuilder, ByVal cchBuffer As Integer) As Integer
Private Const MAX_PATH As Integer = 260
Public Function ShortFileName(ByVal LongFileName As String) As String
Dim ShortPath As New System.Text.StringBuilder(MAX_PATH)
Dim BufferSize As Integer = GetShortPathName(LongFileName, ShortPath, ShortPath.Capacity)
Return ShortPath.ToString
End Function
|
|
|
|
|
Perfect. Thanks a million for your help.
|
|
|
|
|
Ignore everything you've just been told. Though, Jasey9 got it partially correct and his solution is technically correct, but completely unnecessary.
You have to enclose the full path of the file your passing to the DOS app in double quotes. Something like this:
someApp.exe "C:\Documents and Settings\userName\Desktop\Some Folder\File.txt"
What your code is doing is passing this:
someApp.exe C:\Documents and Settings\userName\Desktop\Some Folder\File.txt
Notice that there are no quotes. Since command line arguments are parsed using the "space" character as a delimiter, you've actually passed 4 arguments to the app, not 1. Enclosing any item, not necessarily path names, in double quotes treats the contents of the quotes as a single argument.
So, in your code, you have to add double quotes to both ends of the path that your passing in the Arguments property of your Process object.
Public Shared Function FixupCommandlineParameter(ByVal s As String) As String
Return String.Format("""{0}""", s)
End Function
myProcess.StartInfo.Arguments = FixupCommandlineParameter(filename)
|
|
|
|
|
|
Hi,
Is it possible or how do you create a exe that when you drop a file onto it, the program will run and do a task on the file that your dragged onto it.
|
|
|
|
|
When you drag a file over an exe (or shortcut), the program will be started with the filename as a command line argument. You can either change Sub Main() to Sub Main(args() As String) or find some other way to get the command line arguments (System.Environment.GetCommandLineArgs(), for example).
Something similar happens if you associate a file type with your program and double-click the file in explorer.
|
|
|
|
|
I will try explain what I am trying to do a little better than before. I have a program that when you run it the Open FIle Dialog appears so you can select a pdf to run a check on. What I want to do is to allow the user to drag and drop the pdf onto the exe an instead of opening the Open File dialog it would bypass it but still use the file name and path that I have selected as the file to check. An example of this would be if you create a text file on your desktop. You can then drag and drop the file on Notepad.exe and the file will open straight away.
modified on Thursday, July 3, 2008 10:46 AM
|
|
|
|
|
Gideon provided you with the answer you need
When you drop a file onto you'r exe, the exe will start with in its arguments the path to that file
like gideon said you can then eighter change the constructor of you'r startupform form
public sub new()
to
public sub new(args() as string)
or use System.Environment.GetCommandLineArgs() to get the arguments passed to the exe
this is a standerd function in windows (drop any file onto (olmost) any exe and the exe will start)
But all this has been said by Gideon so...
|
|
|
|
|
I haven't done that myself, but this article has a basic tutorial that should point you in the right direction. The main events here seem to be DragEnter and DragDrop.
|
|
|
|
|
sorry for posting second question on same topic becouse second is for display data is posted by mistake and try to modify in edit mode thats is not shown ,
'this code is worked
isql="Insert Into students(id, first_name, last_name, major,current_credits) values (?, ?, ?, ?, ?)"
idbcomm=new odbccommand(isql,dbconn)
idbcomm.Parameters.Add("id", id.Text)
idbcomm.Parameters.Add("fname", fname.text)
idbcomm.Parameters.Add("lname", lname.Text)
idbcomm.Parameters.Add("major", major.Text)
idbcomm.Parameters.Add("credits", credits.Text)
idbcomm.ExecuteNonQuery()
'This code is not working reports error
'lsSQL ="Insert Into stud(id,firstname,lastname,major) values (@id,@fname,@lname,@major)"
'idbcomm=new odbccommand(isql,dbconn)
'idbcomm.Parameters.Add( "@id",id.Text)
'idbcomm.Parameters.Add( "@fname",fname.text)
'idbcomm.Parameters.Add( "@lname",lname.Text)
'idbcomm.Parameters.Add( "@major",major.Text)
idbcomm.ExecuteNonQuery()
sanjeev
|
|
|
|
|
Please Check your data type against your Variable data.
and why you use Paramenters. It is meaning less.
Anubhava
|
|
|
|
|
idsanjeevjha wrote: 'This code is not working reports error
What is the error ? You have use @ symbol for parameter. I believe you should use ? symbol for parameters in Odbc.
|
|
|
|
|
i am getting ERROR [42000] [Microsoft][ODBC driver for Oracle][Oracle]ORA-00936: missing expression.
ya i have to use ? symbol for parameter in odbce but why @ is used in sql or msaccess
thanks
sanjeev
|
|
|
|
|
That depends on the databases. SQL and access uses @ symbol.
|
|
|
|
|
It may not help much, but when using an old version of sqlce, I used to use the following to add a parameter to the query:
cmd.Parameters.Add(New SqlCeParameter("id", SqlDbType.Int)).Value = nextID
maybe you can modify to get it working?
|
|
|
|
|
Code for data insertion is not work reported error
<script runat="server">
Sub submit(sender As Object, e As EventArgs)
dim dbconn,sql,dbcomm,dbread
dbconn=New ODbcConnection("dsn=oracle;uid=starter;pwd=starter;")
dbconn.Open()
sql="SELECT * FROM students"
dbcomm=New ODbcCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
customers.DataSource=dbread
customers.DataBind()
dbread.Close()
dim isql,idbread,idbcomm
isql="Insert Into students(id,first_name,last_name,major) values (@fname,@id,@lname,@major)"
idbcomm=new odbccommand(isql,dbconn)
idbcomm.Parameters.Add( "@fname",fname.text)
idbcomm.Parameters.Add( "@id",id.Text)
idbcomm.Parameters.Add( "@lname",lname.Text)
idbcomm.Parameters.Add( "@major",major.Text)
idbcomm.ExecuteNonQuery()
dbconn.Close()
End Sub
</script>
but this code is excuted success fully
<script runat="server">
Sub submit(sender As Object, e As EventArgs)
Dim strConnectionString As String
strConnectionString = "Dsn=oracle;uid=gatepass;pwd=gp"
Dim pConn As New OdbcConnection(strConnectionString)
'Dim pSELECTQUERY As String = "SELECT *from students"
Dim pSELECTQUERY As String = "SELECT distinct PassMaster.*,passarea_dtls.passarea,empmaster.empname,visitormaster.visitorname FROM PassMaster, VisitorMaster,passarea_dtls,empmaster where passmaster.authorisationby=empmaster.empno and passmaster.passareacode=passarea_dtls.passareacode and PassMaster.PassIssueDt + PassMaster.validity -1 >= trunc(sysdate) and PassMaster.PassID = VisitorMaster.PassID and PassMaster.AuthorisationStatus = 'YES' and passmaster.PASSISSUESTATUS not like 'YES' order by PassMaster.PassID"
Dim adapter As New OdbcDataAdapter(pSELECTQUERY, pConn)
Dim DS As DataSet = New DataSet()
adapter.Fill(DS)
Repeater1.DataSource = ds
pConn.Close()
adapter.Dispose()
Repeater1.DataBind()
End Sub
</script>
i don't know whats is the reason any help ?
sanjeev
|
|
|
|
|
try changing
isql="Insert Into students(id,first_name,last_name,major) values (@fname,@id,@lname,@major)"
to
isql="Insert Into students(id,first_name,last_name,major) values (@id,@fname,@lname,@major)"
|
|
|
|
|
Thanks for your reply
Please see my last post where i already changed some code problems in commented code is not worked but other code thats is not commented is inserted data successfully.
so i wants to know whats is the mistakes in my commented code
thanks
sanjeev
|
|
|
|
|
Yep. I spotted that after I had posted the Q.
|
|
|
|
|
I used AxShockwaveFlash Object to play first.swf file, i wanna play second.swf when first.swf complete so how can i get the total completion time period of flash file, means each swf file must play only once then load next swf file..
Can anyone give me suggestion 4 this
Thanks with annticaptions
Unless u don't give ur hundred percent whatever u r doning till there is no result of ur work...
|
|
|
|
|
I have some code that reads email items and their attachments and then moves the mail item to a "Processed" folder in the users mail box. In general it works ok, but if the attachment in a file type that is not recognised (this raises an error), I want to identify the mail item and move it to a different folder. When I debug my code, the appropriate catch statements seem to get called and the flags set correctly, but when I get the part of the code that moves the mail items, the one that raised the error gets moved into the "Processed" folder and not the "Failed" folder.
Can anyone see what I am doing wrong?
In the code below, theMailItem is a structure.
I.E.
<br />
Public Structure TheMailItem<br />
Dim theItem As MailItem<br />
Dim theMove As Boolean<br />
Dim theFail As Boolean<br />
End Structure<br />
For Each theMailItem In theMailItems
Try
ReadMailItem(theMailItem.theItem)
Catch ex As InvalidCastException
theMailItem.theFail = True
theMailItem.theMove = False
Catch ex As NullReferenceException
theMailItem.theFail = True
theMailItem.theMove = False
Catch ex As System.Exception
theMailItem.theFail = True
theMailItem.theMove = False
End Try
Next
For Each theMailItem In theMailItems
'Move any processed items
If theMailItem.theMove = True Then
theMailItem.theItem.Move(theMoveFolder)
End If
'Move any fail items
If theMailItem.theFail = True Then
theMailItem.theItem.Move(theFailedFolder)
End If
Next
|
|
|
|
|