|
Try this. string exedir = AppDomain.CurrentDomain.BaseDirectory;
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Hi I made a service that runs under the system account. The service gets a message from my server that tells it to shut down if no user is logged on. But because my service is run under system I can use this code to find out who is logged on.
string a;
a = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
I was wondering does any one know a different way to find if a user is logged on.
|
|
|
|
|
|
Well it seems it’s only for terminal server but if any one knows it this exists in c# for a normal workstation that would be cool
|
|
|
|
|
There is a class Win32_logonSession. Not sure if that can help you.
जय हिंद
|
|
|
|
|
Hello,
In my application, I want to print some informations.
I can print this informations with e.Graphics.DrawString () .
The problem that I want to print in the same page ,that contains informations printed with e.Graphics.DrawString () I want to print command PCL but the problem is that I have in the result 2 pages.
- the first one contains informations printed with e.Graphics.DrawString ().
- The second contains informations of PCL command
The problem that I want in the result 1 page that contains both information.
I send To you a part of my code:
code use e.Graphics.DrawString ():
PrintDocument Page = new PrintDocument(); Page.PrintPage += new PrintPageEventHandler(cardDocument_Page); Page.Print();
Code of cardDocument_Page(....):
e.Graphics.DrawString("String1", cardFont, Brushes.Black, 400, 300);
e.Graphics.DrawString("String2", cardFont, Brushes.Black, 500, 300);
Code that send commande directely to the printer:
DOCINFO di = new DOCINFO();
int pcWritten = 0;
PrintDirect.OpenPrinter("\\\\10.1.0.40\\HPLaserJ", ref lhPrinter, 0);
PrintDirect.StartDocPrinter(lhPrinter, 1, ref di);
PrintDirect.StartPagePrinter(lhPrinter);
string st1;
st1 = "\x1b**1M\x1b(14Y\x1b(s0p8.00h12.0v0s0b105T" + Strin+ "\x1b**0M";
PrintDirect.WritePrinter(lhPrinter, st1, st1.Length, ref pcWritten);
PrintDirect.EndPagePrinter(lhPrinter);
PrintDirect.EndDocPrinter(lhPrinter);
PrintDirect.ClosePrinter(lhPrinter);
classes used by PrintDirect:
public class PrintDirect { [DllImport("winspool.drv", CharSet = CharSet.Unicode, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
public static extern long OpenPrinter(string pPrinterName, ref IntPtr phPrinter, int pDefault);
[DllImport("winspool.drv", CharSet = CharSet.Unicode, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
public static extern long StartDocPrinter(IntPtr hPrinter, int Level, ref DOCINFO pDocInfo);
[DllImport("winspool.drv", CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern long StartPagePrinter(IntPtr hPrinter);
[DllImport("winspool.drv", CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern long WritePrinter(IntPtr hPrinter, string data, int buf, ref int pcWritten);
[DllImport("winspool.drv", CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern long EndPagePrinter(IntPtr hPrinter);
[DllImport("winspool.drv", CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern long EndDocPrinter(IntPtr hPrinter);
[DllImport("winspool.drv", CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
public static extern long ClosePrinter(IntPtr hPrinter);
I want to print informations (PCL and other) in the same page, but not in 2 pages.
Thank you for your Help.
|
|
|
|
|
I'm trying to save a unicode utf8 string --> "سلام" in a feature of a featureclass, but it is saved like "????".as ArcMap support different encodin and also Farsi that I'm working with, It should be possible through my program.but I didn't find any way yet.anybody knows about this?
<br />
<br />
feature = fc.CreateFeature();<br />
feature.Shape = point;<br />
feature.set_Value(feature.Fields.FindField("Name"), o.Name);<br />
feature.Store();<br />
fc is an IFeatureClass, feature is an IFeature and o.Name is a unicode.utf8 string.in watch window:
feature.get_value(feature.Fields.FindField("Name"))--> is OK
but
fc.GetFeature(1).Get_Value(feature.Fields.FindField("Name")) --> is "????"
and this is what is saved. What should I do?
|
|
|
|
|
If you're sure that your data is intact when sent to the component (easily checked with some breakpoints) then you should ask in their forums[^].
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Thanks for your reply, yes I'm sure about that. I tried a lot to create an acount in thier Forum that you mentioned, but every time I recieve this message:
We're sorry, but we are experiencing a delay in creating or confirming your ESRI Global Account.
You will be notified via e-mail as soon as you may begin using your account.
Thank you for your patience.
and I never recieved any Email from them.this is why I came here to ask my question, as most of my problem has been solved in this site
|
|
|
|
|
Hi,
I have to develop UI in windows mobile in which the icons come one by one in a line by using left/right key (AS developed in iphone). The selected icon gets focus and enlarged, others are going in background of screen.
How to develop ?
|
|
|
|
|
Maybe, if you ask this in the Mobile Development forum?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I am writing a Windows.Forms application and I have a some objects that I want to be Global. Example of these objects are an object for maintaining a collection of remote resources, and a "Task list" type object that shows all running tasks. There is only ever 1 instance of these objects, they are created when the application starts and are destroyed when the application ends.
I use these objects throughout my application and inorder to do so I have to pass an "Environment" object to each form, this Environment object serves as a pointer to the global objects.
This seems very kludgy, is there a way that you can have global objects shared across the application without having to pass them to each form/thread you create?
Thanks in advance!
|
|
|
|
|
A public static class?
जय हिंद
|
|
|
|
|
But how would that help pass the object instance?
|
|
|
|
|
If I understand correctly, you need a object TaskList across the application. Assuming it has a set of properties, you can have a public static class TaskList, with all the properties needed, which will be available across the application.
If it is just a list of tasks and there are some more things of this sort, have all these as properties in a common static class and expose them as properties of type List.
Since the class would be public, you can access it anywhere in the application.
जय हिंद
|
|
|
|
|
The public static class contains the global object instance (or is the global object if you prefer).
public static class GlobalObjects
{
public static List<Task> taskList = new List<Task>();
}
...
GlobalOjects.taskList.Add(task);
...
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
|
Hi, I am using EF and want to use its generated objects to be returned to the web service (By serializing it). The problem is All generated classes are inherited from EntityObject (member of System.Data) and I don't want its member to be included in the wsdl.
Please help me if anyone know the solution. Thanks in advance.
modified on Friday, June 19, 2009 3:10 AM
|
|
|
|
|
How Do I Hide MDI Menus For The Specific User For Ex. - there are two user I want some menu to hide for one user how do i hide it?
|
|
|
|
|
0. Fix your title, it does not reflect the subject.
1. Like all controls, menu items have an Enabled and a Visible property.
2. Use them consistently.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Hi,
I have a windows application, reporting-tool, wich alows a user to create a XML that later can be generated to a Excel-File.
I am now developing a new function. The user should have the possibility to create a DLL consisting model/generator and also the created XML. By now I have splited the application into two projects:
1. The main windows application with all the forms etc.
2. The model of the excel-report and the classes which generate the report.
Now how can I create the DLL and embed the XML, and all that should be implemented in the windows application project
Thanks in advance
-Haris
|
|
|
|
|
You create an assembly by using a compiler, but I'm at a loss to understand why you are having users create them. How would the be used?
only two letters away from being an asset
|
|
|
|
|
Create an assembly by using a compiler? Could you be a bit more specific ?
It's a windowsapplication that uses COM-Interop to create a excelfile. The XML file has stored the definition for the report, like position of the cell, cell-content, cell-format etc.
Generation the excelreport works fine. But the next step is to create that DLL.
When the user has created that DLL he can upload it to a ASP.Net application which handels that DLL and provides the report as a download.
It has to be a DLL consisting the C#Project(model/generator) and the XML Definiton-File.
|
|
|
|
|
Haris wrote: When the user has created that DLL he can upload it to a ASP.Net application
Woah! You are allowing users to upload DLL files to a web server?! Are you nuts! Can you not see what a massive gaping security hole you are punching in the Web server? It would be like a bank saying that they want to make it easier for their customers to access their money, so here's a stick of dynamite to use if you ever need to access the vault out of hours.
|
|
|
|
|
well ... there would have been a nicer way to say that ... but ... anyway!
it's a application interface definition!
it's my part do generate the DLL ... what happens whit that DLL further -> I don't know exactly and it's not my problem.
|
|
|
|