|
Ok, then perhaps this is saver:
public struct AtomicInt
{
Int32 m_value;
public AtomicInt(Int32 value)
{
m_value = value;
}
public static AtomicInt operator++ (AtomicInt ai)
{
int i = Interlocked.Increment(ref ai.m_value);
return new AtomicInt(i);
}
public override string ToString()
{
return m_value.ToString();
}
}
|
|
|
|
|
I'm still not sure if this is handled correctly internally.
As I guess, what the IL really does is
AtomicInt x; <br />
++x;<br />
==>
<br />
AtomicInt x;<br />
x = AtmicInt.op_Increment(x);<br />
which wouldn#t work as intended. I guess I should check with reflector.
|
|
|
|
|
I assume, that's correct, but then you have to protect the Increment operation (e.g. per lock on any object) outside of the structs code, and this is not what you want ...
|
|
|
|
|
A struct should generally be immutable, so perhaps you should make it a class after all.
---
single minded; short sighted; long gone;
|
|
|
|
|
Guffa wrote: A struct should generally be immutable
But the inbuild structs are also not, eg: Rectangle.Offset()
|
|
|
|
|
Yes, some structures are not immutable, but most are. It has been questioned many times if making those mutable was a good move or not.
If you make a mutable struct, you should be aware that it doesn't work as a property in a class, you can only use it locally.
---
single minded; short sighted; long gone;
|
|
|
|
|
can anyone tell me why the hell do I get up site down question marks when I try to save Arabic text in Oracle?? it's a simple database application created using VS 2005 wizard.
Please guys help, I've been working this out for a week now!! I'm really desperate now
Thanx a bunch guyz
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Didn't you ask this before ? Are you saving to nvarchar, so the strings can be unicode ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hey,
Is it possible to generate the encrypted string(output of maximum 15 characters) of fixed length using Rijndael encryption or any other symmetric algorithm?
If anybody knows pls let me know.Its very urgent (:-
Thanks
Kusuma
|
|
|
|
|
Please don't post the same question multiple times.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
the 15 char limit spells homework to me. WHy break one rule when you can break several.
--
CleaKO The sad part about this instance is that none of the users ever said anything [about the problem].
Pete O`Hanlon Doesn't that just tell you everything you need to know about users?
|
|
|
|
|
Kusumasrinivas wrote: Is it possible to generate the encrypted string(output of maximum 15 characters) of fixed length using Rijndael encryption or any other symmetric algorithm?
Of course it is. If the algorithm you want is not in the system.cryptography namespace, then you need to write an implimentation of it. If the algorithm generates < 15 chars, it's not very secure. You can truncate a string to 15 chars, which, again, makes it less unique, obviously.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
We have a program that allows users to view different controls in a toolbox and then drag them onto a webpage to create there own pages with controls.
The problem is that im having trouble loading one of my DLLs. I get a BadImageFormatException, but since this error is vague im unsure where to start since this problem has only started recently and there have been no major code changes to the DLL.
Has anyone else had any experience of this error and what was causing it?
Regards,
Gareth.
|
|
|
|
|
This exception is thrown when the image format of the file is corrupt. I would try recompiling/redeploying it to see if this clears it up. Also, if this is a 32 bit image being deployed in a 64 bit process, this exception is thrown.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi Pete,
I've tried both ideas you suggested but none worked :/
I noticed at the end of the exception it said "The module was expected to contain an assembly manifest." any ideas?
Regards,
Gareth.
|
|
|
|
|
Take a look at the IL for this module? Does it contain .assembly ...{} anywhere?
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi Pete,
After spending 5 hours trying to figure out this problem, i finally did!. After using ildasm to check out the dll in the build directory and the downloaded dll from the server which is held locally on the users pc, i found out that the local version was corrupt.
It was corrupt because of the way i was FTP'ing over the file to the server, my ftp client was set to asci instead of binary.
Thanks for your help tho!
Regards,
Gareth.
|
|
|
|
|
No bother - glad you got it sorted. But now you know how to tell if the assembly module is specified in IL
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I am using DataGridView to display records. I want to use separate data entry form to enter data instead of DataGridView’s add row. How can I position the data entry form to datagridview’s selected row.
Ideas or existing code would be great
M.Sendilkumar
|
|
|
|
|
I am developing a windows based application which has several data entry forms. All I want to develop as user control. User control will be loaded in to the main form when respective menu clicked by the user. Here I am facing some layout and look-n- feel issues. When the main form resized by the user all other UI controls should also be resized. How I can achieve this? Is there any default scaling mechanism available in .net 2.0.? Help me..!
M.Sendilkumar
|
|
|
|
|
Hi,
I want to start a new application from my C# program.(this part works )
This new window should then get maximized and topmost.
I tried it with WinAPI calls but I was not successful.
Is there a way to do this ?
Thanks in advance,
outerlimit
|
|
|
|
|
The Form has a boolean TopMost property ,
set it to true then will topmost ,
if their two application runs ,and both of them set TopMost to true ,
then ,which one modified last will be effective ,
|
|
|
|
|
You should post your code so we can see what you're trying
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello,
You have to use the MainWindowHandle property of the process in combination with BringWindowtoTop method of user32.dll.
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern int BringWindowToTop(IntPtr hwnd);
public IntPtr HWND_TOPMOST =(IntPtr)(-1);
public IntPtr HWND_NOTOPMOST =(IntPtr)(-2);
System.Diagnostics.ProcessStartInfo psi;
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;
psi.FileName = "???.exe";
using(System.Diagnostics.Process process = new System.Diagnostics.Process())
{
process.Start(psi);
process.WaitForInputIdle();
BringWindowToTop(process.Handle);
}
Hope it helps!
All the best,
Martin
|
|
|
|
|
Hello everybody!
I need to write a windows application, that will do following things:
The form has:
Several Buttons, PictureBox, ComboBox.
A button, called "Detect Cameras". By the clicking on it, in the combo box will appear web-cameras, that attached to a PC. User can choose one of the attached web-cams.
When a user made his choice, the PictrueBox will show a stream from selected web-camera.
The second Button, called "Start Recording" will capture this stream to the local file in a new thread.
The third Button, called "Stop Recording" will finish the recording into the local file.
The fourth Button, called "Start BroadCast" will start the broadcast over the internet of the stream in a new thread.
I don't have too much expirience in win. app. programming, even less in directshow so I'll be very glad to recieve any help.
Thanks in advance.
|
|
|
|