|
You could begin by overriding the WndProc method and watch to see the message you send when pressing those special buttons, if at all. You could also try to override the onKeyPress method as well to see if you get a reaction from Windows. No guarantees here though as I am not exactly sure this would work, just a thought.
Nick Parker
|
|
|
|
|
k and how can i override the WndProc, do u have an example please ??
|
|
|
|
|
protected override void WndProc(ref Message m)
{
switch(m.Message)
{
.....
}
base.WndProc(ref m);
} [Edit: The value to use for the case statment can be found in the Windows SDK; best thing you can do is use the "Find in Files" feature and point it at the PlatformSDK/include directory]
HTH,
James
|
|
|
|
|
hi,
i tried to override it using the WM_KEYDOWN like in VC++ but no result, i test my sample app with a listbox so when i'm clicking a key i'm suppose to get his value but no result and something strange it's that i tried to make the same thing but using the OnKeyPressed an no result too , that's strange ...
Can you show me the way to do it please ?
Thanks a lot James
|
|
|
|
|
Thanks James, I just got into work and got the response from BLaZiNiX, you just beat me to it.
Nick Parker
|
|
|
|
|
Is there a way to create a class named after the value of a variable?
Let me explain what i'm trying to do.
A thread is started that monitors a port for connections. When a connection is made I want to make a new instance of a 'connectedClient' class (to handle sending/recieving from that client). How can i 'randomly' name a class instance (I can't have all my connectedClient class instances share the same name) and how can i keep track of their names (maybe an array?).
Thanks, from someone with only php experience (don't do much threading in scripting languages)
|
|
|
|
|
You don't.... The variable name is just a name for the programmer to reference.
I would create a Hashtable and use the name as the key; storing the relevant connectedClient instance in the table.
Hashtable clients = new Hashtable();
CreateNewClient(string name)
{
connectedClient c = new connectedClient();
clients[name] = c;
}
connectedClient GetClient(string name)
{
return (clients[name] as connectedClient);
} HTH,
James
|
|
|
|
|
Short question, from a C++er to you C#ers
Is it at all possible to use old standard dlls in c#
If yes I might consider learning C#.
Greatful for any answer.
Hugo
|
|
|
|
|
huggeh wrote:
Is it at all possible to use old standard dlls in c#
Yes, via P/Invoke... Look at DllImportAttribute , StructLayoutAttribute , and Marshal classes.
James
|
|
|
|
|
I have a small problem, I know that for testing for key press you use the keypress message handler but how can I test which key was pressed (for example the Escape key)?
|
|
|
|
|
if(e.KeyChar == asciicode)
{
}
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
Thank you but I had figured it out on my own and had forgotten to delete the thread
|
|
|
|
|
don't delete threads - some people might be searching this forum for solutions when they have a similar problem...
:wq
|
|
|
|
|
Hi everybody!
I would like to have toolbar and statusbar on the CrystalReportViewer -- modified (additional buttons, other graphics .., etc., additional panels)
What is the best way to do it?
I am using .NET studio and C#...
Thanks in advance...
|
|
|
|
|
I have one c# application containing Picture(Bitmap). I have one MFC dll thrugh which I want to change the bimap by sending message
like
LRESULT lResult=::SendMessage(hwndImage,STM_SETIMAGE,(WPARAM)IMAGE_BITMAP,(LPARAM)hBmpToSet);
returned lResult is 0
But It's not working. Plz help me !
VIKS
|
|
|
|
|
The Bitmap stored in your C# application isn't an HBITMAP, it is a GDI+ Bitmap; which could be part of the problem. Create your own message to send to the application then in that applications WndProc trap the message and use Bitmap.FromHBitmap to convert it to a GDI+ Bitmap.
Hope that makes sense,
James
|
|
|
|
|
thanx . I tried with Bitmap.FromHBitmap . It just works fine
Now I have one more problem. I have Bitmap on the c# application. Whenever I clicks on that Bitmap. I want it get WM_LBUTTONUP Message. But is directly goes to the handler. NO any WM_LBUTTONUP. In case of normal MFC application the thing are in this sequence .WM_COMMAND then WM_LBUTTONUP.but WM_LBUTTONUP
message is missing in c# application.what I need to do?
VIKS
|
|
|
|
|
You need to trap the MouseUp event on the control/form you are interested in. I assume the bitmap is displayed in a PictureBox (the MouseUp event is defined by Control, which all controls inherit from).
If that isn't the case how are you displaying the bitmap?
James
|
|
|
|
|
The case is simaple as above.Actually I am developing a utility like SPY++ in c# using some MFC routines
Sir using above event handling idea I got solution for my problem. I am very happy with this.Many many thanx .
VIKS
|
|
|
|
|
I Wrote one application (just having one form with some common controls).
It contains Wndproc. But the messages like WM_INITDIALOG and WM_COMMAND are not coming in my proc. Plz help me !
My proc is like this
protected override void WndProc(ref Message Am)
{
switch(Am.Msg)
{
case WM_INITDIALOG:
break;
case WM_MOUSEMOVE:
break;
case WM_LBUTTONDOWN:
break;
case WM_LBUTTONUP:
break;
case WM_COMMAND:
break;
}
base.WndProc(ref Am);
}
VIKS
|
|
|
|
|
Why do you want to handle these WM_ messages??
for example: Why not add the Load event to the form instead of WM_INITDIALOG?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
I know in PreFilterMessage you are able to 'cancel' incoming messages, but it possible to process the messages here ?? I need process WM_NCHITTEST and return e.g. always HTCLIENT.
Exist something like PreProcessMessage where you are able to preprocess all messages which are incoming into app ?
Thanx.
W.
|
|
|
|
|
You can use WndProc for that. It is not necessary to use PreFilterMessage
|
|
|
|
|
yes it is possibility, but Iam writing program like form desinger and I need ever when is called WM_NCHITTEST process this and return HTCLIENT ...Do you know how to do this ?
W.
|
|
|
|
|
I assume you're changing it to HTCLIENT so that the user can't drag the form around, correct? If thats the case just don't let the message be dispatched to the form (return true from PreFilterMessage).
James
|
|
|
|