C# and WinXP Customize Regional Option Values How to retrieve the values of "Customize Regional Options" on WinXP "Rigional and language Options" programmatically, such as "Decimal symbol" or "Digit Grouping symbol"
THANKS! Tag: Visual C# General Local Security Policy Visual C#
licensing questions hi I am about to sell my accounting application to an acounting company. and I am selling it for each client. but I dont know how to protect my application and how to restrict them. by time and client numbers.
any idea will be appreciated
regards Tag: Visual C# General Local Security Policy Visual C#
Custom Attribute class Hi, Im using Visual Studio 2005 and .Net 3.0. I wanted to apply Break Points in my Custom Attribute class. I and my falla both used number of sample code but Neither code is not executing Custom class nor break points work. Here is someone sample code. Im not even able to apply Break point. Can any Genious knows the answer
using System;
using System.Collections.Generic;
using System.Text;
namespace RegKeyAttributeTestor
{
[ AttributeUsage ( AttributeTargets .Method| AttributeTargets .Struct,
AllowMultiple= false ,Inherited= false )]
public class MyAttribute : Attribute
{
private string regKey= "a12nf" ;
public MyAttribute( string regKey)
{
if ( this .regKey==regKey)
{
Console .WriteLine( "Permitted to use this App" );
}
else
{
Console .WriteLine( "Not registered to use this App" );
}
}
} //End Attribute class code
class useAttrib
{
[ MyAttribute ( "hello" )]
public static string SayHello( string str)
{
return str;
}
static void Main()
{
Console .WriteLine(SayHello( "Hello to Sufyan" ));
Console .ReadLine();
}
} Thanks , sha Tag: Visual C# General Local Security Policy Visual C#
Problem with Pointers in C# I am sending you UNSAFE Code in which I am trying to implement Linked List like we used to do in C. What I believe is that the following line of code should allocate new memory address on each iteration ˇ° test1 = new LinkListPtr();ˇ± but in fact it is not. See if you can figure it out what wrong with it.
class Program
{
unsafe public struct LinkListPtr
{
public int num;
public LinkListPtr * linkListPtr;
}
unsafe static void Main( string [] args)
{
LinkListPtr * cur= null ;
LinkListPtr * first= null ;
LinkListPtr * obj= null ;
LinkListPtr test1;
for ( int i = 0; i < 3; i++)
{
if (first == null )
{
LinkListPtr test = new LinkListPtr();
first =&test;
first->num = i;
first->linkListPtr = null ;
}
else
{
cur = first;
while (cur->linkListPtr != null )
{
//I am stuck into a continuous loop
cur = cur->linkListPtr;
}
test1 = new LinkListPtr ();
obj = &test1;
obj->num=i;
obj->linkListPtr = null ;
cur->linkListPtr = obj;
}
}
while (first != null )
{
Console .WriteLine(first->num);
first = first->linkListPtr;
}
Console .ReadLine();
}
}
} Tag: Visual C# General Local Security Policy Visual C#
Which algorithm for encrypting file? Hi. I want to encrypt a file with a lot of passwords. The passwords are stored in a string and should be written to a file encrypted by a password/passphrase. It should be possible to read the file and encrypt the passwords if someone has the passphrase. I went to System.Security.Cryptography but found a lot of possibilities here (like DES, Triple DES, DSA, RSA and so on). Since the passwords have to stay secure, I would need a strong encryption (the time for encryption is not so important). Which algorithm would you suggest ! Tag: Visual C# General Local Security Policy Visual C#
Windows Service as middleman between client desktop app and Database Hi guys
I'm working on a desktop app that needs to access a local database, and also the same database on networked and remote machines. As the database user credentials are held in tables within the database, I dont want networked/remote users to be able to access the database with 3rd party apps using windows authentication and read all the data, namely,my app controls their access to the database, and tables/rows within this, based on certain coded criteria. (Reason I didnt just use the SQL Server users/roles is due to the way the database needs to be structured and the permissions system needed, and not wanting to implement too many views).
So, I'm thinking if the databaser server is closed to remote access, and the app communicates to the database (wherever it is) through a managed windows service (local to the database) ,which IS accessible remotely through TCP, then this would allow for my app to completely control user access, and protect the data, seeing as the database is only accessible through sa login, or from 'windows authentication' from my client app.
I'm thinking a WCF service embedded in a managed windows service which accepts queries and returns datatables to the app's local dataset.
I guess what I'm asking is for people's advice on this process, and if this sounds like the best option.
Thanks Tag: Visual C# General Local Security Policy Visual C#
C# Boxing & Unboxing Hello, and first of anything please forgive me if my question is very basic, i'm new to the c# programming, and to programming also, and i'm reading inside c# book, but i dont understand: what is the objective of the boxing and unboxing methods, and what are the differences between have a value type and a reference type i mean what can i do whit boxing, that i can't do whit out it. thanks. Randolf Rincon Bucaramanga, Colombia. Tag: Visual C# General Local Security Policy Visual C#
How do I find that an OS is x86 or x64 Hi there,
How do I find out programatically in C# that my OS is x86(32bit) or x64(64bit) platform
Thanks a lot
Suan Ngaihte Tag: Visual C# General Local Security Policy Visual C#
C#/WIA: Turning off auto-exposure on a Lifecam VX-6000 Hey, I'm working on a project with C# using Windows Image Acquisition and it's getting thrown off some by the auto-exposure adjustment on my Lifecam VX-6000. The properties controls for the camera have a checkbox that lets you turn off the auto-exposure... except it's grayed out, so I can't uncheck it. Is there any way to turn this off in my code Thanks! Tag: Visual C# General Local Security Policy Visual C#
NumberFormat object flaw? How can you use a NumberFormat object to get the "pence" symbol for a culture, i.e. en-GB would give "p" and en-US would give "ˇé". I've been looking through the class in visual studio and can't find anything relating to this, i've also gone through the different ToString() format methods and i can't find anything their either. If you have an answer please reply here and drop a comment on my blog Cheers Tag: Visual C# General Local Security Policy Visual C#
how to run a c# program visualstudio.net 2005 edition Im new to .net technology.I have visualwebdevoper 2005 express edion .I dont know how to run c# programs using this edition.could anyone pls help me Tag: Visual C# General Local Security Policy Visual C#
Sample code problem: creating threads I found some example code in a web page titled ˇ°How to create a thread by using Visual C#ˇ± and located here:
http://support.microsoft.com/default.aspx scid=kb%3Ben-us%3B815804
The instructions in this tutorial are easy to follow and I think I followed them correctly. It took maybe 3 minutes. When I try to run the new project, it pops up the form, then a few seconds later a window titled ˇ°InvalidOperatorException was unhandled.ˇ± The Window has an option to ˇ°Copy exception detail to the clipboardˇ± so I did that and pasted the data in below.
The line of code highlighted is:
this .progressBar1.Value = newval;
I did it twice and obtained exactly the same results. Did I make an error Has anyone run this with the expected results
System.InvalidOperationException was unhandled
Message="Cross-thread operation not valid: Control 'progressBar1' accessed from a thread other than the thread it was created on."
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.SendMessage(Int32 msg, Int32 wparam, Int32 lparam)
at System.Windows.Forms.ProgressBar.set_Value(Int32 value)
at ThreadWinApp.Form1.ThreadTask() in F:\A\Bryan\C_PROJECTS\ThreadwinApp\ThreadWinApp\ThreadWinApp\Form1.cs:line 42
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart() Tag: Visual C# General Local Security Policy Visual C#
How make ComboBox text fit neatly? Hi, My Form is resizable and a ComboBox on it must resize accordingly. Currently I adjust the ComboBox.Font size after each Form resizing. There is always some space above and below the text in the ComboBox text area. I would like to make the ComboBox vertically fit neatly to the text inside the ComboBox so the ComboBox.Height will be a little smaller. How can I achieve this H. Tag: Visual C# General Local Security Policy Visual C#
error in reversestring programme Error 1: 'reversestring1.Class1.ProgrammingTest.ReverseString(string)': not all code paths return a value
y iam getting this error.please reply.thanks in advance. Tag: Visual C# General Local Security Policy Visual C#
Implementing a simple parser Hi All,
First of all thanks you very much for spending your time to open this post. We are trying to implement a small parser which evaluates expression given by users. We have idenfied a set of operators, functions, keywords, conditional staments which are required for the language. Can you please tell us how shall we implement a parser which checks syntax of the expression and evalutes them If you have any reference to data structure concepts, please let me know.
Many thanks in advance.
Cheers,
Gopi Tag: Visual C# General Local Security Policy Visual C#
Create Background Process Does anyone know how to create a background process i.e., I want the process to not be visible in the taskbar, or system tray. I am starting the process using System.Diagnostics.Process.Start(). If there is not a way to start a process this way, then does anyone know a message number I can send throught the User32.dll SendMessage() API to achieve the same result Tag: Visual C# General Local Security Policy Visual C#
sizeof question Hi
Is there any way that I can get the size of a ValueType from a Type
I am using reflection to extract fields marked with a custom attribute, these fields are always a ValueType.
Is there a way that given a Type for the field that I can get it's "sizeof" because it seems not.
I dont have the actual field (and dont want to get the instance of it, as this costs time) but only a "Type" for it.
Sure I can code a switch statement and code for every known value type, but this seems a littl silly, given the fact that sizes of ValueTypes are known at compile time, it would make sense to store this in the Type or something.
Thx
H Tag: Visual C# General Local Security Policy Visual C#
want to create a tool which give find and replace functionality hi,
i want to develop a windows application using c#.net.The functionality will be like the same as find and replace functionality in windows.
can any body give a full idea how to develope this
thanks a lot in advance. Tag: Visual C# General Local Security Policy Visual C#
Explicit Conversion of Base Class to Derived Class I did a search on the subject, and the answer I found said that converting a base class to a derived class is not possible. I find this answer to be unsatisfactory, and I wish to make sure that it is indeed the correct answer.
I am writing some code (obviously), and in my code, I have a base class and an inherited class of that base class. There are times I wish to convert the base class to the inherited class. According to section 13.2.3 of the C# specification, this is possible:
"From any class-type S to any class-type T , provided S is a base class of T ."
There's also evidence that in the .NET Framework that it's possible (converting WebRequest to HttpWebRequest and Control to TextBox ). So why is it I get a runtime error of InvalidCastException when I attempt to explicitly cast an instance of my base class to an instance of a derived class of that base class Tag: Visual C# General Local Security Policy Visual C#
If condition Hi,
In the book I am reading it shows examples like this:
if (!SourceFileExists()) return;
System.IO. File .Copy(txtSource.Text, txtDestination.text);
MessageBox .Show( "The file has been successfully copied." );
Isn't it better to write it like this:
if (SourceFileExists())
{
System.IO. File .Copy(txtSource.Text, txtDestination.text);
MessageBox .Show( "The file has been successfully copied." );
}
Is the above method to save lines
Thanks,
aw Tag: Visual C# General Local Security Policy Visual C#
How to pass multiple variables as references in a generic way??? Hi, I am trying to write a function that allows passing different number of variables as references. I learned that we could use params modifier to achieve this. For example, I can declare my function as following: void MyFunc(params object[] objs). However, the variables will be passed in as values but what I really want is passing by references. I can get arround this by overloading MyFunc by incrementing the number of variables in the signature. For example: MyFunc(ref object obj1) MyFunc(ref object obj1, ref object obj2) ...and so on but doing this is kind of annoying since I may need to pass in more or fewer variables later on. Is there a generic way that we can pass different numbers of variables to a method in a simple way, like with the params modifier, by references Thanks. Tung. Tag: Visual C# General Local Security Policy Visual C#
Recognize a sound Hello everyone. I need some help desperately. I have made a program for a game, that takes screen shoots when a certain sound file is accessed (watching last access time). Now this have worked flawless for long time, until there was an update for this game. Now the program works only for those that have a dual core computer, there it works 100%. But for regular computers, the program will only take a screen shoot the 1 time the sound is accessed and then it seems that the file not get accessed any more, like the game stores the sound in memory or something. But as I said, it works for dual core computers (very confusing). Now I would be screaming of happiness if someone can explain why this is, sounds to weird to me. I thought maybe I can change my program in some way, to recognize what sound is active / playing. Don't know if this is possible. What I was thinking is: My program will somehow pick up every sound that is active on the computer and then if this certain file is played, it would trigger the event to take a screen shoot. I would appreciate any help you can give me, if it's an explanation to why my program suddenly only works on dual cores or if you have a solution to "know" what file is played. Thank you. /Sithz Tag: Visual C# General Local Security Policy Visual C#
Reg:try catch Block Hi ,
Could u just confirm me ,the following way of using try catch block is valid one I mean the nested one.
try
{
//Insert the signature Value.
sqlQuery = "Insert into signature values (@sign);select max(signatureid) from signature" ;
command = new SqlCommand (sqlQuery, connection);
command.Transaction = transaction;
command.Parameters.AddWithValue( "@sign" , mailCollection.mailDetail[0].signature);
signId = Convert .ToInt32(command.ExecuteScalar());
returnString = "Success" ;
}
catch ( Exception ex)
{
try
{
transaction.Rollback();
}
catch ( InvalidOperationException exp)
{
General .WriteLog(exp.Message.ToString());
}
DiposeObject();
General .WriteLog(ex.Message.ToString());
returnString = "Error Occurred" ;
}
Also confrim me ,using of try catch block affect the performance in anyway.
If it is so,pls., let me know how to handle try catch block in effective manner.Thanks. Tag: Visual C# General Local Security Policy Visual C#
32 bit or 64 bit OS? I want to know whether the win OS is 64 bit or 32 bit. How can I do it in C# Tag: Visual C# General Local Security Policy Visual C#
typedef in C# Is there any way to map typedef in C++ into C#
what I have:
typedef void (* GetFrameCallBack)( int FrameType, int Row, int Col,
TImageAttachData* Attributes, unsigned char *BytePtr );
Export DLL function in C:
SDK_API MTUSB_InstallFrameHooker( DEV_HANDLE DevHandle, bool IsMaxFrameRate, int FrameType, GetFrameCallBack FrameHooker);
Thanks for your help,
Tammy Tag: Visual C# General Local Security Policy Visual C#
Getting the values from a registry key with the type REG_MULTI_SZ I have created an application in c#. On the main windows form i have a rich text box. In the registry I have a registry key that has type REG_MULTI_SZ.
I want to get the values in this registry key into the rich text box.
So far I have the following code but this only displays the last value in the key:
RegistryKey openKey = Registry .LocalMachine.OpenSubKey( @"SOFTWARE\RegKey_test" );
string [] getValue = openKey.GetValueNames();
foreach ( string s in getValue)
{
RegistryValueKind rvk = openKey.GetValueKind(s);
switch (rvk)
{
case RegistryValueKind .MultiString:
string [] values = ( string [])openKey.GetValue(s);
for ( int i = 1; i < values.Length; i++)
{
richTB.Text = values ;
}
break ;
}
} Tag: Visual C# General Local Security Policy Visual C#
Is this a 'bug' in V.S.? I'm using Visual Studio 2005.
I've been working on a C# WinForm app and testing as I go to make sure the changes I enter are working. Today, I entered six lines and when I tested, I'm seeing the code perform a method that is not being called for. I'll try to explain;
In a method that sets the 'Enable' property of the form's command buttons, i have entered code:
private void SetButtons( bool btnAdd, bool btnEdit, bool btnDelete, bool btnCanc, bool btnSave, bool btnClose )
{
this.buttonAdd.Enabled = btnAdd;
this.buttonEdit.Enabled = btnEdit;
this.buttonDelete.Enabled = btnDelete;
this.buttonCancel.Enabled = btnCanc;
this.buttonSave.Enabled = btnSave;
this.buttonClose.enabled = btnClose
}
The above method is called like this: SetButtons ( false, false, false, true, true, true );
Before adding the lines to the form, the 'SetButtons' method would set the Enabled property of the buttons and return. However; now the execution proceeds to the buttonDelete' line and instead of setting the property of the button, execution drops 156 lines down in the code and starts to execute a method that is not in the 'Set' commands.
I've never seen this before and I'm at a loss as how to proceed. So far, I've re-coded the SetButtons method; I've Built and Re-Built the solution; and as a last resort, I've closed the solution, exited the V.S. IDE and restarted; nothing has worked, the code still tries to execute the same method 156 lines past the 'SetButtons' method.
I would really appreciate any information about this anomoly and how to correct it.
Thank you;
rhubarb Tag: Visual C# General Local Security Policy Visual C#
SAFEARRAYs, C# and Marshal.Copy() I've created a COM object that returns a SAFEARRAY of image data. My C# app receives this as a byte[] array and then passes the data to a second, third-party, ActiveX component for display. Well I say it passes the data, it doesn't. The third party ActiveX object returns a pointer for me to copy the data to and I attempt to copy the data to it in an unsafe code block using Marshal.Copy() as shown below: byte[] data; // Image data received from my COM object .... IntPtr ptrImageData; // Pointer to address for image data provide by 3rd party activeX ... ... Marshal.Copy(data, 0, ptrImageData, data.Length); This is where it all goes wrong. The c# app exits abruptly with code 0xc0000005. I'm unable to debug the C# app beyond Marshal.Copy().
The data returned in the SAFEARRAY (byte[]) from my COM object appears to have been populated correctly so I believe it to be fine.
I've been completely stumped. Is it something to do with the SAFEARRAY data still being locked when it is received as the byte[] array Please help. Thanks. Tag: Visual C# General Local Security Policy Visual C#
An IEquatable<T> object cast to IEquatable<explicittype> results in wrong Equals override called. I've got an object, Person, that supports IEquatable<Person>. It implements bool Equals(Person obj) as well as overriding bool Equals(object obj) I've got a container type that holds a member object of generic type T, that supports IEquatable<T>, and a method, DoComparisons(T obj) to compare the member object to the object passed in. In the method, if I call: member.Equals(obj); Then the Equals(Person obj) overload is called, but if I cast the member to IEquatable<Person> and then call ((IEquatable<Person>)member).Equals(obj); Then the Equals(object obj) overload is called. My question is why The type T should have been resolved to Person when I created my container, why does the first call result in the correct method being called on the interface, whereas when the object is cast to IEquatable<Person> it does not Surely both should be doing the same thing Here's the full code:
Code Snippet
using System; using System.Collections.Generic; using System.Text; namespace EquatableTest { public class Program { static void Main(string[] args) { Container<Person> container = new Container<Person>(new Person("Gary Evans")); Person person = new Person("Gary Evans"); container.DoComparisons(person); } } public class Person : IEquatable<Person> { private string firstName; private string lastName; public Person(string fullName) { string[] names = fullName.Split(' '); this.firstName = names[0]; this.lastName = names[names.Length - 1]; } #region IEquatable<Person> Members public bool Equals(Person other) { Console.Write("Equals(Person other) called."); return ToString() == other.ToString(); } #endregion public override string ToString() { return string.Concat(firstName, " ", lastName); } public override int GetHashCode() { return ToString().GetHashCode(); } public override bool Equals(object obj) { Console.Write("Equals(object other) called."); Person person = obj as Person; return ((person != null) && (ToString() == person.ToString())); } } public class Container<T> where T : IEquatable<T> { private T member; public Container(T t) { member = t; } public void DoComparisons(T obj) { Console.Write("Calling member.Equals() cast as IEquatable<T>. "); bool result = member.Equals(obj); Console.WriteLine(" Result:" + result.ToString()); Console.Write("Calling member.Equals() cast as IEquatable<Person>. "); result = ((IEquatable<Person>)member).Equals(obj); Console.WriteLine(" Result:" + result.ToString()); } } } Tag: Visual C# General Local Security Policy Visual C#
Problems with Setting.settings Hi,
I have a Windows based Application written in VC#.Net 2.0. I have used settings.setting file for configuring several user based configurations. Now I have a form which can change and save the user based configuration of this file.
The problem now is that when I start to debug the application (by pressing F5 of course), the application does not load the updated settings file of the user. Instead it loads the default settings from settings.settings file that I had set up in the application initially. However if I start the application without debugging (i.e. Ctrl + F5), all the new settings are properly loaded and the application works fine.
Can anyone tell me how to make the application point to the updated settings file if I have to start the application in debugging mode I need to debug because there seems to be some logical problem in the application which I need to verify. Please help. Urgent.
Regards
Vineed Tag: Visual C# General Local Security Policy Visual C#
Matt Sipes
I am trying to locate any documentation on how to access Local Security Policy through code...and set them to desired values. Anyone have any ideas Or am I out of luck I already coded up a exe package that will set registry key values...However, I cannot find much information on setting Local Security Policy changes.