|
Actually, all this stuff is already controllable by the CLR (not IE). This means that the control accessed in any way (other than a custom host that doesn't abide by the rules) falls under the same restrictions (see .NET security permissions, policies, code groups, etc. for details). For instance, you could say that any control in the URL http://www.somedomain.com/* or http://www.somedomain.com/somesite/* can have certain IO control, control over the UI and clipboard, and much more (you can even customize these permissions that are used by the code in question but must be installed locally to be used during initialization of the CLR). This shouldn't be a function of IE, and, rightly so, it isn't. It's a function of the CLR - the very thing that "runs" .NET.
That said, IE does enforce some control on ActiveX controls as of late (IE 5.0+). The control must implement certain interfaces and belong to certain COM categories to do certain things, but nothing even close to .NET or Java. IE's security control also gives you some control over what ActiveX can do, but it 1) isn't as restrictive, and 2) doesn't allow for as much "matching" as in .NET. For instance, you can say that signed ActiveX controls from a particular zone can do X, but unsigned ActiveX controls from the same zone can only do Y. And you get 4 zones from which you can choose. This further breaks down into safe ActiveX controls and unsafe ActiveX controls (those that implement those interfaces and catagories I mentioned before. All together, that's something like 4 zones * 2 signed states * 2 safe states = 16 possibilities (roughtly). In .NET, the possibilities are countless (even with the default membership conditions, since granular control is possible).
As for DirectX, that would be kind of cool, but would probably be far too dangerous. SVG (if ever finished / widely adopted) does give you dynamic control over most basic things you can do with DirectX (such as object-oriented graphics, control, and some basic meshes(?)) and is fully scriptable (I think that's the part that's holding up the committee). You could, however, make a .NET embedded control that is a graphics surface with which you could use DirectX, should it be installed on the user's machine (but that's pretty much the case for anything like Flash, QT, etc., sans ActiveX itself on a Windows computer with IE 3.0+).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I think a lot of responces here suggesting writing WinForm UserControl and hosting it inside IE are valid solution in having the same source base.
However, the most important thing is not touched by those answers:
WebForm Control usage doesn't require client to run .NET, while WinForm controls will require .NET runtimes installed on the client.
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
True, good point. Fortunately .Net will be installed everywhere come 2005-2006.
The graveyards are filled with indispensible men.
|
|
|
|
|
True, good point. Fortunately .Net will be installed everywhere come 2005-2006.
... And by that time as described in Avalon/Longhorn preview: Windows Form will be considered "legacy" .NET programs.
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Hahah how the years go by....I suppose by then we'll be running 3d rich GUIs in our Windows apps. Maybe we'll not even need programmers - we'll just tell the computer what to do.
The graveyards are filled with indispensible men.
|
|
|
|
|
Maybe we'll not even need programmers - we'll just tell the computer what to do.
... Hope by that time computers will perfectly understand Chinese
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Hi!
Anybody know how to put IStorage or IStream interface into NET clipboard?
(with example please)
Good Luck
Alex Kucherenko
|
|
|
|
|
This really requires quite a bit of knowledge of OLE/COM. Remember that the .NET clipboard (and drag and drop functions) are just wrappers for their Win32 counterparts. The same stuff is possible, but in many cases you have to recreate some structs, enums, and interface definitions for stuff that is already in Win32. For example, the System.Runtime.InteropServices.UCOMISTream interface already exists, but an equivalent for IStorage does not. You'll have to create an interface with the proper GuidAttribute and interface methods (taking into account marshaling parameters).
To do this correctly, you'll have to implement .NET's IDataObject yourself and recreate structures for FORMATETC and STGMEDIUM . .NET's IDataObject is created specifically for .NET, using objects instead of structs and interface pointers. You'll have to override it to make it work more like COM's IDataObject interface.
After that, simply call Clipboard.SetDataObject(object) or Clipboard.SetDataObject(object,bool) in your client code.
My recommendations, make your IDataObject implementation class take an object (perhaps of a specific type) and some other parameter to dictate whether the implementaiton itself should wrap it up in an IStorage or IStream object.
So, I'm sorry there isn't example code like you asked, but this is actually a very big problem to solve and requires that you read-up on COM to understand it. Be sure to look at FORMATETC and STDMEDIUM . Both contains links to other material that should be helpful.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi!
this is not realy what i want... I mae port of structures and interfaces long time ago, but I think I make something wrong... that is why I ask for example of code.
BTW
Heath Stewart wrote:
After that, simply call Clipboard.SetDataObject(object) or Clipboard.SetDataObject(object,bool) in your client code.
such code will not work with Clipboard implementation provided by NET Framework. That is why I need example with OleSetClipboard and OleGetClipboard API methods calls.
Good Luck
Alex Kucherenko
|
|
|
|
|
Actually, such a call will work if you take something into account that I forgot to mention (sorry). If the data object implements System.Windows.Forms.UnsafeNativeMethods.IOleDataObject , it does work. Unfortunatel, it is a nested interface of an internal class, but the System.Windows.Forms.DataObject does. You can use reflection to set the FORMATETC and STGMEDIUM structs. Calling Clipboard.SetDataObject does, in fact, call OleSetClipboard .
You should try downloading .NET Reflector and take a look at how Clipboard.SetDataObject is done. Like I said, everything you need is already there. You may have to use Reflection to do get at it or you could redefine your own structs and interfaces in the same way it does (except that your IOleDataObject won't be the same Type as theirs, but you can at least make your call to OleSetClipboard work the same).
With that, I can understand how your interface methods aren't always correct. This happens often. I had a custom IClassFactory method with the same params. When I tried a trick where you write IDL, compile it with midl.exe to a typelib, then use tlbimp.exe to import that, the method had a mysterious third parameter. Using Reflector (that can disassemble in a much easier-to-follow way than ildasm.exe, and can also decompile), you can see how MS defined their interfaces and match them. Once you get your IOleDataObject interface defined correctly (remember, don't forget the GuidAttribute ), you can pass the object directly into a correctly imported call to OleSetClipboard .
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I have download a few example on Remoting, but none could run on .NET Framework 1.1. How do I overcome the security settings.
|
|
|
|
|
|
Hi,
I have seen that it's easy to calculate the time a process has been alive, the CPU time spent... But I would like to know the time that the application has been activated or used by the "user" ( I have read that some people uses hooks to the keyboard, would it be possible to retrieve the current focused window and get from there the process id ?).
Greetings
Braulio
|
|
|
|
|
Braulio Díez wrote:
But I would like to know the time that the application has been activated or used by the "user"
Well, "activated" and "used" are two different things, philosophically. For example, I may have several browser windows open that I'm referencing while writing something in Word, which is the only active doc. So, how do you measure which app I'm using? I'm using all of them, active or not!
Still, it would be a cute app to write. I wonder if someone's done it already? (A very brief search on google came up with nothing).
Marc
Latest AAL Article
My blog
Join my forum!
|
|
|
|
|
Hi,
I have seen some software that monitors that usage. I would be happy just having the time that the user has a windows active ( and it's doing something with it), the CPU time consumed is not valid for me because a Math app can consume more, and surf in the internet or write a doc in Ms Word doesn't consume much CPU...
Braulio
|
|
|
|
|
The user can open the app without using it. To calculate the real time of usage, I think you can use Form.KeyPreview and the Mouse-Events.
1) Mouse enters the main form: Capture the time
2) Mouse leaves the main form: Capture the time
3) Calculate the time span
While the user is typing, the mouse cursor can be anywhere on the screen, so you have to define a maximum time span between two keys:
1) Key is pressed: Capture the time
2) Another key is pressed: Capture the time
3) Time span is longer than the timeout: The app has not been used since the first captured time.
|
|
|
|
|
Mmmm. but how to do it for any process ( e.g. I want to know how much time did somebody spent really using Ms-Word).
Braulio
|
|
|
|
|
As has been pointed out , just 'cos an app is active does not mean it is being used. I could run up word and then go for a coffee. Or I could run up word and type as 120 words per minute or 4 words per minute , they would all come up with the same result for word useage but not for any 'real productivity'.
The altenative is to simply look at the statistics for the word document , but even that needs interpreting , I could be typing slow because I do not want to go fast , or because I am thinking so hard I cannot go fast .
If you are happy with the time the app is loaded then it is easy , but getting more useful information is very difficult since it all needs interpretation . What specific problem are you trying to solve.
|
|
|
|
|
I have more than one Table in a DataSet,How can I REQUERY one of them without interacting with other one or disposing dataset itself?
Mazy
No sig. available now.
|
|
|
|
|
If you use a DataAdapter , call its Fill method against on the same DataSet using a different DbCommand that only queries info for that table. Be sure to read the docs on the appropriate data adapter (like SqlDataAdapter ) because there are other things you might want to be mindful of, so that changes in the DataSet don't get updated on the database itself while filling the DataSet .
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi, we are making a tool for extracting data from our companys database.
in hte current version you can build "queries" and execute them.
the tool is to be used by idiots* so the gui/behavior may not be to hightech.
in the current version you can build query filters like:
customer = 1234 Tacco Locco
product = 50050 coca cola
the criterias are then "and"'ed together
this works fairly good , BUT , it would be very nice to be able to build filters that is not just "and"'ed
so now to my question , how should one design the gui for such thing in order to keep the filter builder simple ?
what would be the most intuitive way to build such filter?
say i want to build the filter:
customer=123 and (product=666 or product=777)
the users are far to dumb to understand ( ) groups , so thats not an option :/
any ideas?
//Roger
|
|
|
|
|
This may require more coding than you like, but perhaps you could take a page from Microsoft Access and allow graph-driven query building. A lot of idiots use Access (as opposed to SQL, Oracle, et. al. RDBMS's) so your answer may lay there. Just allow them to draw some shape around a group of graphical filters and choose whether to OR or AND them (or whatever else trips your trigger).
Just my $0.02.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
One way to do this is to create a couple of objects. You can create a Criteria object which will store one criteria. Also create a Query object which will store a collection of criteria objects.
The way I have done this myself is the criteria stores the name of the field and the values. For example, the field name would be Customer and the value would be 123. I have one method which returns a user friendly display string and another which will return the SQL. I have made it so the values are delimited so I can store multiple values. If the field was Product and the value was 666,777 I would then parse the values and when building the SQL I would or those values together.
The query object should expose a method to return the whole SQL statement. It should build the select then ask each of the Criteria items for it condition statements. It should wrap each criteria item in () and AND each one together.
I made a screen shot of how I made the GUI. http://www.desertware.com/images/queryscreen1.jpg
This is quite a bit of work, but in the end it pays off by having a powerful yet easy to use query builder.
Larry Allen
Desertware Technologies
|
|
|
|
|
Here is button click event code:
private void btnCompile_Click(object sender, System.EventArgs e)
{
string srcFile = @"D:\Temp\WindowsApplication6\Form2.cs";
string destFile = @"D:\Temp\WindowsApplication6\Form2.dll";
try
{
CompileCode(srcFile, destFile);
System.Reflection.Assembly a =
Assembly.LoadFile(destFile);
if(a != null)
MessageBox.Show("Ok");
System.Type type = a.GetType("Form2");
object obj = Activator.CreateInstance(type);
Form form = obj as Form;
}
catch(Exception ex)
{
MessageBox.Show(ex.Message + ex.StackTrace);
}
}
In the above code, function CompileCode(string srcFile, string destFile) is defined by me to compile the srcFile(.cs file) into the destFile(.dll file).
No doublt to say, every time execute this function, application will write the .dll file. The problem is when the code is executed for the second time
,there will be a exception which say that access collision,another application is accessing the .dll file.
Yes, I think that when the code execute for the second time, the dll has loaded into the current application domain, so cannot write into it. I have ever try to load the dll into another application domain in order that unload
the application domain after I have used the assembly. But some document say that when return assembly object of an appdomain into another appdomain, the later appdomain will also load the assembly. The problem also cannot be solved.
So I'd like to ask how can I realize the functionality of above btnCompile_Click()function?
Waiting for your answer.
Thank you!
|
|
|
|
|
Are there any reasons why you loading the assembly?
Have a look at my Plugin Manager article. It mite serve your purpose.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|