|
Hi all,
I want to know how to change a C# application to run in background from inside the program, i.e. the user can click a button in the GUI of the application, so that the application/or some of its process can run at background, so it won't compete resources with the other applications in foreground.
Thanks
Patrick
|
|
|
|
|
Hi!
Check out the usage of System.Threading.Thread - 'IsBackground' Property and use if it suits ur need.
Regs,
Manivannan.P
|
|
|
|
|
Hello .
Iam new to c#.
How a message to send to all clients in LAN network.
like "Net send" command
|
|
|
|
|
This has been covered in this forum many times. Whether or not you're new to programming or even just a particular language, basic research skills are a must in the field of development. Next time, please search first. You can search this site's articles using the search box at the top of every page, or click "Search comments" in every forum to search previous threads. You could also just google the entire web.
The simplest way is to just use "net send" using the Process class:
Process.Start("net", "send /domain Hello, world!"); The other way is to P/Invoke the native functions but requires you understand what P/Invoke is. If you want to go that route, I suggest you search for the previous threads about "net send" and you'll find links and examples, but the method above works just fine.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks for your suggetion
I have another doubt will please help me? link below
http://www.codeproject.com/script/comments/forums.asp?msg=949594&forumid=1649#xx949594xx
|
|
|
|
|
I'm using log4net in my app to print debugging information. I have added code as follows
static QuestionGroup()
{
log = log4net.LogManager.GetLogger(typeof(QuestionGroup));
isDebugEnabled = log.IsDebugEnabled;
isInfoEnabled = log.IsInfoEnabled;
}
public QuestionGroup()
{
questionGroupId="questionGroup"+questionGroupCreated++;
heading="Place your heading here";
subHeading="Place your subheading here";
position=-1;
this.questionList=new ArrayList();
if(isDebugEnabled)
{
log.Debug("QuestionGroup created with id :"+questionGroupId);
}
}
but in the output window it give the error
log4net:ERROR No appender named [LogFileAppender] could be found.
how can I fix it
samitha
|
|
|
|
|
I have just started to use log4net too in my shareware and I think its a great little tool. I think you need to look at your config file and clean it up abit and have only the things in there that you want/need. In mine I have a section named LogFileAppender, here it that section of my config (had to add spaces to get the xml to show up correctly):
< appender name="LogFileAppender" type="log4net.Appender.FileAppender">
< param name="File" value="log-file.txt" />
< param name="AppendToFile" value="true" />
< layout type="log4net.Layout.PatternLayout">
< param name="Header" value="[Header]\r\n" />
< param name="Footer" value="[Footer]\r\n" />
< param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" />
< /layout>
< /appender>
Steve Maier, MCSD MCAD
|
|
|
|
|
I'm getting the following messages
log4net:ERROR No appender named [LogFileAppender] could be found.
log4net: Appender named [LogFileAppender] not found.
log4net:ERROR No appenders could be found for category (Com.SriLogic.Qsurv.QBuilder.Gui.MainForm).
log4net:ERROR Please initialize the log4net system properly.
here is the config file
/**/
<?xml version="1.0" encoding="utf-8" ?>
<!-- .NET application configuration file
This file must have the exact same name as your application with
.config appended to it. For example if your application is testApp.exe
then the config file must be testApp.exe.config it mut also be in the
same directory as the application. -->
<configuration>
<!-- Register the section handler for the log4net section -->
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<startup>
<supportedRuntime version="V1.1.4322"/>
</startup>
<appSettings>
<add key="SerialQuestionID" value="1"/>
<add key="log4net.Internal.Debug" value="true"/>
</appSettings>
<!-- This section contains the log4net configuration settings -->
<log4net debug="true">
<logger name="Com.SriLogic.Qsurv.QBuilder.Gui.MainForm">
<level value="INFO"/>
<appender-ref ref="LogFileAppender" />
</logger>
<!-- Define some output appenders -->
<appender name="LogFileAppender" type="log4net.Appender.FileAppender,log4net">
<!--param name="File" value="c:\\error-log.txt" /-->
<file value="C:\\error-log.txt" />
<param name="AppendToFile" value="true" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" />
</layout>
</appender>
<!-- Setup the root category, add the appenders and set the default priority -->
<root>
<priority value="INFO" />
<appender-ref ref="LogFileAppender" />
</root>
<!-- Specify the priority for some specific categories -->
<category name="Com.SriLogic.Qsurv">
<priority value="INFO" />
<appender-ref ref="LogFileAppender" />
</category>
</log4net>
</configuration>
/**/
how can I fix this?
samitha
|
|
|
|
|
In my file I have my "logger" section defined at the end of the file under my "root" section. I think that yours might need to move down because it does not know the definition of the LogFileAppender before its defined. I can email you my file if you want too.
Steve Maier, MCSD MCAD
|
|
|
|
|
Hi all,
I came across a case in which a dll and html page are integrated to launch an application in IE and I have no idea of what it is. It is an URL as below,
res://C:\file-path\example.dll/page.html
in the registry setting of the Internet Explorer, so when the user right click the page text inside the IE, the context menu will have the example appliction menu item, and via it the example application can be launched.
So how is the example.dll and page.html are integrated in this case ?
And how can I create a example dll and html page like this to launch an application ?
Thanks
Patrick
|
|
|
|
|
Hi,
I am not entirely sure what is the best way to create these type of files, but I use a program called "Resource Hacker" (ResHacker.exe) - it is a freeware utility that allows you to read the resources from a dll. You can extract icons, etc...
The example that I would refer to would be the "Outlook Today" page within outlwvw.dll (in the standard office path), you can change the page that is displayed in Outlook by using Resource Hacker. Works really nicely. I am sure that there would be a way to insert a new HTML page for external access using this?
Hope this is helpful,
DJ
|
|
|
|
|
Thanks DJ,
But I would like to know how to create a DLL like this by programming in c# and how to contruct the corresponding html also.
Patrick
|
|
|
|
|
See my reply for how to embed HTML files (and other files) in a library, which has nothing to do with C#, BTW.
If you want to know how to construct HTML documents, you best pick up a book on HTML or learn by example and view source for other sites in additional to reading about the tags (don't just guess at what they do). This is not the forum to teach you about writing HTML (it's not considered programming since HTML is not a programming language).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks so much,
I know how to construct a html, but how can I construct a html page
with the dll with that it could launch an application in window ?
Patrick
|
|
|
|
|
You're using "construct" here a little liberally. Please be specific.
So you know how to construct the HTML page. I told you how to "construct" the DLL that contains the HTML page (same thing applies to images you might want to use in the page). As I mentioned, you can either create a native DLL project, embed the HTML page, then hack the .rc file; or you can open a managed DLL after you've built it (yes - every time after you build it in VS.NET) and embed the HTML with a filename for the ID property. If you use the command-line compiler you can use the /win32res (for csc.exe; /win32resource for vbc.exe) to embed a .rc file. Support for compiling native .rc files at compile-time (and embedding them at link-time) will be added in VS2005.
Now, if your question is how to "construct" (start/execute/etc.) a browse session using this HTML dialog, the answer I gave you already: the res: protocol, which is also documented in the http://msdn.microsoft.com/library[^].
Just like you'd specify a URL to a resource on the web, such as http://www.codeproject.com/index.asp, you'd specify the path to a PE/COFF executable (like a Windows DLL) - or, if the file's parent directory is in your PATH environment variable, just the filename will do - then the path to the resource using either it's name or ID like the following two examples:
res:
res:
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
page.html is an embedded Win32 resources in a DLL. This does not currently work for embedded manifest resources (i.e., ".NET embedded resources").
You do this by editing your .rc file (VS.NET 7.0 and 7.1 do not support this for managed code; VS 2005 will) or opening your .dll in Visual Studio and adding a resource as an RT_HTML resource. You can also use the command-line compiler (like csc.exe or vbc.exe for C# and VB.NET, respectively) with the /win32res: switch to embed a Win32 resource in your PE/COFF executable.
If you want to refer to the resource by name, you need to manually edit the .rc file and refer to the resource by a string name that is not defined in resource.h (or any header included by your .rc file), like so:
EXAMPLE.HTM HTML "Example.htm" The res: protocol is used to reference Win32 resources (this works for images and every other resources, too), so you simply refer to the DLL by name (if this DLL is in a directory specified in your PATH environment variable, you do not need to specify the path to the DLL) then / plus any directories then / and the resource name, like so:
res: If you have additional questions about hacking .rc files, please refer to the Visual C++ forums.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
how do i make installation kit ?
|
|
|
|
|
There are many ways of creating an installer. You could use the "setup and deployment" project template to create your setup. You could use a third party installer such as Install Shield, Wise, NSIS, etc.
Of course you have not said if it was for a web app or a Windows app. So some things might be a bt different for them, but overall its not that hard to make. Right now I prefer just making a setup project inside of VS and adding it to the solution.
Also if you want the installer to include the .NET redistributable inside of it, there is a plugin from Microsoft to let your setup project include the full .NET setup inside of yours. Each other installer system may or may not be able to include the .NET setup too.
Steve Maier, MCSD MCAD
|
|
|
|
|
Hi All,
I have a treeView control and i am adding nodes to it dynamically.But i want to save total tree to a Binary Tree Data Structure.I don't know about Binary Tree,So any body knows how to send treeview data to binary tree pls send me the steps and if possible sample code.
thanks
sastry
|
|
|
|
|
Hi,
I am trying to download a file from server using WebRequest object. The following is my algorithm.
1. Create a WebRequest object
WebRequest req = WebRequest.Create(<URL>);
2. Set the method to the request object
req.Method = "GET";
3. Set the current user credentials
req.Credentials = CredentialCache.DefaultCredentials;
4. Get the response
WebResponse res = req.GetResponse();
5. Get the response stream
Stream inStream - res.GetResponseStream();
6. Save the stream to the local file.
GetReponse takes lot of time and I want to optimize the same. Can anyone suggest me what settings I can make so that I can reduce the time. I will be downloading the files from within the intranet.
Thanks for any suggestions
V. Srinivas
|
|
|
|
|
my suggestions, not much of a solution:
- maybe it's worth trying to use ftp for the files transfer.
- try to use a network sniffer (even windump will do) to see where, and especially when, the delays occur
there are no facts, only interpretations
|
|
|
|
|
Thanks for the suggestions. Actually I am downloading the files from Microsoft Share Point Server and the files need to be downloaded using the URL paths. I am not very sure whether ftp supports URLs.
Regards,
V. Srinivas
|
|
|
|
|
V. Srinivas wrote:
I am not very sure whether ftp supports URLs
neither am I. But try sniffing the network, this way you'll know if its a server problem, a client problem or a mysterious network problem.
there are no facts, only interpretations
|
|
|
|
|
I am myself not a great admirer of this feature and I understand we can still do the needful using interfaces. But I am interested in *technical reasons* why .NET guys decided to omit this feature from .NET This seems to be a favourite interview question.
|
|
|
|
|
Here is a little things that I read recently.
C# offers only single inheritance which means that a class can have only one direct base class. This restriction is actually imposed by the CLR so single inheritance is the rule for all .NET languages. The designers of .NET acknowledge that multiple inheritance is more powerful than single inheritance; however, they decided that the extra complications and ambiguous situations that arise in the presence of multiple base classes were not worth this extra power.
Steve Maier, MCSD MCAD
|
|
|
|