How to recognize process? hi everybody
I'm trying to write an application to redirect hotkeys of specific program. For example, in notepad, if the user press "ctrl+s", that means save. But I really want to assign the save action another hotkey and of cause, without modifying the notepad program itself. Unfortunatley I was stucked at the first step: How can I recognize the process of the certain program I'm targeting at I'm using C#
Sorry for this question may sound a little bit stupid but I do not write .net program often and I'm not quite familiar with .net API and architecture. I even have a little doubt if it's possible to write such a "hotkey redirection" program. Anyway, I really need it and thank you very much if you can give me some advice Tag: .NET Framework Networking and Communication directory transfer .NET Development
Embed a manifest XML resource in .NET 2003 Hi
Does anyone know how to embed an application manifest (XML) file in an .exe built using using .NET 2003
With .NET 2005 there seems to be linker directives such as "/MANIFEST" and "/MANIFESTFILE:"; however when I enter them in the linker command line for the Visual studio version of the reference they are ignored since they don't exist.
Tried adding it as a file in the Resource category within the project explorer, and as an item in the Solution explorer to no avail; it simply does not get embedded that I can tell.
The "Add Module to Assembly" field in the Project Linker property page seemed like the most likely candidate, but again, the Manifest attributes are not applied to the resulting .exe.
I found a knowledge article about embedding files in a project / solution however it does not seem to apply to Manifest files; these are used by the OS (e.g. Vista) to determine, among other things, the "trustInfo" of the executable, such as credentials when executed (i.e. "HighestAvailable" aka admin, or "AsInvoker").
Any help would be appreciated,
Pablo Tag: .NET Framework Networking and Communication directory transfer .NET Development
Using DataContractSerializer on the ISerializable objects. While trying to use DataContractSerializer to serialize an object that implements ISerializable I noticed strange behavior. Here is my example (purely theoretical):
- The object I would like to serialize:
<Serializable()> Public Class test
Implements System.Runtime.Serialization.ISerializable
Private s() As String
Private ss As List( Of String )
Public Sub New ()
ReDim s(1)
s(0) = "One"
s(1) = "Two"
ss = New List( Of String )
ss.Add( "Three" )
ss.Add( "Four" )
End Sub
Public Sub GetObjectData( ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext) Implements System.Runtime.Serialization.ISerializable.GetObjectData
info.AddValue( "s" , s)
info.AddValue( "ss" , ss)
End Sub
End Class
- My serialization code:
Private Sub Button1_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim XMLWriter As New Xml.XmlTextWriter( "c:\temp\ts.xml" , Nothing )
Dim Serializer As New Runtime.Serialization.DataContractSerializer( GetType (test))
Dim TestObject As New test()
Try
Serializer.WriteObject(XMLWriter, TestObject)
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
XMLWriter.Flush()
XMLWriter.Close()
End Try
End Sub
My main issue here is that when my object does not implement ISerializable this code works fine, however in the current situation DataContractSerializer is asking to add a System.String() to the known types. Then it is asking to add Generic.List(Of String) to the known types but when I do that I am getting runtime exception that the Data Contract type of SystemArrayofStrings already exist in the known types and cannot be added.
- First of all why is the known data types an issue when I have ISerializable object
- Second is it some kind of a flaw that would not let me add String() and Generic.List(Of String) to the known data types at the same time
I would appreciate if anyone could comment on this behavior.
Thank You, Tag: .NET Framework Networking and Communication directory transfer .NET Development
Is it possible for an interface to span multiple classes? Since you cannot do this...
Dim MySpanningInterface as ISpanInterface = new (Class1, Class2)
My problem is, I am trying to take a series of classes and present parts of each of them to client programmers in a way that's convenient for them to program against.
The classes belong logically apart, but certain members of each class are needed for certain kinds of things.
I want a simple way to let programmers work against selected methods from more than one class through a single variable reference... hopefully an interface reference.
Is this possible How would you suggest doing this Tag: .NET Framework Networking and Communication directory transfer .NET Development
Filtering Problem of DataTable Actualy the project in such a stage that, it will be difficult to add new colum. I want June Data...for every year...not a particular year. Tag: .NET Framework Networking and Communication directory transfer .NET Development
Regarding Asp.Net 2.0 Web application Deployment Hi,
I have deployed my web application (Asp.Net 2.0) in two servers.I put on the source files(aspx and aspx.cs) in DNS server.We used the infragistics web controls in my application(Infragistics Netadvantage 2006 volume1 CLR 2.0).I just shared the folder in DNS server(application folder).Creating the virtual directory in IIS server.
I browsing the application,Got an Error
could not bind the Infragistics web grid (Infragistics2.WebUI.UltraWebGrid.v6.1.dll).How to refer this DLL in IIS server.
Note:I reffered the Infragistics web controls in Bin Directory in my application folder .
I hosting the application,I got an Security Exception Error
Server Error in '/website' Application. Tag: .NET Framework Networking and Communication directory transfer .NET Development
Where is DLLMain in a C# DLL? I am writing a simple class library with C# that exports a class. The DLL needs to do some initialization once a process loads it. In the good old days of VC++ 6.0 (and Win32), you could rely on DLLMain to do that. However, I can not find a counterpart to DLLMain in the .Net framework. Any comments would be appreciated.
Thanks Tag: .NET Framework Networking and Communication directory transfer .NET Development
Creating Database Access 97 with VS 2005 Hello people!
First, Sorry because my english is bad, I am studing the language.
Second, my problem is:
I will have create the database Access 97 with VS 2005.
I try using the dll: Microsoft ADO Ext. 2.8 for DDL and Security
My code is:
Public Sub CreateDatabase
Dim catalogo As Catalog = New Catalog()
m_sConex = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & local_arq & "\" & name_arq
catalogo.Create(m_sConex )
dbFactory = New Utilitys.Factory(m_sConex , TipoDB.OLEDB)
End Sub
It created one database but in version 2000 and I need in version 97.
How Can I create the database
What is dll for use
Again, sorry because my english, I am Brazilian ...
Thank you so much for answers.
Fabi Tag: .NET Framework Networking and Communication directory transfer .NET Development
SqlTransaction and SqlConnection state after worker thread aborted Hi,
I have a project that I need to use background worker thread to update database in one transaction. But when I abort the worker thread at the middle of transaction, the State of SqlConnection is closed in catch block. Because the connection state is closed, the Rollback in fact did not really rollback the transaction. I checked Activity Monitor in Sql Server 2005, the connection was still there and was in transaction state. So, if I rerun the update again, I got the dead lock. I am thinking it is a bug in ADO.NET or in Sql Server 2005. I try to use SqlConnection.ClearAllPools but still cannot kill that connection in Activity Monitor. Is there any way to work around this
Below is a sample code that will cause this problme.
private void button1_Click( object sender, EventArgs e)
{
worker = new Thread ( new ThreadStart ( this .Start));
worker.IsBackground = true ;
worker.Start();
}
private void ExecuteCmd( string cmdText)
{
using ( SqlCommand cmd = cnn.CreateCommand())
{
cmd.Connection = cnn;
cmd.Transaction = tx;
cmd.CommandText = cmdText;
cmd.CommandType = CommandType .Text;
cmd.CommandTimeout = 15;
try
{
cmd.ExecuteNonQuery();
}
catch ( ThreadAbortException )
{
ConnectionState state = cnn.State;
if (tx != null )
{
tx.Rollback();
tx = null ;
}
throw ;
}
}
}
private void Start()
{
// using (TransactionScope scope = new TransactionScope())
{
try
{
cnn = new SqlConnection ( "connection string" );
cnn.Open();
toContinue = true ;
tx = cnn.BeginTransaction( "hello" );
Thread .SetData( Thread .GetNamedDataSlot( "tx" ), tx);
while (toContinue)
{
ExecuteCmd( "Update A_TABLE set counter=counter+1 where test_id=1" );
}
//scope.Complete();
tx.Commit();
}
catch ( Exception )
{
if (tx != null )
{
tx.Rollback();
}
}
finally
{
worker = null ;
}
}
}
private void button2_Click( object sender, EventArgs e)
{
worker.Abort();
}
private void button3_Click( object sender, EventArgs e)
{
toContinue = false ;
} Tag: .NET Framework Networking and Communication directory transfer .NET Development
RSA : Encrypt with private key and decrypt with public key Sebastien LEIX wrote:
The RSA has the particularity to be "reversable" : you can encrypt with public and decrypt with private, or encrypt with private and decrypt with public.
I want to distribute datas that people can only decrypt, as a licence file for example. I create and encrypt a licence with my private key. I distribute the encrypted licence and the public key, so people can read the licence, but noone can generate a licence, except me.
Actually, this works really fine with OpenSSL. Now, i want to do the same under .NET.
Using the signature is not a way, because i can just verify datas, not decrypt them.
Regards
Hi, I met the same problem, is it because of MS's CSP Have you solve it I think some time we need encrypted using a private key and decrypt using a public key... Tag: .NET Framework Networking and Communication directory transfer .NET Development
Culture and DatePattern Hi,
I need to format a string using the month and year codes. But is has to be culture aware. Unfortunately the default YearMonthPattern of DateTimeFormatInfo doesn't do the trick because it displays the months in full text. So I tried to provide a custom pattern, but then it isn't culture aware anymore.
Dim d As New Globalization.DateTimeFormatInfo d.DateSeparator = "/" d.YearMonthPattern = "MM/yy"
Console.WriteLine(dDate.ToString(d.YearMonthPattern, New Globalization.CultureInfo("en-US"))) Console.WriteLine(dDate.ToString(d.YearMonthPattern, New Globalization.CultureInfo("fr-BE")))
Does anybody have an idea how to solve this
Thanks,
Jan Tag: .NET Framework Networking and Communication directory transfer .NET Development
How to Add/Insert Nodes in XML? Hello
I have this file.xml which contains these data:
Code Snippet
< xml version="1.0" standalone="yes" >
- < DocumentElement >
- < MyValues >
< Name > John </ Name >
< Occupation > Doctor </ Occupation >
< Age > 40 </ Age >
</ MyValues >
- < MyValues >
< Name > Smith </ Name >
< Occupation > Engineer </ Occupation >
< Age > 35 </ Age >
</ MyValues >
</ DocumentElement >
Q1. How can I delete all nodes when "Occupation=Doctor"
Q2. How can I insert a new node
Thanks Tag: .NET Framework Networking and Communication directory transfer .NET Development
TypeDescriptor.GetProperties () : Interface Issue It just comes down to the definition of inheritance when referring to interfaces. Interfaces do not inherit members from their base interfaces, they inherit requirement. The compiler can use that "requirement inheritance" to bind to the Foo property from and IBar reference, but the property itself has not actually been inherited. It might help to read through some of the CLI specification that I posted. Not the best answer I know, but its the best I've got.
You might want to file a suggestion at the Product Feedback Center , recommending that there be a way to get the "inherited requirements" from a derived interface. Tag: .NET Framework Networking and Communication directory transfer .NET Development
System.Runtime.Remoting.RemotingException: Cannot load type ... Hi
I am trying to call a Window Service written in 1.1, through 2.0 code, using remoting, and serviceController class.
But i am getting the error,
Error System.Runtime.Remoting.RemotingException: Cannot load type BServiceReporter...
Source "mscorlib"
when I try to call the method GetBWorkerStatusList .
oReporter = ( BServiceReporter ) Activator .GetObject( typeof ( BServiceReporter ), sTcpAddr);
m_xBatchWorkersStatusList = oReporter.GetBWorkerStatusList();
The lines work, if the ServiceController class uses, WindowService, written in framework 2.0 (But we have to use older windows service; business requirements)
I also looked at the following article, which i suspected, and installed the patch, but i think the problem is different
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=300062&SiteID=1
Any help in this, will be highly appreciated
thanks in advance
Jan Tag: .NET Framework Networking and Communication directory transfer .NET Development
Eventid missing in Framework 2.0 Doesn't that AND everything in the 16 bit short, and therefore unnecessary That is, it's the same as int EventID = short(e.Entry.InstanceID & 0x3FFFFFFF); and
int EventID = short(e.Entry.InstanceID & 0xFFFF); and
int EventID = short(e.Entry.InstanceID); And wasn't eventID a 16-bit value anyway So what's all this about masking two bits of a 32-bit value (InstanceID) to get the eventID In many cases, e.Entry.InstanceID & 0x3FFFFFFF doesn't equal the value that Event Viewer displays, which I assume is the eventID - in 16 bits I'm obviously confused. Could someone clear this up Thanks, Kev Tag: .NET Framework Networking and Communication directory transfer .NET Development
is it possible to use the sql data file only? I am developing a small IQ software using C# and SQL Server Express and I don't want to pack the whole SQL Server Express with it.. is it possible to distribute and use the mdf file only as a stand-alone data file Tag: .NET Framework Networking and Communication directory transfer .NET Development
WebService RPC/Encoded when using RPC/Encoded mode in Webservice , the IsNullable=false is ignored in the WSDL file:
I have the class (generated from xsd file) that contains the following attributes:
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable= false )]
public string CorporateName;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable= true )]
public string Type;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable= false )]
public string ID;
When using document/literal webservice , i get this element in the wsdl file.
< s:element minOccurs =" 0 " maxOccurs =" 1 " name =" CorporateName " type =" s:string " />
< s:element minOccurs =" 1 " maxOccurs =" 1 " name =" Type " nillable =" true " type =" s:string " />
< s:element minOccurs =" 0 " maxOccurs =" 1 " name =" ID " type =" s:string " />
B
BUT when i use RPC/Encoded mode i get all element whith minoccurs=1 and maxoccurs=1 ( IsNullable attribute is ignored )
< s:element minOccurs =" 1 " maxOccurs =" 1 " name =" CorporateName " type =" s:string " />
< s:element minOccurs =" 1 " maxOccurs =" 1 " name =" Type " type =" s:string " />
< s:element minOccurs =" 1 " maxOccurs =" 1 " name =" ID " type =" s:string " />
Windows XP. Visual Studio 2003. framework.net 1.1 .WebService RPC Tag: .NET Framework Networking and Communication directory transfer .NET Development
Passing a Stream to a Web Service Ahhh... great... I see what you are doing! I'll give that a try!
Thanks! Tag: .NET Framework Networking and Communication directory transfer .NET Development
XeonYK
i want to make application that can transfer a directory not only a file, i have search for the library but their not free.
where can i get free library for directory transfer