Reference DLL in C#

9 posts in this topic

NvrBst 0

Well, sorry if this is a silly question but maybe someone can help me anyway. I want to use a single AutoItX function (ToolTip). I can't add the dll as a reference (when I go to "Reference > Add Reference > Browse > Select the DLL" it says "could not be added. Please make sure that the file is a valid assembly or COM component." This is because I don't have AutoIt installed on my computer... I have 3 computer I work on (laptop/desktop/work) and I don't really want to install AutoIt just to use the tooltip function on all 3.

Anyway my sob story behind, Could someone tell me if its possible to add a reference to my C# program (using the AutoItX.dll) without installing AutoIt? And still have it work on computer without AutoIt installed.

Right now this is what I do (for future ref though I'd like to know how to reference without installing because this doesn't work too well if I want to do the entire class).

Is using "string szTip" okay? In the C++ it says "char* szTip". I ask this because I ran into some problems... the tooltip (after viewing) dissapears on its own after about 30 mins. I think it has to do with the garbage cleaner. I tried wrapping it in "unsafe" and such but it still dissapears after a while. Could someone possible give me the C# repersentation for that line? if it uses "char* szTip" do I need an "out" or "ref" or something?

Lastly I'm not sure if this is possible but is there anyway to see how AutoIt functions work internally (a webpage, or if they are open sourced someplace)? I can't find what Windows API it uses to create the tool tip, and if possible I'd just like to pInvoke and create it myself so I don't have to transfer the AutoIt dll with my application (my application is like 50KBs, and the DLL is 92KBs ).

Share this post

Link to post

Share on other sites

NvrBst 0

Hello Aye, I tried that before I restored to the AutoIt DLL... The problem I had with the .NET ToolTip Class is that I must provide a control for the tooltip to be displayed. I'm using tooltip to display information in a video game using hotkeys (IE I press the ctrl-t key and then the tooltip pop's up at (0,0) and displays the current time, and keeps updating every 500ms untill I press ctrl-t again and it goes away). As a result I don't own the control and ran into some troubles.

I would love to use that though... I have the handle and everything to the window I want to display the tooltip in, is there a way to convert that handle to a control (I tried a bunch of stuff but couldn't get it to work)? Or some generic control which will just display the tooltip anywhere on the screen like the AutoIt version does (or just make it so it wont take a control)?

Sorry to be a bother Thanks

NvrBst

EDIT: Typo

Edited June 9, 2006 by NvrBst

Share this post

Link to post

Share on other sites

Valik 468

I don't use .NET so I can't help you if the Tooltip class doesn't do what you want.

As far as AutoIt's Tooltip function, the code is in the last publicly available source release for AutoIt so you can see how it is done there. There should be a link to the source in the Developer's forum.

Share this post

Link to post

Share on other sites

NvrBst 0

Ahh thank you kindly. I remember looking at the archive when looking for the source but I only went into the AutoItX folder which was empty I should of looked a bit harder.

I see how its done now... You create a window using CreateWindowEx and just display tooltips onto that. I didn't realize you could create windows using topmost that would go infront of fullscreen applications (which i thought maintained topmost even if you tried to create windows infront of it)... but I guess I was wrong.

Which means I can probably use the .NET ToolTip class, and just use the NativeWindow Class to create a window so I own the control to the window for the tooltips... If not I can just do it the way in the source

Thanks so much, I'll go play with it some.

NvrBst

Also just for future reference, is there a way to reference an entire dll (like AutoItX) in C# which would allow you to just transport the dll with the application, and have it so you can run the exe from any folder (as long as the dll is with the exe), and on computer which don't have AutoIt installed? Basically the way DllImport works except referencing it (using it) like a COM Import?

Share this post

Link to post

Share on other sites

Melba23 2,481

This thread is over 7 years old - please do not necro-post again, just open a new thread.

M23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort---- Sort arrays on multiple columnsChooseFileFolder---- Single and multiple selections from specified path treeview listingDate_Time_Convert-- Easily convert date/time formats, including the language usedExtMsgBox--------- A highly customisable replacement for MsgBoxGUIExtender-------- Extend and retract multiple sections within a GUIGUIFrame---------- Subdivide GUIs into many adjustable framesGUIListViewEx------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx------ Check/clear parent and child checkboxes in a TreeViewMarquee----------- Scrolling tickertape GUIsNoFocusLines------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify------------- Small notifications on the edge of the displayScrollbars----------Automatically sized scrollbars with a single commandStringSize---------- Automatically size controls to fit textToast-------------- Small GUIs which pop out of the notification area