|
I have a console project. How do I execute a commandline statement eg.
cd C:\Program Files
He who laughs last is a bit on the slow side
|
|
|
|
|
A simple question deserves a simple answer but unfortunately one cannot be given for this question, it's more complex than you think because
cd C:\Program Files
Is actually interpreted by cmd.exe and is not a system command. If you simply want to launch a file with arguments or something like that then you can use the System.Diagnostics.Process class.
You'll have to provide more information as to exactly what you want to accomplish, are you writing a "wrapper" around the Windows console? (Based solely on the example command you gave).
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
I'm currently busy with my application's installer. I have all done, so all I still need to do is to create the database at installation. I have the sql script for that. How I see this I have to do the following. btw I'm using msde for the database..
1 - restart the service, this I want to do via command prompt.
2 - log into osql and the instance with ... osql -E -S machinename\instancename
3 - execute the script file, sending parameters with, the installation path.
I might be able to somehow link step 2 & 3 with the following command...
osql -E -S machinename\instancename -i "path\script.sql"
I'm just not quite sure how to specify the path values that supposed to be within the script file, that is to where it must create the MDF and LDF files.
He who laughs last is a bit on the slow side
|
|
|
|
|
NeroToxic wrote: I'm just not quite sure how to specify the path values that supposed to be within the script file, that is to where it must create the MDF and LDF files.
Best bet would be to generate the script on the fly. This way to can specify absolute paths in the script and not get bogged down with the current working directory which can cause big problems sometimes.
NeroToxic wrote: He who laughs last is a bit on the slow side
Love it
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
Ed.Poore wrote: Best bet would be to generate the script on the fly.
I was afraid that would be the case
But many thank for all the help, appreciated.
He who laughs last is a bit on the slow side
|
|
|
|
|
Hi,
I want to make a search with xQuery but while I am a beginner I got an "invalid token" with my query and cannot figure it out why it occurs.
Here is my xml part :
<archive><br />
<image name="" path=""><br />
<olay><br />
</olay><br />
<yer><br />
</yer><br />
<zaman><br />
<gecegunduz><br />
</gecegunduz><br />
<saat><br />
</saat><br />
<gun><br />
</gun><br />
<ay><br />
</ay><br />
<yil><br />
</yil><br />
</zaman><br />
<anahtar><br />
<item><br />
</item><br />
</anahtar><br />
</image><br />
</archive>
and this is my query :
query = "for $x in /archive/image return if ((contains($x/@name," + c + ") or (contains($x/@path," + c + ") or (contains($x/olay," + c + ") or (contains($x/yer," + c + ") or (contains($x/zaman/saat," + c + ") or (contains($x/zaman/gun," + c + ") or (contains($x/zaman/ay," + c + ") or (contains($x/zaman/yil," + c + ") or (contains($x/anahtar/item," + c + ")) then return $x";
I simply follow the pattern of msdn :
XPathDocument xPathDoc = new XPathDocument(@"C:\test.xml");<br />
XPathNavigator xPathNav = xPathDoc.CreateNavigator();<br />
XPathExpression xPathExpr = xPathNav.Compile(query);<br />
XPathNodeIterator xPathIter = xPathNav.Select(xPathExpr);
so what is wrong with this ? Please help..
p.s. : the exact thing I try to do is making a complete search inside my xml document. when the user writes something in the textbox and click search, using this query, I try to get every node containing the keyword anywhere inside..
best regards..!
-- modified at 6:34 Monday 14th August, 2006
.:: Something is Wrong ::.
|
|
|
|
|
Hi.
Im working on a MDI-application in C#.
For this i want to realize modal dialogs, which are only valid for the calling mdi-child.
that means, if i activate/click on another mdi-child, it will be activated, despite of the modal dialog in the other child.
in my current approache i show a modal dialog as a normal form. by handling the activate/deactivate-events i tried to simulate the behaviour of a modal dialog by calling the Activate()-method on the form that should be modal. but that doesn't work.
i tried to call Activate() on the modal form in the Deactivate-handler of itself and in the Activate-handler of the owner. both doesn't work.
is there perhaps any possibility to cancel the deactivation of a form?
here is the relevant code in the main-form:
//method in the MainForm, that is called when an MDI-child wants to show a dialog
public void ShowAsModalForm(MdiForm modal, MdiForm owner)
{
owner.Tag = modal; //save current displayed dialog for the child in a member-variable
modal.Deactivate += new EventHandler(Modal_Deactivate);
owner.Activated += new EventHandler(ModalOwner_Activated);
modal.Show();
}
//the owner of a modal dialog was activated
void ModalOwner_Activated(object sender, EventArgs e)
{
Form owner = sender as Form;
if (owner != null)
{
Form modal = owner.Tag as Form; //getting the current modal-form form the member an activate it
if (modal != null)
modal.Activate();
}
}
//the modal dialog was deactivated
private void Modal_Deactivate(object sender, EventArgs e)
{
Form modal = sender as Form;
if (modal != null) //activate it
modal.Activate();
}
the ModalOwner_Activated-Method seems never called, though registered in Activated-event.
the other possibility is Modal_Deactivate, which is called on deactivation but modal.Activate() has no effect, not thinking about thats the wrong way, because by handling the deactivate-event i can't decide if the modal dialog should be shown or not (because the user clicked on a other mdi-child).
Can anyone help me?
thx
|
|
|
|
|
Hi All,
I have an EXE program which runs as a Windows Service on my Windows 2000 professional system. The programs runs fine while running as a service. The problem is that if I log off the current user, the my service stops. But if we refer to the SQL Server service manager, it continues to run if we log off or shutdown or restart the system . Even the actions are reflected in every login. Like if in any login we stop the SQL Server Agent, then in other login(on the same system) also the SQL Server Agent is in stopped status.
So howcome i implement this kind of functionality in my windows service.
Any help will be greatly appreciated
Thanks in advance
Deepz
|
|
|
|
|
Why not you check which user account it is using to run.
The sql service could be using some account like "service account" or "local system account". you might need to use something like that to keep your exe running.
Hope this helps
- ashish
|
|
|
|
|
Hi,
I am currently working on a project named "motion detection to control pc". It is a project which can assist paralysed patient to access the pc using facial movement.
I have a webcam capturing movement of head and translate it to mouse(cursor) movement.
I can move the mouse(cursor) by using the Cursor.property function, however, i am still unable to double click/right click the mouse using codes.
Any can help?
*****************************************************************************
Cursor.Position = new Point(Cursor.Position.X - 0, Cursor.Position.Y - 80);
*****************************************************************************
Thanks~
|
|
|
|
|
One way would be to interop out to the Windows SDK, and use SendMessage to send a mouse click windows message to the control. A VB version of something 'similar' is here.[^]
Regards
Malc
*********************************************
|
|
|
|
|
How do we send a file in batch mode to a computer in the same network?
Luck is Opportunity with hardwork
|
|
|
|
|
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
string targetComputerPath = "//myServer/myShare/";
string sourceComputerPath = "c:/test/";
ArrayList myFiles = new ArrayList();
myFiles.Add("file1.txt");
myFiles.Add("file2.txt");
myFiles.Add("file3.txt");
foreach (string fileName in myFiles)
{
string target = targetComputerPath + fileName;
string source = sourceComputerPath + fileName;
System.IO.File.Copy(source , target);
}
}
}
}
and then there's error handling to think of...
Regards
Malc
*********************************************
|
|
|
|
|
Thank you..
Luck is Opportunity with hardwork
|
|
|
|
|
Hi All!
I have a problem!
I just got the VS8 which has the SplitContainer, and i do not know how to work with it, the problem is that i have a form,without panels for now, that contains 2 list box and 2 tree views, that are arrange like this:
TreeView1 ListBox1
TreeView2 ListBox2
they all cover the form exectlly the same size, so the form looks like 4 white squares, so now i want to save this resize, i mean i want them to grow or to get small when i resize the form, how can i keep the precentage of the controls with the SplitContainer.
Thank you for your help .
|
|
|
|
|
control_name.Dock = Dock.Fill;
|
|
|
|
|
I only add the Spliter Container and give to all the controlls Dock property the Dock.Fill value?
|
|
|
|
|
spliter container in form. set it to Dock.Fill.
treegird or others in split container. set it to Dock.Fill too.
|
|
|
|
|
Hi all,
I have some basic questions about threading.
1. Is my windows application a single threaded or multithreaded?
2. If i create some thread objects or windows/thread/system timer would my windows application is a multithreaded one??
3. Suppose if my windows application registerd an event with COM exe. then if the event occurs will it run in a separate thread or in the GUI thread?
4. What does it mean STA AND MTA? what is significance of thest Thread apartment model?
5. is it possible to a share a class library by two application running in separate appdomain? if so how?
i googled for the above questions, but understand a little.. if anybodys knows plz share..also give some tips/links on this.
Thanks and Regards,
Srini
|
|
|
|
|
Here are some of the answers:
2. The timer control uses the message pump to handle events, so it doesn't use threading. The other timers start separate threads to handle events.
5. You can use the same library from different applications, but they are separate instances of the library, so you can't share data between applications that way.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for reply!
This is with respect to my 5th question.
So how to share the dlls accross different applications? is there anykind of shared dll? or if i put my dll in GAC will it be a shared one accross the applications?
Thanks
Srini
|
|
|
|
|
.NET Remoting allows to share object instances between tow app domains, whereever they are: on the same machine or somewhere on the Internet.
|
|
|
|
|
1.
engsrini wrote: 1. Is my windows application a single threaded or multithreaded?
find the Main in your app. if use [STAThread], that means single threaded.
if you use [MTAThread], that means multi-thread.
<br />
[STAThread]<br />
static void Main()<br />
{<br />
Application.Run(new demo());<br />
}<br />
4. different between STA and MTA
|
|
|
|
|
hi all i have an application that can call up records in a set of database. i can do the navigate, delete update and insert functions.. however i wish to include sort and filter functions for my application.. how do i go abt doing this? any links or articles will be greatly appreciated thanks
|
|
|
|
|
I think you use the DataView for that
|
|
|
|