Jump to content

help with do.. until.. and windows


Recommended Posts

Hello, I have a GUI that you can click through, and I want it to show while Diablo II is active, then hide once it is not active, I was wondering how to do this? I got this to work for a split second, but once I activate Diablo II, the window constantly does the @SW_SHOW thing and D2 is minimized, here is my part of the script.

While 1
    If NOT WinActive("Diablo II") Then
        GUISetState(@SW_HIDE)
        Do
            Sleep(1)
        Until WinActive("Diablo II")
    ElseIf Winactive("Diablo II") Then
        GUISetState(@SW_SHOW)
        Do
            Sleep(1)
        Until WinActive("Diablo II") = 0
    EndIf
    Sleep(1)
WEnd
Edited by TK_Incorperate
Link to comment
Share on other sites

Go to the shortcut you have for Diablo II

Right Click

Properties

Target Line: add -nohide

to the end

hit apply

it should look something like this

"C:\Program Files\Diablo II\Diablo II.exe" -mpq cdkey4.mpq -skiptobnet -w -title "Key 4" -txt -direct -nohide

not 100% sure it works on XP since mine doesn't work but it might just be me

Link to comment
Share on other sites

That only works with D2Loader, I do not use hacks. I make hacks for friends, such as chicken, TKBot, ect. but I do not use them. This GUI I'm going to add is something I actually want to use, an editable GUI that will help me keep notes while playing the game, but it wont bother me while it is minimized.

~TK

Link to comment
Share on other sites

Hello, I have a GUI that you can click through, and I want it to show while Diablo II is active, then hide once it is not active, I was wondering how to do this? I got this to work for a split second, but once I activate Diablo II, the window constantly does the @SW_SHOW thing and D2 is minimized, here is my part of the script.

While 1
    If NOT WinActive("Diablo II") Then
        GUISetState(@SW_HIDE)
        Do
            Sleep(1)
        Until WinActive("Diablo II")
    ElseIf Winactive("Diablo II") Then
        GUISetState(@SW_SHOW)
        Do
            Sleep(1)
        Until WinActive("Diablo II") = 0
    EndIf
    Sleep(1)
WEnd
Apart from what narayanjr suggested, your script looks like it might have problems to me.

I suggest you do three things.

1) Make sure your window is set with the extended style $WS_EX_TOPMOST if you want it to appear over the Diablo window

2) Add the id of your gui to the GuiSetState functions so you can be sure you're controlling your own gui not the last active one.

3) Add a line to activate the Diablo II window after you activate your own gui. When you activate your own gui you deactivate the diablo, so then your window hides and focus goes back to Diablo so your window appears again etc.

These changes should fix it.

#include <guiconstants.au3>
$b = GUICreate("my diabwin",-1,-1,-1,-1,-1,$WS_EX_TOPMOST);<------

While 1
    If NOT WinActive("Diablo II") Then
        GUISetState(@SW_HIDE,$b);<-----------------------------------
        Do
            Sleep(1)
        Until WinActive("Diablo II")
    ElseIf Winactive("Diablo II") Then
        GUISetState(@SW_SHOW,$b);<----------------------------------
        WinActivate("Diablo II");<-----------------------------------------
        Do
            Sleep(1)
        Until WinActive("Diablo II") = 0
    EndIf
    Sleep(1)
WEnd
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...