Jump to content

Recommended Posts

Posted

Hello again guys. I originally posted this in the standard forums, but realized there was a section for just GUI. I originally explained the whole story, but the jist of it is. I was using this floating text code I found in the forums:

Opt("OnExitFunc", "endscript")



#include <GUIConstants.au3>
#include <WindowsConstants.au3>



$hwnd = GUICreate("Text Region", @DesktopWidth, @DesktopHeight, @DesktopWidth / 2 - 250, @DesktopHeight / 2 - 150, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetBkColor(0x00FF01)
GUISetState()
$hwnd2 = GUICreate("Text Region", @DesktopWidth, @DesktopHeight, @DesktopWidth / 2 - 200, @DesktopHeight / 2 - 100, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetBkColor(0x00FF01)
GUISetState()

While 1
    $rgn = CreateTextRgn($hwnd, "rawr", 20, "Times New Roman", 2000)
    $rgn2 = CreateTextRgn($hwnd2, "rawr5", 20, "Times New Roman", 2000)
    SetWindowRgn($hwnd, $rgn)
    SetWindowRgn($hwnd2, $rgn2) 
    Sleep(500)
WEnd

Func endscript()
    ControlShow("Program Manager", "", "[CLASSNN:SHELLDLL_DefView1]")
EndFunc   ;==>endscript

Func SetWindowRgn($h_win, $rgn)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1)
EndFunc   ;==>SetWindowRgn

Func CreateTextRgn(ByRef $CTR_hwnd, $CTR_Text, $CTR_height, $CTR_font = "Times New Roman", $CTR_weight = 1000)
    Local Const $ANSI_CHARSET = 0
    Local Const $OUT_CHARACTER_PRECIS = 2
    Local Const $CLIP_DEFAULT_PRECIS = 0
    Local Const $PROOF_QUALITY = 2
    Local Const $FIXED_PITCH = 1
    Local Const $RGN_XOR = 3

    If $CTR_font = "" Then $CTR_font = "Microsoft Sans Serif"
    If $CTR_weight = -1 Then $CTR_weight = 1000
    Local $gdi_dll = DllOpen("gdi32.dll")
    Local $CTR_hDC = DllCall("user32.dll", "int", "GetDC", "hwnd", $CTR_hwnd)
    Local $CTR_hMyFont = DllCall($gdi_dll, "hwnd", "CreateFont", "int", $CTR_height, "int", 0, "int", 0, "int", 0, _
            "int", $CTR_weight, "int", 0, "int", 0, "int", 0, "int", $ANSI_CHARSET, "int", $OUT_CHARACTER_PRECIS, _
            "int", $CLIP_DEFAULT_PRECIS, "int", $PROOF_QUALITY, "int", $FIXED_PITCH, "str", $CTR_font)
    Local $CTR_hOldFont = DllCall($gdi_dll, "hwnd", "SelectObject", "int", $CTR_hDC[0], "hwnd", $CTR_hMyFont[0])
    DllCall($gdi_dll, "int", "BeginPath", "int", $CTR_hDC[0])
    DllCall($gdi_dll, "int", "TextOut", "int", $CTR_hDC[0], "int", 0, "int", 0, "str", $CTR_Text, "int", StringLen($CTR_Text))
    DllCall($gdi_dll, "int", "EndPath", "int", $CTR_hDC[0])
    Local $CTR_hRgn1 = DllCall($gdi_dll, "hwnd", "PathToRegion", "int", $CTR_hDC[0])
    Local $CTR_rc = DllStructCreate("int;int;int;int")
    DllCall($gdi_dll, "int", "GetRgnBox", "hwnd", $CTR_hRgn1[0], "ptr", DllStructGetPtr($CTR_rc))
    Local $CTR_hRgn2 = DllCall($gdi_dll, "hwnd", "CreateRectRgnIndirect", "ptr", DllStructGetPtr($CTR_rc))
    DllCall($gdi_dll, "int", "CombineRgn", "hwnd", $CTR_hRgn2[0], "hwnd", $CTR_hRgn2[0], "hwnd", $CTR_hRgn1[0], "int", $RGN_XOR)
    DllCall($gdi_dll, "int", "DeleteObject", "hwnd", $CTR_hRgn1[0])
    DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $CTR_hwnd, "int", $CTR_hDC[0])
    DllCall($gdi_dll, "int", "SelectObject", "int", $CTR_hDC[0], "hwnd", $CTR_hOldFont[0])
    DllClose($gdi_dll)
    Return $CTR_hRgn2[0]
EndFunc   ;==>CreateTextRgn

I wanted to know how I could modify it to make Multi lined text in one GUI (I tried @CR, but that didnt work) I do not have any idea how I would modify this to achieve that. Any help would be appreciated.

Bottom line: I would like to know how to (In this example) take $rgn = CreateTextRgn($hwnd, "rawr", 20, "Times New Roman", 2000) and add multiple text lines to it (Im making a program that has multiple displayed timers floating, but I don't want 10000 GUIs being drawn and managed.)

Posted (edited)

you could create a Listview ................n use it for the 10000 timers............

Just the scroll bar will increse

I havent yet tried your code............

on trying i will give u better results..... ;)

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Posted

........................... :)

Got It.............

I was even at the Same Place Where U Are..........

Difference I hated Complex Coding ..............(Plzzz Never Mind) ;)

Herez the UDF for

With My UDF @CRLF works...........

If U Use it Please Reply for Some Modifications or Bugs..........

Regards

Phoenix XL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Posted

This is impressively strong for how much more simple the programing is. Nice.

Uhh first question, Can i make the text draggable? I defined $WS_EX_CONTROLPARENT in the GUI create but it didnt actually do anything for some reason

Posted

I'll Come Back with the Solution..........

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Posted

Added The 4th Parameter to Move the Character(s) in the Type Text Modified Script............

Also Added the Support of 'Default' Keyword and '-1'

Check The Original Post for Download or Copy the Source Code............. ;)

at the

Regards

Pheonix XL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Posted

All the extra stuff you added to it made implementation impossible into what i was doing (Made an issue i already had even worse) I most likely wont bother proceeding attempting to use your code. Thanks for the help though x.x

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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