|
|
I need a pointer to a good article on delegates/events in client/server apps.
Specifically I need the server side to raise an event that all logged on clients can receive and react to.
The server does not need to know if any clients received it.
Searching available resources just gives too many results.
|
|
|
|
|
|
|
Did you handle the FORM's KeyDown event, or one of the buttons??
|
|
|
|
|
Yeah, the following code :
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Down)
{
MessageBox.Show("Pressed");
}
}
|
|
|
|
|
That code snippet will deal with the down-arrow key of your keyboard, and is unrelated to the four buttons your picture is showing, one of which displays "Down" as its Text.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
|
You need to fire events for all 4 buttions and form. If a buttion has focus(If you press tab and then you will see sometimes a dotted border around text.), it will fire an event from a buttion not form-
|
|
|
|
|
No thanks. I'm not going to download, open and study some ZIP file.
You better figure out the difference between keyboard keys and Windows Buttons, then show us the appropriate part of your code if that is still necessary.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
When you say this:
Mohammad Dayyan wrote: but when I press Key.Down
Are you clicking a button or pressing a keyboard key?
|
|
|
|
|
ricmil42 wrote: Are you clicking a button or pressing a keyboard key?
I'm pressing Key.Down of keyboard.
|
|
|
|
|
It is the use of Keys.Down that is the problem.
If you change your code to if (e.KeyCode == Keys.K) , for example, and test it you will find that the event does fire.
So what you need to do is research what the difference is between the way Down and 'K' are processed.
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.”
|
|
|
|
|
Henry Minute wrote: If you change your code to if (e.KeyCode == Keys.K), for example, and test it you will find that the event does fire.
No, it doesn't fire.
this is the application http://www.mediafire.com/?mh01etlgm5z[^]
|
|
|
|
|
It does fire, only Key.Down is the problem. If your application doesn't fire the event, then it's something wrong. I just tried it, it fires event if Keys.A, but no event in Keys.Down.
|
|
|
|
|
Fires fine on my system. For any of the main keyboard keys but not for the cursor control keys, or other 'special' keys like that.
As I said previously, what you need to do is find out what it is that makes those keys 'special'.
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.”
|
|
|
|
|
Hi,
I've searched high and low and couldn't find any source code for encoding\decoding JPEG files for C# (although found plenty in C\C++)
I know that this format is widely supported but I would like to have the source code for reading such a format.
Any ideas ?
|
|
|
|
|
If you're just trying to display it on-screen or get the property items, the System.Drawing.Image class should be all you need
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
The deal is I need the code as I want to develop a variant of the original JPEG format. I want the source code because I don't want to start from scratch.
|
|
|
|
|
You already have some source, all you need to do is convert the code from C/C++ to C#. You'll have to do this by hand since there are no converters to rewrite C/C++ code to C#.
|
|
|
|
|
I thought about porting the code but since the source in C is around 15000 lines filled of complex memory and mathematical operations I have no doubt that doing porting without mistakes will be quite a challenge.
|
|
|
|
|
I didn't say it would be easy, just that it was what you had to do!
You really SHOULD do it this way because, as you said above, you want to develop your own variant of JPEG. Well, you're going to have to understand the code in order to update it with your implementation changes. There's no better way than rewriting it in your own language.
|
|
|
|
|
Hi,
I've created a c-shared matlab library, which I want to use in my solution.
Using DllImport I can initialize the matlab environment, initialize my matlab model
and send parameters to this dll.
All works wel..., except I can't get the results!
In matlab, I've got a simple (test) function which returns a fixed value: 1234.
The created library has the following .h file:
extern LIB_Matlab_Test_C_API bool MW_CALL_CONV mlfMatlab_test(int nargout
, mxArray** steps
, mxArray* test_string
, mxArray* nog_een_test_string);
This is how I interface to the dll:
[DllImport("Matlab_Test.dll", EntryPoint = "mlfMatlab_test")]
static extern bool Matlab_Test(
[Out][MarshalAs(UnmanagedType.I4)]int nargout,
IntPtr return_value,
[In][MarshalAs(UnmanagedType.LPStr)]string myString,
[In][MarshalAs(UnmanagedType.LPStr)]string mySecondString);
And finally, calling the function:
int nargout = 1;
IntPtr pbuf = Marshal.AllocHGlobal(256);
Matlab_Test(nargout, pbuf,"dummy string", "yet another dummy string");
int sOut = Marshal.ReadInt32(pbuf);
Console.WriteLine("\t\tsucceeded! Value = {0}", sOut);
Marshal.FreeHGlobal(pbuf);
The value of sOut always remains zero
Does anyone have an idea of what I'm doing wrong here?
-- Stupidity should be painfull --
|
|
|
|
|
Hi,
I'm not sure what is wrong, however there is an easy way to get native string results; this is my recipe, and it works without any Marshal attributes:
const int CAPACITY=1000;
StringBuilder sb=new StringBuilder(CAPACITY);
NativeFunction(sb, sb.Capacity, ...);
string result=sb.ToString();
[DllImport...] static extern void NativeFunction(string textBuffer, int textBufferSize, ...);
and the native code looks like
void NativeFunction(char* textBuffer, int textBufferSize, ...) {...}
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hey jan,
Is your problem is solved!!
I am stuck with the same problem, I am also getting the return value as 0.
Plz reply
|
|
|
|