|
Hi!,
I'm trying to pass arguments to a running process, the process is started from my program and takes command line arguments on start up, but I wish to pass more over time, not just on start up.
Does anyone know if this is possible, and if it is where should I be looking?
Thanks
John
|
|
|
|
|
of course this is possible, and there are many ways of achieving it. You could use:
- .NET Remoting
- sockets
- named pipes
- memory mapped files
and many others I guess.
Some of these will also work between machines.
For passing a command line to another process, I tend to prefer named pipes.
all but the first are Windows features, available for a long time and in all languages.
For more info you could search Google, MSDN, or CodeProject. I'm confident CP holds articles
on all of them.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi,
Thanks for the reply, just a few questions. Are named pipes supported in .NET?
From the examples I could find quickly, it would seem these are look like server/client applications, is this how they work?
|
|
|
|
|
j_foulkes wrote: Are named pipes supported in .NET?
AFAIK they are not supported, I used P/Invoke to the good old Win32 functions.
They work like UNIX pipes, their names are system wide, so two processes can decide
to connect to the same pipe based on a fixed name; and a pipe is like a socket, what
gets written at one end can be read at the other end. So I would call it a symmetric
connection, not necesseraly associated with client/server stuff.
I used named pipes in a singleton application: the first instance creates the pipe and
listens for commands; if a second instance gets launched with some command line,
it pipes that command to the first instance and exits again.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
j_foulkes wrote: the process is started from my program and takes command line arguments on start up, but I wish to pass more over time, not just on start up.
What process?? Is it something you wrote?? Do you have control of the source code??
If not, then if this is possible or not is entirely up to the application you are launching, not you. If it doesn't support doing this already, there's nothing you can do to add this support to it. You'd have to rewrite this app yourself, duplicating it's functionality, and adding this communication support to it.
|
|
|
|
|
Thanks Dave,
I don't think I explained it well. This isn't a application I wrote or have control over. I know it can pass command line arguments to it on startup.
Oh well, back to the drawing board
|
|
|
|
|
You're stuck. There's nothing you can do to "make it work". If the app doesn't support interprocess communication already, you can't force it to.
|
|
|
|
|
hi,
I am not good at this...but if the process is started by your application then i think you can do this by redirecting output stream and input stream of that process and then using the simple read and write functions of the streamreader and streamwriter.
I am again telling you that I am not good at this, but I did once try it and sent commands to cmd.exe using the same method.
You can search on google for it! I think there is a sample code available.
Pranav Bhat
Email:pranavsbhat@gmail.com
|
|
|
|
|
That works if, and only if, his app that he's launching is a DOS command-line app that takes normal keyboard input. It doesn't work for Windows apps or DOS apps that scan the keyboard directly.
|
|
|
|
|
Hi All !!
I am new on this forum. Just made my account today. Website looks great!
I have been developping in Wedev and Clarion for many years. This year I have made the switch to VS 2005. Already I have looked shortly at VS2008.
I must admit, I regret that I have not started with VS earlier.......
In Windev we have always been working with ini-files. Would like to put in a ini-file several variables witch the user may change.
Anyone a suggestion or a quick start for using ini-files?
Second question .... if I may? I want to save user-setting in a configuration-file. Cann anyone give me also a quickstart?
Thnxs
Hans
-- modified at 14:52 Thursday 29th November, 2007
|
|
|
|
|
Hi,
I think you must try the settings file, it's a new technique simple and beautiful. I'll show you a way to use it, go to project > new item > settings file (name it e.g. testsettings.settings) > add a new record (use the user scope).
in your form:
'Read
Dim s As New TestSettings
MsgBox(s.FieldName)
'Update
s.FieldName = NewValue
s.Save()
hope this helps
NajiCo http://www.InsideVB.NET[^]
It's nice 2b important, but it's more important 2b nice...
http://www.facebook.com/group.php?gid=5932660937[^]
|
|
|
|
|
Hi Naji,
Thnxs for youw wonderfull tip.
It worked right away!!!
I will forget about the ini-files and use the settings-option provided bij VB.net.
Greetz
Hans
|
|
|
|
|
|
hi,
I need to detect the URL that a browser is requesting using vb.net? Please tell me how do i go about it! I need it to work on Firefox and IE.
Please tell me ASAP!!
Thanks in advance.
Cheers!!
Pranav Bhat
Email:pranavsbhat@gmail.com
|
|
|
|
|
You have little choice but to write a proxy server and configure the browsers to use your proxy to make the requests to get web pages.
|
|
|
|
|
hi,
thanks for the reply dave! Thats an option but can we configure a browser directly via code to use a proxy server?? Moreover, i dont think firewalls or malicious page detectors work this way..do they??
waiting for your reply.
Thanks in advance.
Cheers.
Sincerely,
Pranav Bhat.
Pranav Bhat
Email:pranavsbhat@gmail.com
|
|
|
|
|
Pranav Bhat wrote: Thats an option but can we configure a browser directly via code to use a proxy server??
Yes, but it would require poking a bunch of stuff into the Registry, different for each browser.
Pranav Bhat wrote: Moreover, i dont think firewalls or malicious page detectors work this way..do they??
Software firewalls on the local machines don't interact with the browser at all. They work on the network stack and watch the packets, and data in them. This is impossible to write in VB.NET (well, not impossible - you have to use 3rd party libraries line WinPcap) and requires you know FAR more about the network stack than how IP works.
Other firewalls and proxy servers that sit between the Internet and the workstations DO work this way. The browsers have to be configured to use the firewall/proxy or else they don't get out to the Internet.
Anything else is a plugin to the browser, for which you'll have to write a seperate plugin for each borwser you want to support, and install it on every workstation. I hate writing the same thing twice, so I don't like that option.
|
|
|
|
|
hi,
thanks for the answer dave!!
I'll have to choose from which option to go for!! But thanks anyways....i really appreciate it.
Cheers.
Pranav Bhat
Email:pranavsbhat@gmail.com
|
|
|
|
|
i have text file and this file change run time (batch file create text file and if run it next time put new result )
the question is how can put pointer in new position after change with function (seek)?
|
|
|
|
|
Hi guys,
I am developing using .net 2005. The label text on some of my controls (labels, radio buttons and checkboxes) on a single particular form in my project is not showing the last character. e.g. one checkbox control is supposed to show the following text:
"Separate source files from XML " its being shown as "Separate source files from XM "
another radiobutton control is supposed to show:
"Absolute Path " instead the output is "Absolute Pat "
This is happening on different controls in different positions on the form. I tested it on a client machine and the problem also came up there. how can i teach my application to spell correctly?
Thanks for your assistance...
Regards
|
|
|
|
|
Hi,
Label.AutoSize property
"When this property is set to true, the Label adjusts its width to display its entire
contents. This property is typically set to true when you use a Label control to display
various lengths of text, such as the status of an application process. You can also use this
property when the application will display text in various languages, and the size of the text
might increase or decrease based on the language settings in Windows."
If AutoSize is false, you must allow for sufficient Size.
Hope this helps.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Can anybody help me by showing me how an application on a computer representing the client computer be connected to a SQL database server on another computer representing the server computer to enhance easy transfer of data from the database between the 2 computers.
language :VB.net/SQL
BBia
|
|
|
|
|
Your question is too broad and ambiguous. The answer will depend on wat you are trying to achieve and your level of understanding of the programming language and technology to be used. As a starting point, use ADO.Net, SQL Connection, SQL Command and depending on wat you are trying to do exactly, u can also use SQL Adapter, datasets, dataset tables etcs. You can search the net for basics and notes on how to use them.
|
|
|
|
|
The guys are right, you need to tell us what do you want to achieve. and we will adivice, i have an N-Tier Article here on codeProject, where i have sepatated the layers Physically and as they have advice that you should use ADO.net, check this
http://www.codeproject.com/useritems/N-Tier_Application_VB.asp[^]
Hope this Helps
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Greetings,
I'm building an App that reads a very big XML file and saves the data in a SQL database.
The XML file is in encoding windows-1250 and it can't be changed.
The main point is to read all characters in the XML including croatian letters (Č,Ć,Ž,Š,Đ)
I have tried this code first: (with this method I get an error 'platform not supported'
xmlDoc = New XmlDocument()
xmlDoc.Load(xmlPath)
The second try: (in which I try to transform the encoding windows-1250 to UTF-8, It reads the XML but it deletes the croatian letters)
fileS = New FileStream(putanjaXml, FileMode.Open, FileAccess.Read)
xmlContext = New XmlParserContext(Nothing, Nothing, "", XmlSpace.Default, System.Text.Encoding.UTF8)
xtr = New XmlTextReader(fileS, XmlNodeType.Document, xmlContext)
xmlDoc = New XmlDocument()
xmlDoc.Load(xtr) // Not supported platform
fileS.Flush()
fileS.Close()
xtr.Close()
I have also tried the above method with system.text.encoding.Unicode and UTF7. But no luck.
So please does someone know how to read this XML file with this encoding (the METHOD must be xmlDocument.LOAD)
Thank you very much!
|
|
|
|