Sign in to follow this  
Followers 0
GtaSpider

Possible to access System.Windows.Forms?

22 posts in this topic

Hi all

Is it possible to access to System.Windows.Forms? It's a kind of Net.Framework.

I want to command the System.Windows.Forms.Application Object like in Delphi (Application.COMMAND, e.g. Application.Run)

I tried it with ObjCreate("System.Windows.Forms") but this will return error code 1 :)

Here i found two links, but they dont help me: Here and Here.

Can anybody help me? Or is there a other way to makes this with AutoIt?:

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(true);
Application.Run(new GlassForm());

This is Delphi.

Mfg / BEst Regards Spider


www.AutoIt.de - Moderator of the German AutoIt Froum

Share this post


Link to post
Share on other sites



I have never tried calling .Net through COM. You have to load mscorlib first though, and call other assemblies through that, if I recall. You could also just write your own assembly that has a COM object exposed, register it, put it in the GAC and all that. Then call your own COM object because it was written differently.

Share this post


Link to post
Share on other sites

And how to write my own COM obj?

If it would possible i dont wanna have extra files..


www.AutoIt.de - Moderator of the German AutoIt Froum

Share this post


Link to post
Share on other sites

If you know .Net, and you know how to use the MSDN, then you can write a .Net COM object.

If you don't know .Net, then you shouldn't be trying to use it through COM.

Share this post


Link to post
Share on other sites

Ah well, i see, thank you for your .. uhm.. constructive post :)

Anyone know how to acces the function "SetCompatibleTextRenderingDefault"?

What i want to do with this? Maybe you know DWM (Vista's destopmanager). I want to blur professional things. I need this function, so the windowtext would be showed :P

I hope somebody can help me.

Thanks, your Spider


www.AutoIt.de - Moderator of the German AutoIt Froum

Share this post


Link to post
Share on other sites

You can work with certain .NET objects:

$DataList = ObjCreate("System.Collections.ArrayList")
$DataList.Add("B")
$DataList.Add("C")
$DataList.Add("E")
$DataList.Add("D")
$DataList.Add("A")
$DataList.Sort()
$DataList.Reverse()

For $strItem in $DataList
    ConsoleWrite( $strItem & @CRLF)
Next

Share this post


Link to post
Share on other sites

Hi

Thank you for you comment, but this wont work for System.Windows.Forms :) I also tried the same:

$oNET = ObjCreate("System.Windows.Forms") ; <<--- This return an error
$oNet.Application.SetCompatibleTextRenderingDefault(true)

Your Spider


www.AutoIt.de - Moderator of the German AutoIt Froum

Share this post


Link to post
Share on other sites

This script will show you the accessible classes:

#321230

On my system, it doesn't list any System.Windows classes.

Share this post


Link to post
Share on other sites

This script will show you the accessible classes:

#321230

On my system, it doesn't list any System.Windows classes.

Do you use XP or Vista? On my XP there is also not this group, but on Vista it is.

Here is a link wich says that there is a NET obj that calls on "System.Windows.Forms": http://msdn.microsoft.com/en-us/library/sy...dows.forms.aspx

Wait, i will boot now Vista, and tell you what the script u linked to said to me, thank you :)

Your Spider


www.AutoIt.de - Moderator of the German AutoIt Froum

Share this post


Link to post
Share on other sites

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(true);
Application.Run(new GlassForm());
I read something about it and I don't think, it will work with AutoIt. This command sets the Drawing Mode from .NET to GDI+ (instead of GDI32), but AutoIt uses it's own Function to draw. So this should only work for .NET-forms, not for native win32 / AutoIt-Forms I think. :)

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Ok. This goes back to my post on you knowing or not knowing .Net.

"System.Windows.Forms" is a namespace. "System.Windows.Forms.Form" is the class. Stop trying to create an object of type namespace.

Share this post


Link to post
Share on other sites

Thanks for comment. I dont know .Net, but i want to create a script that will all help is in the forum.

"$oNET = ObjCreate("System.Windows.Forms.Form")" also return an error.

Spider


www.AutoIt.de - Moderator of the German AutoIt Froum

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Well, after looking a bit, the Form object doesn't appear to be promoted to a COM object.

Edited by Richard Robertson

Share this post


Link to post
Share on other sites

Ok.. Is there any other possibility to access to the function?


www.AutoIt.de - Moderator of the German AutoIt Froum

Share this post


Link to post
Share on other sites

Why do you need to call it when it only applies to your own application's .Net controls? If you try calling it to make changes to your AutoIt GUI, it won't make any bit of difference.

Share this post


Link to post
Share on other sites

Hi

I need it, because i want to make this DWM working with AutoIt. It works perfect, but text wont shows correctly. There are two posibilitys to fix this. The firstone is with SetWindowLayered. I tried a lot, but this wont work. (i know the function.. but autoit can't do this)

So i try it to make it like this way (near Fig. 10): http://msdn.microsoft.com/en-us/magazine/cc163435.aspx

Spider


www.AutoIt.de - Moderator of the German AutoIt Froum

Share this post


Link to post
Share on other sites

Well the .Net function you are trying to call only makes changes to .Net objects. Sorry but unless you are also creating .Net forms, this function does you no good to call.

Share this post


Link to post
Share on other sites

You should have said that in the first place. I'm not running Vista so I won't be much help.

Share this post


Link to post
Share on other sites

Hi

Ok, but is there a other possibility to access "Application"

On VB it looks like this:

Dim defaultValue As Boolean
Application.SetCompatibleTextRenderingDefault(defaultValue)

On C#:

public static void SetCompatibleTextRenderingDefault (
    bool defaultValue
)

defaultValue = True or False (boolean)

Thanks, your Spider


www.AutoIt.de - Moderator of the German AutoIt Froum

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0