Jump to content

Interesting window style and a bunch of questions.


therks
 Share

Recommended Posts

I was trying out different window styles for a GuiCreate, trying to get a regular 70x70 window without the mini/maximize buttons, when I tried a combination of WS_POPUP, WS_DLGFRAME and WS_CAPTION and got a fullscreen window (if I drop the WS_POPUP, it has a titlebar too). I didn't see anything like that documented in the help, so I figured I'd mention it on here.

And since I'm posting anyway, I have a couple little questions about GUI stuff.

1) Is there a way (or will/could there be a way) to create window-specific hotkeys? You know like, Ctrl+N for a new window, or whatever. The only way I can think of now would be to maybe set a hotkey when the GUI's window is in focus, and unset it when it's not. But then I couldn't set single key hotkeys, like just A, or S or whatever. Any ideas?

2) Just out of curiousity, is there a reason for the limit of 24 hotkeys? I was thinking of creating a hotkey creation program, but 24 seems like it could be kind of limited. Is it a resources thing?

3) Is there a way to get other icon formats besides small and normal for buttons and checkboxes? Like the thumbnail sized, 48x48?

4) I tried a GuiSetIcon, but it didn't work. I haven't compiled yet, and I wouldn't bother asking but I figured since I'm posting anyway, heh. Is it just for compiled scripts maybe? Or is it maybe because of what I was using: GUISetIcon('C:\WINDOWS\SYSTEM32\nusrmgr.cpl', 0);

It worked for GuiCtrlSetImage, so I just thought it would work for this.

5) Did you know that $DS_SETFOREGROUND, and $DS_CONTEXTHELP aren't defined in the GUIConstants include? I had to add them in.

Damn.. I had some more questions, but I can't remember any of them right now. The last 3 here I just thought of off the top of my head.

Anyway, thanks for reading, and thanks to the dev's and all the hardworking people who make AutoIt so awesome.

Oh, one more important question.

6) How can I get a 70x70 window with just a close button? Everytime I can successfully get the [x], it forces the window to be wider than 70. Is it just a windows limitation?

Thanks again!

Edit/Addendum:

Just noticed something. Some of the styles in the GUIConstants file are commented out, like $TVS_RTLREADING, but are mentioned in the help doc's. Just so's you know.

Edited by Saunders
Link to comment
Share on other sites

1 : http://www.autoitscript.com/forum/index.php?showtopic=4470

2 : Quote from the helpfile:

Up to 64 simultaneous hotkeys per script may be registered

5 : Not every constant can be included in the constants include file. If it were, then it would be c++, not autoit

6 : No, and Yes (in that order).

7 : $TVS_RTLREADING and others are part of unicode in most cases, and autoit does not support unicode.

Edited by this-is-me
Who else would I be?
Link to comment
Share on other sites

1 : http://www.autoitscript.com/forum/index.php?showtopic=4470

2 : Quote from the helpfile:

5 : Not every constant can be included in the constants include file. If it were, then it would be c++, not autoit

6 : No, and Yes (in that order).

7 : $TVS_RTLREADING and others are part of unicode in most cases, and autoit does not support unicode.

<{POST_SNAPBACK}>

Okay, whoops about the hotkey thing. I meant 64, not 24, and while that's a whole lot more, it is a limitation nonetheless. Is that a resource thing? I'm just curious. :)

I don't get the answer to #5. You make it sound like it wouldn't work if you added them in... I added them myself and it works fine.

And one more question, how does the $WS_EX_ACCEPTFILES work? I tried this:

GuiCreate('Window', 200, 100, -1, -1, $WS_CAPTION+$WS_EX_ACCEPTFILES);

GUICtrlCreateEdit('Default Text', 0, 0, 60, 30, -1, $WS_EX_ACCEPTFILES)
GUICtrlSetState(-1, $GUI_ACCEPTFILES);

And while the cursor appears to be supporting it, when I drop the file, nothing happens. Do I need to add a handler of some sort?

And thanks for the speedy response, although you skipped questions 3, and 4. Don't have answers for those ones? :)

Link to comment
Share on other sites

Hoykey: AFIAK it is a windows limitation on a single executable using that many hotkeys.

#5 : there are literally hundreds, even thousands of constants that could be added to the constants file, but it would greatly increase the filesize of the scripts. The best way is to do exactly what you have done, and include it in your own files.

$WS_EX_ACCEPTFILES needs to be used with the following:

$GUI_ACCEPTFILES Input or EDit control will accept drag and drop of files

Who else would I be?
Link to comment
Share on other sites

#5 : there are literally hundreds, even thousands of constants that could be added to the constants file, but it would greatly increase the filesize of the scripts. The best way is to do exactly what you have done, and include it in your own files.

Yeah I know what you mean. It'd be a neat idea if they seperated the include file down into specific sections, don't you think? Like maybe GUIEditConstants, or GUIWindowConstants, then you wouldn't have to include everything and have a huge filesize. And then have one file like GUIAllConstants that just consisted of a bunch of #includes if you really felt that you needed all of them.

Would that work? Can an include file have #include statements in it?

$WS_EX_ACCEPTFILES needs to be used with the following:

$GUI_ACCEPTFILES Input or EDit control will accept drag and drop of files

I did that. See the code example I posted? I thought that dropping the file on the control would just fill the control with the location of that file though, it doesnt' do anything. Here's my full code:

#include <GUIConstants.au3>

GuiCreate('Window', 200, 100, -1, -1, $WS_CAPTION+$WS_EX_ACCEPTFILES);

GUICtrlCreateEdit('Default Text', 0, 0, 60, 30, -1, $WS_EX_ACCEPTFILES)
GUICtrlSetState(-1, $GUI_ACCEPTFILES);

$Stat = GUICtrlCreateLabel('statbar', 0, 80, 200, 20, $SS_SUNKEN);

GuiSetState();

While 1
    $msg = GUIGetMsg();

    If $msg <> 0 Then
        GUICtrlSetData($Stat, $msg);
    EndIf

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop;
Wend

And one other thing, is there a way to tell the difference between a user pressing the [x] and hitting the escape key?

Edited by Saunders
Link to comment
Share on other sites

Hoykey: AFIAK it is a windows limitation on a single executable using that many hotkeys.

#5 : there are literally hundreds, even thousands of constants that could be added to the constants file, but it would greatly increase the filesize of the scripts. The best way is to do exactly what you have done, and include it in your own files.

$WS_EX_ACCEPTFILES needs to be used with the following:

$GUI_ACCEPTFILES Input or EDit control will accept drag and drop of files

<{POST_SNAPBACK}>

Its Jon's limit, not any OS limit. Jon limits both the quantity and type of hotkeys set in order for AutoIt not to be turned into a keylogger.
Link to comment
Share on other sites

I did that. See the code example I posted? I thought that dropping the file on the control would just fill the control with the location of that file though, it doesnt' do anything. Here's my full code:

I may be wrong but I think drag and drop works only for input controls. Also, $WS_EX_ACCEPTFILES needs to be defined only in the GuiCreate statement and should be in the exStyle param. So I think the following should work:

#include <GUIConstants.au3>

GuiCreate('Window', 200, 100, -1, -1, $WS_CAPTION,$WS_EX_ACCEPTFILES)
GUICtrlCreateInput('Default Text', 0, 0, 60, 30)
GUICtrlSetState(-1, $GUI_ACCEPTFILES)

$Stat = GUICtrlCreateLabel('statbar', 0, 80, 200, 20, $SS_SUNKEN)

GuiSetState();

While 1
    $msg = GUIGetMsg();

    If $msg <> 0 Then
        GUICtrlSetData($Stat, $msg);
    EndIf

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
Link to comment
Share on other sites

Ooooooooooh I see, that makes sense. As easy as AutoIt is to learn, it would be freakishly easy to make a keylogger.

Not Really, no single Numbers and/or letters can be set as a hot key alone. I suppose there might possibly be a way to get past this, but it wouldn't be freakishly easy. If Numbers and letters could be set as hotkeys well then yes I'd have to say it would be pretty damn easy.
My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Link to comment
Share on other sites

I may be wrong but I think drag and drop works only for input controls. Also, $WS_EX_ACCEPTFILES needs to be defined only in the GuiCreate statement and should be in the exStyle param.

Actually I did know that... but what I didn't know was that I wasn't doing that in the script, heh. Your script works perfectly and, just so you know, edit controls do support drag&drop, I just tried it. Thanks for the help.

Does anyone know if it would be possible to add drag&drop support to combo boxes? I've created a dialog similar to the Run dialog for windows, and it uses a combo box to remember history. If I could drag&drop files onto that box as well, it'd be a neat little extra.

Hey genius, the poster is saying that were it not for the current limitation it would be "freakishly easy to make a keylogger."

I'm glad someone knows what I'm talking about. ;)
Link to comment
Share on other sites

Hey genius, the poster is saying that were it not for the current limitation it would be "freakishly easy to make a keylogger."

<{POST_SNAPBACK}>

And I'm saying that if there weren't limitations, it still wouldn't be "freakishly easy" to make a keylogger because of the fact that you cant set letters as hot keys.
My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Link to comment
Share on other sites

Valik is that you? You usually express your "put-downs" without foul language.

My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...