|
OK,here is the source code::
// in the main function , do the following
MyMessageFilter msgFilter = new MyMessageFilter();
System.Windows.Forms.Application.AddMessageFilter(msgFilter);
// filter implementation
public class MyMessageFilter : System.Windows.Forms.IMessageFilter
{
public bool PreFilterMessage(ref System.Windows.Forms.Message m)
{
//custom message is 0x0800,...
if (m.Msg == 0x8000)
{ System.Windows.Forms.MessageBox.Show("Data ming" + m.Msg);
}
return false;
}
}
// and in dll , two way of send message
...
case 0x8000: PostMessage(...);break;
case 0x0801: SendMessage(...);break;
the problem is only the message by PostMessage can be trapped in the filter.
is that strange????
|
|
|
|
|
Does the DLL function that executes PostMessage/SendMessage run on the UI thread that is running the message pump for the HWND to which you send/post messages?
For eg, if your DLL function gets executed when the user clicks a button (on the HWND that you are sending/posting messages), then SendMessage will directly call the WndProc and won't go through the message pump. Which also means that the message filter won't work.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
the Dll is in another thread,
its really confusing...
|
|
|
|
|
I know it is impossible to set for two forms at the same time the state of active, but it is possible set for both (or more) the title bar in "active state" (just the aspect).
I know it is possible overrinding some Windows message in WndProc.
Can you tell me how?
Please it is very important.
Thanks.
|
|
|
|
|
Active in what sense? If you mean you need the user to be able to switch between the two forms , it is possible with modeless forms. Just call Show instead of ShowDialog .
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
You are absoultley out way.
I mean photoshop's like GUI. its toolbar is a child form that remain like active at the same time of the main...
I need to override some winows message, but none know what?
|
|
|
|
|
Oh, you mean MDI style applications? That's fairly easy, you don't need to override WndProc for that. All you need to do is set the main form's IsMdiContainer property to true and set the MdiParent property of child windows (toolbox, in your example) as the main form itself.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
i don't want a mdi application just a free child form
|
|
|
|
|
He want's the title bars of both forms to show active at the same time. In WindowsXP default, both title bars would be blue instead of one being blue and the other form fading to light blue. He's asked this question a few times now.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have two interfaces on the server side.
they are implemented such as:
<code>
public class IndexServerObject : MarshalByRefObject, ISend
{.....}
public class PeerClientObject : MarshalByRefObject, IPeer
{....}
</code>
however when I try to call them from my client only the second executes...why???? the PeerClientObject works, but not the first one...do I need to have multiple channels?
my client app is doing this:
<code> RemotingConfiguration.Configure "PeerCLientForIndexServer.exe.config");
IndexServerApp.IndexServerObject indexServer = new IndexServerApp.IndexServerObject();
IndexServerApp.PeerClientObject peerClient = new IndexServerApp.PeerClientObject();
</code>
this is the config file for the server:
</code>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application name="IndexServer">
<service>
<wellknown mode="Singleton"type="IndexServerApp.IndexServerObject, IndexServerObject" objectUri="IndexServer" />
</service>
<channels>
<channel port="9000" ref="tcp">
<clientProviders>
<formatter ref="binary" />
</clientProviders>
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>
<lifetime leaseTime="1M" renewOnCallTime="2M" />
</application>
</system.runtime.remoting>
</configuration>
</code>
and the client side:
<code>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application name="PeerClientForIndexServer">
<channels>
<channel ref="tcp" port="0"/>
</channels>
<client>
<wellknown type="IndexServerApp.IndexServerObject, IndexServerObject" url="tcp://localhost:9000/IndexServer" />
</client>
</application>
<code></system.runtime.remoting>
</configuration></code>
</code>
_ra
|
|
|
|
|
|
Hi everyone
I have a base form, which have some code in its _Load event, which tries basically to get all the components in the inherited form, took the ones which are Entities ( a component developed by us) and change some properties in the control.
The is working, but only for the component in the base form
Even I can get the inherited form in my event in my base class, and I can see the components collection variable, I can't use it directly, because I must done a cast to the inherited class, and if I do so, it does not work for other classes...
I've research a little, and know that by reflection I can do what I want, but I would like an easier way....
I tried to use the Site form's property, as it is the one that is used in desig time, but it didn't work....
Some suggestions?
I'm really afraid of using Reflection...
Thanks
BG
|
|
|
|
|
Reflection is easy, but slow. Can you specify an interface for the classes you need to access, so that you can use get/set methods defined in the interface that are common to all the classes you need to work with?
Marc
My website
Latest Articles:
Undo/Redo Buffer
Memento Design Pattern
|
|
|
|
|
Thanks Marc
I don't think I can do that. I am using (yes, I have to use reflection) reflection because the variable I need to use is form1.components (or form2.. or frmXXXX.. ), which is created by the NET designer when an user drops a component, so I ask for that name (the designer sets it , so I do not think it coult change, at least in this release )
Type otp = form.GetType();
FieldInfo ofi = otp.GetField("components", BindingFlags.Instance | BindingFlags.NonPublic);
IContainer ocomps = (IContainer)ofi.GetValue(form);
the code itself is pretty simple and understable, and I get in ocomps the components in my inherited form which I needed, but I still not liking reflection...
and I can't use an interface, because that will force the developer to assign the internal variable created by the designer to some property, and worst, if someone forgets to do , my code will not work....
This way, the developer only have to inherit from my base form, and nothing more
Thanks
BG
|
|
|
|
|
can anyone help me in finding the dll version of a dll file using C#?
|
|
|
|
|
|
can you please explain me in detail ?
|
|
|
|
|
I need to find a dll's version. which is stored in a particular location & not the dynamic dll.Its not .NET application's dll.
Can u help me out plz
|
|
|
|
|
I would LOVE to see an Article that steps the reader through creating some sort of Custom Evidence. Serializing that evidence and compiling the result into an Assembly using the 'AL' utlity. Then implementing a Custom Membership condition evaluating the Custom Evidence. Correctly adding the Xml representation of the Custom Membership to a Code Access Security (CAS) Permission set and GAC. Finally, the article could finish off by executing the Original Assembly that the evidence was compiled into and seeing if it actually works!
Basically, I don't see enough information out there that describes an end-to-end scenario where Custom Evidence, Membership Conditions, and Permissions/Permission Sets are implemented and used. Yet I CAN see why these could be useful. (Like if you wanted to limit the Time of day that an assembly was allowed to execute or something like that.)
Chad Stoker
|
|
|
|
|
Hi,i am making an application in C#, in which i am using calender, but i am facing problem in checking that the selected date is bolded or not,can anyone help me,i will be very thankful.
|
|
|
|
|
If you are referring to a Windows Forms MonthCalendar control, you set the bolded dates via monCalendar.AddBoldedDate() and you see which ones are bolded by looking at monCalendar.BoldedDates.
|
|
|
|
|
thanks for u r reply, actually i want to know, when any user click on any date "that selected date was bolded or not"?
|
|
|
|
|
So get the BoldedDates array from your MonthCalendar and check whether the date your user clicked on is inside the array.
www.troschuetz.de
|
|
|
|
|
Actually I think boldness of the date is particular property of the cell (where the user click), and I want to check that property of selected date cell (is it bold or not). Otherwise traversing in whole array will be very lengthy process. So can we check it?
|
|
|
|
|
AFAIK you can't check it and need to work with the array returned by the BoldedDates property.
www.troschuetz.de
|
|
|
|