|
Christian Graus wrote: decreases the odds
not possible to decrease the odds here, I feel!
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Well, they are probably already hovering around zero, it's true.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
In Device Manager there are descriptions of the PC's serial ports with the port number in parenthesis. I would like access to these descriptions in C#. For Example my application uses a USB to Serial Adapter. Device manager reports it as "USB Serial Port (COM1)". Using the System.IO.SerialPort.GetPortNames() only returns the information in parenthesis. Is there any way to get the information before that i.e. "USB Serial Port"?
|
|
|
|
|
i don't think you can do this from your app. The usb com number is decided by the usb to serial driver.
*12Code
|
|
|
|
|
My windows service is check one exe file is running or not. If it is not run, windows service is run this exe file. (This exe file is a winform application)
I try this;
In Windows Service installer side; serviceProcessInstaller1 Account propert is: User
And I enter user name and password when service is installed...
Windows service run this exe file, I see exe file name on the Task Manager Processes tab but I can't see this exe file GUI.
After that I try this;
In Windows Service installer side; serviceProcessInstaller1 Account propert is: LocalSystem
I set "Allow service interact with desktop" propery on the Windows Service Management --> Service Property --> Log On tab.
But my problem is not solved, Windows service run this exe file, I see exe file name on the Task Manager Processes tab but I can't see this exe file GUI.
How can I start GUI application from a windows service?
|
|
|
|
|
Can you show the code used to start exe?
|
|
|
|
|
string exeFileFullAddress = "C:\\Test\\abc.exe";
System.Diagnostics.Process.Start(exeFileFullAddress);
But I alread try following
ProcessStartInfo psi = new ProcessStartInfo("C:\\Test\\abc.exe");
psi.RedirectStandardInput = true;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.UseShellExecute = true;
Process p = Process.Start(psi);
OR
System.Diagnostics.Process Proc = new System.Diagnostics.Process();
Proc.StartInfo.FileName = "C:\\Test\\abc.exe";
Proc.StartInfo.UseShellExecute = false;
Proc.StartInfo.CreateNoWindow = false;
Proc.Start();
|
|
|
|
|
The solution to make windows service run a GUI application is to set the Windows service run with the "Local system account" and activate the "Allow service to interact with desktop" from the "log on " tab in the Service properties. (when you double click on the Service in the Service console)
But it is not recommended to do such a thing.(for security reasons)
|
|
|
|
|
Okay, lets assume I have 2 socket servers running on separate computer and in third computer I've a client, client do not know that how many servers are running in LAN or whats their IP addresses. Now, I want to make a search for available connections.
Any way guys ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Have them all reply to a UDP broad cast. The broadcast can specify the ip and port which the servers should report to.
Natza Mitzi
|
|
|
|
|
I think I dont get you but are you trying to say that I should start a new server that will have all info about running servers ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
No, he is assuming you can modify the code each one is using.
He wants you to have the socket servers programmed to respond to a UDP broadcast, and you should program your client to send that UPD broadcast.
Are you able to modify the server code in that way?
Codemonkeys don't do it at all. Too busy coding.
|
|
|
|
|
Naruki wrote: Are you able to modify the server code in that way?
Why I cant ?
Well, the thing is I'm developing a pocket pc application. When you select file, right click on it(not actually) and select 'Send via wifi' then it opens my client application. But now I have to know the ip of the server to which I want to send the file and I want to write a code to search all the servers in homenetwork. Like bluetooth, when you send file it searches for another devices.
Both client and server written by me so I can modify the code
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
In that case, it looks like Natza's answer is what you need.
Have your client app send a broadcast UDP, which does not need an IP address. This will only go out on the local network segment (i.e., will not cross a router).
Change your servers to listen for such a broadcast packet. When they see it, they respond with their IP addresses.
How to implement that is a another thing entirely...
Codemonkeys don't do it at all. Too busy coding.
|
|
|
|
|
Ok, if you are reading this you may have seen the issue I was having with trying to us SqlDataReader(SequentialAccess) to read bytes from the VARBINARY(MAX) column. The problem was it wouldn't work with the VARBINARY column.
I have solved it using the IDataReader:
IDataReader myReader = cmd.ExecuteReader(CommandBehavior.SequentialAccess);
if (myReader != null)
{
myReader.Read();
long size = myReader.GetBytes(0, 0, null, 0, 0);
byte[] buffer = new byte[size];
int bufferSize = 255;
int dataIndex = 0;
long bytesRead = 0;
SetProgBar(Convert.ToInt32(size));
while ((bytesRead < size) && ((size - bytesRead) > 255))
{
if (bwLoadPicture.CancellationPending)
{
e.Cancel = true;
SetLabelDownload("Picture download cancelled.");
}
else
{
bytesRead += myReader.GetBytes(0, dataIndex, buffer, dataIndex, bufferSize);
dataIndex += 255;
bwLoadPicture.ReportProgress(255);
decimal FileSize = (Convert.ToDecimal(size) / 1024) / 1024;
decimal CurrentSize = (Convert.ToDecimal(bytesRead) / 1024) / 1024;
SetLabelDownload(String.Format("Downloading.. {0}MB of {1}MB", Math.Round(CurrentSize, 2).ToString(), Math.Round(FileSize, 2).ToString()));
}
}
bytesRead += myReader.GetBytes(0, dataIndex, buffer, dataIndex, Convert.ToInt32((size - bytesRead)));
SetLabelDownload("Finished Downloading.");
MemoryStream ms = new MemoryStream(buffer);
pictureBoxPicture.Image = Image.FromStream(ms);
ms.Close();
}
myReader.Close();
Now my new question is...
Is there a way to do something like this when uploading a file/picture to a database? If you are uploading a large file I would like to display a progress bar. So some how I would have to get the total bytes of the file, then write 255 bytes at a time or so. Is this possible?
|
|
|
|
|
Jacob Dixon wrote: Is there a way to do something like this when uploading a file/picture to a database?
AFAIK, providing exact progress will not be possible. You can use asynchronous method like BeginExecuteNonQuery[^] and display a progress until the callback function executes.
|
|
|
|
|
I see... so this will run it on another thread basically and I can see the start and stop points. Well I was trying to figure out how to see how much bytes have been written to the SQL database somehow. Sad there isn't something to do it...
|
|
|
|
|
hi ,
i'm creating an application that's checks if a blank dvd is inserted in the drive.
i want to prevent that my application is closed by a user using the task manager.
- i've tried to use code injection to Task manager to hide my process from the process list but this solution closes hides other processes but not mine.
- i've tried to use a windows service to verify if the application is still running and to restart it if it is closed ,but shows me the application in the process list but there is no UI.
- I tried to impersonate the code to a higher level user ,but this returns an exception because i'm trying to instanciate "MsftDiscMaster2 discMaster" : discMaster.IsSupportedEnvironment is always to false.
Thx
|
|
|
|
|
I doubt this is possible. I recall seeing this question a couple of times and the general consensus was that it can't be done. Also, your service could be disabled.
Off topic, but why do you want the user not to be able to kill your app? I would generally consider that very hostile behaviour and make sure I remove every trace of it.
|
|
|
|
|
the problem is that only the administrator could be able to close the application.
This application should record every dvd or cd burning action.
that's why i don't want the user to be able to close this application .
To burn a dvd or a cd the User should unlock the dvd burner using this application .
if i tried to run the application in the User account and there is a problem using the isolated storage and the IMAPI2 .
|
|
|
|
|
Maybe when the form is closing you could run another process of that application unless it was closed by a certain user? (Environment.UserName)
|
|
|
|
|
Well, if thats that then make a formless application, name it 'svchost'. Since too many processes have the same name, it will be hard to know which one is yours and if someone closes the wrong svchost process then I'm sure window will react strange and will require a restart. Thats the way I use...;)
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
since the user is not an administator , i'm managing to create a batch file that runs this application at windows startup using the runas command with Administator privilege.
This way , the user cannot stop the application using the Task manager , the UI for this application is visible and i've change the security policies to disable the regedit .
|
|
|
|
|
hi
your problem has been solved by me
i have a program that nothing can close it
and it can watch your application and when something closes it my program
will restart it agane
all you have to do is send me yor application process name(the one that apear in task maneger) and your application path (like c:\windows\myapp.exe)
mmfatemi@yahoo.com
have fun
|
|
|
|
|
I want to extract attachments from a PST or OST file from C# code and save the attachments to my local drives. I use OUTLOOK 2003 with the exchange server.
Any idea is appreciated.
|
|
|
|