|
Additionally, for even more speed, you might try this out as a little COM automation funtion written in C++. It is such an easy one to write, that it would be worth a try.
I did a routine to calculate hashes for files this way and it was significantly faster. I don't know how much of that was due to the IO speed vs. calculation speed. I would suspect since you wouldn't be doing too much calculation, you wouldn't get as much performance increase, but probably enough to justify doing it this way.
Matt Gerrans
|
|
|
|
|
Hi,
Is there a way to perform a foreach loop on all the elements of an enumeration?
Thanks
|
|
|
|
|
you can do:
enum MyEnum
{
One,
Two,
Three
}
foreach (MyEnum me in Enum.GetValues(typeof(MyEnum))
Console.WriteLine(me.ToString());
|
|
|
|
|
Hello, I have created a Solution in C#.Net which consists of 3 separate
projects and numerous dependency files which are organized into
directories such as databases, images, usage files, etc. When the
program runs, it searchs for the various files it needs in each of
these directories. I am now working on creating an Installer project
for this Solution so that it may be simply installed on a user's
computer. I have added all of the necessary files to this
Installer/Set-up project and I see that it is possible to specify where
these files are installed onto a new computer but changing the "Folder"
property for each dependency to either "Application Folder", "User's
Desktop", or "User's Programs Menu". I would like to know how I can
specify that a dependency file be installed to a custom location such
as "Application Folder/images/". There must be some simple way to do
this that I am just missing. Any help would be much appreciated.
Thank you.
|
|
|
|
|
I am a newbie in C#. I tried to build a COM+ application by creating an interface like this:
public interface ITest
{
int sum(int x, int y);
}
then I created a class which inherit from ServicedComponent and this interface.
After that I complied and deployed it by using regsvcs. Everything seemed to be fine, but when I checked my COM+ from COM Admin, I not only saw the inferface but also the class methods.
It doesn't seems right because normally, only the interface's method should be there.
What did I do wrong here?
Thanks,
Tommy.
|
|
|
|
|
i need before to show my application create some object that is i need to set
// declarations
...
// this panel is showed in the form
private System.Windows.Forms.Panel panel1;
// this is just a needed-in-memory panel
private Panel myobject = new Panel();
...
private void InitializeComponent(){
this.panel1 = new System.Windows.Forms.Panel();
}
// now i have
private Any_Inithialize_Function(){
myobject = panel1;
}
if i do it in Main, onLoad, onPaint funtion (as Any_Inithialize_Function) i get memory error becouse panel1 is not yet created.
|
|
|
|
|
Assigning it right after InitializeComponent (in the Form's constructor) should work fine.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
if you mean write that line inside InitializeComponent it is deleted when i run the debug.
So it doesn't work.
|
|
|
|
|
I think he meant you should put your call right after the call to InitializeComponent inside the constructor.
|
|
|
|
|
I tried using the toolbar of VS.NET. And found that, it does not show the alpha region of the icons perfectly. I have tried using maximum color depth in the imagelist that was associated with the toolbar, and also tried using PNG images.
Nither of my approaches succeded
Is there any way to show the icons perfectly ??
thanks in advance.
|
|
|
|
|
are your png real 32bit files?
Sometime (it is a visual studio bug) it doesn't work, you have to delete all these image from the imagelist and reload them all in the same time.
Other bug become if you use not good png images. That is you have to make much attention at antialising your image when you draw it in your graphic program, i advice you to don't use much antialising.
Make me to know.
|
|
|
|
|
I am using 32bit PNGs. and also tried reloading the images but that did not work
|
|
|
|
|
so try to redraw these images using not strong antialising
|
|
|
|
|
|
I have a dum guestion... how do i declare an array of clases, an array in wich every element is a class i tried
class SomeClass
{
public int x;
public int y;
};
SomeClass[] a=new SomeClass[5];
everything goes ok.
when i run the prorgam and i try smth like :
a[3]=4; the program throws an exception.. pls help me..
|
|
|
|
|
For each class in SomeClass[] you need to do a SomeClass[i] = new SomeClass(constructor)
Then you can access the values like: SomeClass[3].x = value;
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Ok.. pls show me how to make such a constructor.. thx
|
|
|
|
|
If you don't need one, then just don't declare it.
A simple SomeClass[i] = new SomeClass(); will be enough then.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hey, thx
|
|
|
|
|
when i build a window application using crystal report
the application run well on the perticular system where it is build but
if i use to run this application on another system in which there is only Dot Net Framework 1.1
its gives an error " KeycodeV2.dll "
plz give me solution
help me its urgent
Viren
Never Think That You Have Failed Instead Always Think That u hav Better Chance Next Time...
|
|
|
|
|
Is Crystal Reports installed on the other machine?
The KeyCode dll is used for the Crystal Reports licencing check. I usually create an MSI that uses the Crystal Reports merge modules and set the key-code property to the licence key. I then install this onto the destination machine along with my app.
How you install the runtime depends on if you are using the version of CR that comes with Visual Studio or a full version.
See here[^] or this pdf[^] or visit the Crystal website[^]
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
Hello,
I'm trying to read registry value using the API functions RegOpenKeyEx and RegQueryValueEx along with DllImport in C#(I'm aware of C# inbuilt registry access but I need to do it in this way). The results show that code runs fine but I'm not getting the desired data. Its returns 0 instead of the data. I'm including the code that I'm using
//*** declarations in the class *****
public static readonly UIntPtr HkeyLocalMachine = (UIntPtr)0x80000002;<br />
<br />
public const string lpSubKey = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";<br />
<br />
public const int KEY_QUERY_VALUE = 0x1;<br />
public const int REZ_SZ =0x00000002;<br />
<br />
[DllImport("advapi32.dll",EntryPoint="RegOpenKeyEx")]<br />
public static extern int RegOpenKeyEx_DllImport(UIntPtr hKey,string lpSubKey,uint ulOptions,int samDesired,out IntPtr phkResult);<br />
<br />
[DllImport("advapi32.dll",EntryPoint="RegQueryValueEx")]<br />
public static extern int RegQueryValueEx_DllImport(IntPtr hKey,string lpValueName,int lpReserved,out uint lpType, IntPtr lpData,out uint lpcbData);<br />
<br />
<br />
IntPtr hKeyVal;<br />
uint lpType;<br />
uint lpcbData;<br />
IntPtr q=new IntPtr();<br />
<br />
int valueRet=RegOpenKeyEx_DllImport(HkeyLocalMachine,lpSubKey,0,KEY_QUERY_VALUE,out hKeyVal);<br />
<br />
valueRet=RegQueryValueEx_DllImport(hKeyVal,"ProcessorNameString",0,out lpType, q,out lpcbData);
Output when viewd using different variables :
lpType= returns 1 which signify a string value
q returns 0 *** this should return data but does not
lpcbData returns 48 signifying size of the data being returned.
The return values of the functions show 0 which means success
Any help or insight on "Why I'm unable to get the data" would be highly appreciated.
Thanks
Rahul Sharma
|
|
|
|
|
Is there no one who can help me out with this code!!!!!!
|
|
|
|
|
use instead..
RegQueryValueEx( _
ByVal hKey As IntPtr, _
ByVal lpValueName As String, _
ByVal lpReserved As Integer, _
ByRef lpType As Integer, _
ByVal lpData As System.Text.StringBuilder, _
ByRef lpcbData As Integer) As Integer
in DLLImport change it to StringBuilder and then retrive value out of it...
code sample:
[DllImport("advapi32.dll", EntryPoint = "RegQueryValueEx")]
public static extern int RegQueryValueExA(int hKey, string lpValueName, int lpReserved, ref uint lpType, System.Text.StringBuilder lpData, ref uint lpcbData);
uint lpType= 0;
uint lpcbData = 1024;
string keyValue = null;
StringBuilder keyBuffer = new StringBuilder(1024);
RegQueryValueExA (hSubkey, "Description", 0, ref lpType, keyBuffer, ref lpcbData);
keyValue = keyBuffer.ToString();
|
|
|
|
|
Hi,
Is ThreadPool in .NET have work for window 2000 or above machine ?
And why there are no maximum threads setting in the ThreadPool class ?
Thanks
|
|
|
|