|
A host of possibilities have run across my brain just now, but I have not taken the time to look up the proper solution.
1) Look through the documentation for the Graphics class and related classes. There is a strong probability that the answer is in there.
2) Modify your drawing routines to use the location of the controls, rather than using preset pixel counts.
3) Compare the positions of two controls that are always present in your application. In one dpi setting, they will have certain locations, while they will have other locations (and sizes) in another dpi setting. With that information, you could pretty much detect the setting (but it may not be reliable, test first).
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
You can get DPI from graphic:
Graphics.DpiX and Graphics.DpiY
|
|
|
|
|
Is there any other HTML rendering engine around? Preferrably one written in .NET?
Sammy
"A good friend, is like a good book: the inside is better than the cover..."
|
|
|
|
|
I've heard that Mozilla's rendering engine can be used inside an application, but I do not know if it can be used easily from .NET. Have a look on google to see what you can find.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
No it couldn't. Mozilla didn't license Microsoft COM and instead came up with their own. It's very similar in concept (nsISupports is analagous to IUnknown and has three similar methods), but it's still not COM. You'd would have to P/Invoke the entire NSCOM (goes by a different name, but I can't remember it off the top of my head) framework and that would be an EXTRAORDINARY amount of work just to manipulate elements within. The rendering engine itself can be embedded in an OLE container, though.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Can anyone tell me how i can find out if an app has called the FlashWindowEx function through hooking?
I've been trying for a long time and just can't seem to figure it out. And I'm sure it's something very easy since it usually is
Thanks
Carlito
|
|
|
|
|
You mean how to get process names? Process.GetProcesses() ?
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
well, what i'm trying to do is hook into another program and find out when it is calling FlashWindowEx then process some custom code.
|
|
|
|
|
You can use the depends tool on an app to see if it references User32.dll and imports FlashWindowEx . It is available as a Win32 VC Platform SDK tool, if you installed it with visual studio.NET. (It also in VC6.0) If not, search around for it as I'm not sure where else to obtain it.
See Hooks in the MSDN library. "A hook is a point in the system message-handling mechanism where an application can install a subroutine to monitor the message traffic in the system and process certain types of messages before they reach the target window procedure."
A program which is "hooking" may call FlashWindowEx as part of its services, but to determine which program is "hooking" may take some work. I'm not sure how to "walk" the hook chain...I just know how to SetWindowsHookEx; do some callback processing; call CallNextHookEx (optionally,) and finally call UnhookWindowsHookEx when I'm done. Perhaps one of our MS OS gurus may know
|
|
|
|
|
Thank you for your reply, although I'll try to be more clear on what i'm asking.
I am writing a program (program A) that needs to know when another programs(program B) window is flashing in the taskbar.
I am trying to do this by hooking into Program B and finding out when it calls FlashWindowEx.
Is this possible? Are there better ways of doing it?
Thanks again,
Carlito
|
|
|
|
|
What you ask is FAR from easy!
Hooking won't do what you want. You can't hook a function call.
But it can be done by the Win32 debug API. You'd essentially be writting your own process debugger that sets a breakpoint at the spot where your target app calls FlashWindowEx. Then, when the process reachs the breakpoint, your app will be notified with a Debug Event. You do your processing then release your target app to continue running.
I hope your REALLY good with Windows internals.
RageInTheMachine9532
|
|
|
|
|
Dave is right. It's nontrivial. You have to be quite good with the OS internals.
This article in MSDN, Bugslayer may help a *bit*. This may be deeper than C# can easily offer. Also check this out: Debug Help Library 6.1.
|
|
|
|
|
Hey guys, thanks for all the help. I was sure this wouldn't be an easy task but I was hoping I'll let you guys know how my progress on this goes...if at all.
Thanks again,
Carlito
|
|
|
|
|
I think hooking works for events like mouse and keyboard events. FlashWindowEx is an API which doesn't seem to raise any events from MSDN. Don't think its doable in this way.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
Hello,
Is there any way that I can disable a flash movies right click menu?
I am using a flash button I made in my app but I dont want it to be right clickable.
The only thing that I can change is the amount of info the menu shows (by setting showmenu to false). It always shows Settings and About Macromedia...
Is it possible for me to trap any right clicks that are clicked on the flash control?
(I was also wondering, can I subclass the Shockwave Flash Object and trap the right click there?)
Thanx,
-Flack
|
|
|
|
|
If there is a way (I'm not really sure), then this article will take you in the right direction: http://www.codeproject.com/csharp/advhost.asp[^]
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
That only applies to the WebBrowser control which hosts MSHTML, not to objects embedded in it (such as ActiveX controls that control their own behavior through whatever interfaces they support). Besides, it sounds like he's embedding the Flash player directly in his app so MSHTML hosting interfaces wouldn't even apply.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart wrote:
Besides, it sounds like he's embedding the Flash player directly in his app so MSHTML hosting interfaces wouldn't even apply.
You're right. I didn't catch that at first.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
It all depends on what the Flash player supports. Take, for example, the other reply you got (which won't work here). MSHTML (and the WebBrowser control which aggregates it in part) QI's (QueryInterface ) for the host's IDocHostUIHandler implementation (if any) and calls methods to show and modify context menus. Since the host implements this method, the host determines what's in the context menu, if a context menu should be shown at all.
Off the top of my head, I don't know if the Flash player uses a similar method, but there's nothing in the .NET FCL (framework class library) that would override this. Setting the ContextMenu property on the hosting control to null for example won't do anything because the Flash player controls its own menus.
To find out, you'll have to visit Macromedia's site and see if you can find any developer resources that may provide an SDK. Since this is an ActiveX control, if there is a similar interface to IDocHostUIHandler for the Flash player, you can re-define it in .NET (or import the typelib - if available - using tlbimp.exe or VS.NET) and implement it in your host control (the AxHost class derivative, for example).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Is there a way to access an .mdf file to search through, sort, display and retrive entrees from without actually haveing any sql server installed on the machine.
|
|
|
|
|
I don't think so , at least you have to install MSDE.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
hi all,
i'm looking for some help to retrieve some precise information about process :
i want to know how to get the file name & path open by a process.
For exemple, i have readme.txt opened with wordpad.
how can i code in C# in order to see this information ?
thx in advance and sorry for my poor english =)
+
Apusnaias
|
|
|
|
|
If you know the process ID, you can use Process instance you can examine You'll want to look at the Process.StartInfo property.
Process proc = Process.GetProcessById(procId);
ProcessStartInfo info = proc.StartInfo;
Console.WriteLine("Process ID {0}, File Name = {1}", procId, info.FileName);
Console.WriteLine("\tArguments = {0}", info.Arguments);
Console.WriteLine("\tStarted {0}", proc.StartTime);
Console.WriteLine("\tMemoryUseage = {0} Kb", proc.WorkingSet / 1024);
Console.WriteLine("\tModules:");
foreach (ProcessModule module in proc.Modules)
{
Console.WriteLine("\t\t{0} Version {1} Base Address {2}, Entry Point Address {3}{4}",
module.FileName, module.FileVersionInfo, module.BaseAddress,
module.EntryPointAddress,
(module == proc.MainModule) ? " (MAIN MODULE)" : string.Empty);
}
|
|
|
|
|
thx a lot iam, this helps me a lot to go further
but there is a little probleme.
I cannot get the Process.StartInfo property. All fields are empty.
I read somewhere that the Process.StartInfo property can only be retrieve for processes tha have been started with Process.StartInfo property.
if someone has a solution
thx
|
|
|
|
|
I have a class with a private event/delegate model.
[Serializable]
public class MyClass
{
private SomeCollection collection = new SomeCollection();
public MyClass()
{
this.collection.Changed += new EventHandler(this.SomePrivateMethod);
}
private void SomePrivateMethod(object sender, EventArgs e)
{
}
}
I can serialize the following class, however, upon deserialization, I recieve an exception telling me "delegates to non-public methods cannot be deserialized." Ok, I can work around that by changing the accessor of SomePrivateMethod to public . However, I don't really want to expose the SomePrivateMethod as public, as it's used solely for internal use; calling it from another assembly could really screw things up.
So, is there a way around this? I mean, I don't even need to serialize the event handler and delegate, but I haven't found a way to not serialize a particular method of a class.
Any suggestions?
---------------------------
He who knows that enough is enough will always have enough.
-Lao Tsu
|
|
|
|