Sign in to follow this  
Followers 0
Herb191

Embedded program not displaying right

8 posts in this topic

#1 ·  Posted (edited)

Embedded program not displaying after maximize/maximize or anything is moved over it.

Not sure what I need to change to keep it from disappearing.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinApi.au3>
#Include <Constants.au3>

Global $hMian, $hChild[3], $tChild = 3, $SC_MOVE = 0xF010, $fChild_Max = False

GUIRegisterMsg($WM_SYSCOMMAND, "On_WM_SYSCOMMAND")

Run ("C:\Program Files\WellSight Systems\StarLog 6\MudLog_HL.exe")
WinWait ( "MUD.LOG 6.2a - [not saved]" )
$hHandle = WinGetHandle("MUD.LOG 6.2a - [not saved]")
$size = WinGetClientSize($hHandle)
$hMain = GUICreate("Parent Window", $size[1] + 425, $size[0], 0, 0)

_WinAPI_SetWindowLong($hHandle, $GWL_STYLE, BitOr($WS_POPUP, $WS_VISIBLE))
_WinAPI_SetParent($hHandle, $hMain)
GUISetState(@SW_SHOW)
CreateChild()
CreateChild2()

While 1
    $aMsg = GUIGetMsg(1)
    Switch $aMsg[1]
        Case $hMain
            Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                    WinClose($hHandle)
                    Exit
                Case $GUI_EVENT_MINIMIZE
                     $hHandle = True
            EndSwitch
        Case $hChild[0]
            Switch $aMsg[0]
                Case $GUI_EVENT_CLOSE
                    GUIDelete($hChild[0])
                Case $GUI_EVENT_MAXIMIZE
                    $fChild_Max = True
                    $hHandle = True
                Case $GUI_EVENT_RESTORE
                    $fChild_Max = False
            EndSwitch
    EndSwitch
WEnd

Func CreateChild()
    $Child = GUICreate("Child " & $tChild, 250, 250, $size[0]-40, 15, $WS_POPUP)
    GUISetBkColor(0xE0FFFF) 
    GUISetState()
    _WinAPI_SetParent($Child, $hMain)
    Add($hChild, $Child)
EndFunc   ;==>CreateChild

Func CreateChild2()
    $Child2 = GUICreate("Child 2 " & $tChild, 250, 250, $size[0]-40, 300, $WS_POPUP)
    GUISetBkColor(0xE0FFFF) 
    GUISetState()
    _WinAPI_SetParent($Child2, $hMain)
    Add($hChild, $Child2)
EndFunc   ;==>CreateChild

Func Add(ByRef $Array, $V)
    If $Array[0] = "" Then
        $Array[0] = $V
    Else
        $p = UBound($Array)
        ReDim $Array[$p + 1]
        $Array[$p] = $V
    EndIf
    $tChild += 1
EndFunc   ;==>Add

Func On_WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam)

    If $hWnd = $hChild[0] Then
        If $fChild_Max Then
            If BitAND($wParam, 0xFFF0) = $SC_MOVE Then Return False
        EndIf
    EndIf

    Return $GUI_RUNDEFMSG
EndFunc
Edited by Herb191

Share this post


Link to post
Share on other sites



Bump…

Here is a screenshot of what it looks like and what I would like it to look like.

I would also like to be able to see the taskbar of the program. I would really appreciate any help on this one.

Thanks

post-19494-12743115372361_thumb.png

post-19494-12743115618891_thumb.png

Share this post


Link to post
Share on other sites

What happens if you hit it with this?

_WinAPI_RedrawWindow($hMain, 0, 0, $RDW_UPDATENOW + $RDW_ALLCHILDREN)

:idea:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

What happens if you hit it with this?

_WinAPI_RedrawWindow($hMain, 0, 0, $RDW_UPDATENOW + $RDW_ALLCHILDREN)

:)

No luck I also tried just putting _WinAPI_RedrawWindow ($Mudlog_Handle, 0, 0) in the While loop but it just flickers.

:idea:

Share this post


Link to post
Share on other sites

Hmm... just noticed you zeroed out the Style/ExStyle when creating the parent GUI. Try this instead:

$hMain = GUICreate("Parent Window", $size[1] + 425, $size[0], BitOr($Gui_SS_Default_GUI, $WS_CLIPCHILDREN))

This is getting over my head, but I would bet that you have issues with your window styles.

:idea:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Hmm... just noticed you zeroed out the Style/ExStyle when creating the parent GUI. Try this instead:

$hMain = GUICreate("Parent Window", $size[1] + 425, $size[0], BitOr($Gui_SS_Default_GUI, $WS_CLIPCHILDREN))

This is getting over my head, but I would bet that you have issues with your window styles.

:idea:

Nice! That did the trick. I just had to change it to:

$hMain = GUICreate("Parent Window", $size[1], $size[0], 0, 0, BitOr($Gui_SS_Default_GUI, $WS_CLIPCHILDREN))

Now any suggestions on viewing the taskbar of the embedded program?

Edited by Herb191

Share this post


Link to post
Share on other sites

Now any suggestions on viewing the taskbar of the embedded program?

Not a clue. Can you reproduce the problem with apps we might have already? Without your "MudLog_HD" app, it would be hard to figure out.

:idea:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Not a clue. Can you reproduce the problem with apps we might have already? Without your "MudLog_HD" app, it would be hard to figure out.

:idea:

You can download the free viewer, which is essentially the same program just with out all the goodies. I tried it and it did the same thing. I think it must have something to do with what version of windows you are running. I ran the following on a computer with Vista and it worked great. Then I ran it on a computer with XP and I couldn’t see the taskbar again.

You can get the viewer here: Viewer Download

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <Constants.au3>
#include <GuiMenu.au3>

$Mudlog_Handle = Open_Log()
$Title_Bar_Height = _WinAPI_GetSystemMetrics($SM_CYCAPTION)
$size = WinGetClientSize($Mudlog_Handle)
$hMain = GUICreate("Parent Window", @DesktopWidth , $size[1]+$Title_Bar_Height, 0, 0, BitOr($Gui_SS_Default_GUI, $WS_CLIPCHILDREN))

_WinAPI_SetWindowLong($Mudlog_Handle, $GWL_STYLE, $WS_VISIBLE)
_WinAPI_SetParent($Mudlog_Handle, $hMain)

GUISetState(@SW_SHOW)
While 1
    $aMsg = GUIGetMsg()
    If $aMsg = $GUI_EVENT_CLOSE Then 
        WinClose($Mudlog_Handle)
        GUIDelete()
        Exit
    EndIf
    Sleep(10)
WEnd

Func Open_Log()
    Local $WindowHand = ""
    
    $var = WinList("WellSight Log Viewer")
    For $i = 0 To $var[0][1]
        If $var[$i][0] <> "" Then
            MsgBox(4096, "", "Please close all Wellsite Programs before continuing.")
            Exit
        EndIf
    Next
    
    $Log_Name = FileOpenDialog("Select Log to Open", @DesktopDir & "\", "Mudlogs (*.Ml6)")
    If @error Then
        MsgBox(4096, "", "No File chosen")
        Exit
    EndIf

    ShellExecute($Log_Name)
    WinWait("WellSight Log Viewer")
    Sleep(5000)
    While 1
        $var = WinList("WellSight Log Viewer")

        For $i = 0 To $var[3][1]
            If $var[$i][1] <> "" Then
                $WindowHand = $var[1][1] 
                ExitLoop
            EndIf           
        Next
        If $WindowHand <> "" Then ExitLoop
    WEnd
Return $WindowHand
EndFunc   ;==>Open_Log

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