Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
type or class EXE
i never did much with own type or classes in qm,
only in php ....

can you show me how to make a global type/class for this:

Copy      Help
,,exe_path.getwinexe(handles[i] 1)
,,exe_name.getwinexe(handles[i] 0)
,,title.findreplace(":" " ") ;;escape :
,,title.escape(1) ;;escape "
,,title.left(title 14)
To create new class, declare it somewhere and run or compile the code. The declaration includes member variables but does not include member functions.

class EXE member variables

Then add member functions using File -> New menu. QM item names must begin with class name and dot, like EXE.function1. Item named EXE will be constructor. Item named EXE. will be destructor. Item named EXE= will be operator =. All these special member functions are optional.
EXE can't be used, so my class would be exe.

please give me an example, because i don't understand all the parts.
i don't understand how to make a class or type (what to use)
out of the code i posted.

i have never used it in on my own in qm.
Depends on the purpose. Generally, type and class in QM are just different names for the same thing. If you will add functions to it, use class.

What is the purpose you want to use class?

Is your example code single function or it must be converted to multiple member functions?
instead of using the same code again and again it seems
to be clever to use some global script for the code i posted.

i use it in many triggers.

so or exe.title(truncate(30)) would be easier to use.

Copy      Help
out "WRONG"
str exe_title exe_path exe_name exe_class
int hwnd htb1 htb2 count1
str-- tb1 tb2
ARRAY(int)-- handles
ARRAY(int) r_handles
opt waitmsg 1
int w2=ShowDialog("TSK_Dialog2" &TSK_Dialog2 0 0 1)
int-- htb=id(3 w2)
,if(!IsWindow(w2)) break
,GetWindowList 0 "" 0 0 0 handles
,for(int'i 0 handles.len)
,,if(!IsWindowVisible(hwnd)) continue ;;exclude hidden
,,if(GetWinStyle(hwnd 1)&WS_EX_TOOLWINDOW) continue

,,if taskbar_splitter(hwnd)!=1
,,,if (!="FreeMeter")
,,,,tb2.formata("%i: %s - hwnd= %i exe= %s[]" r_handles.len-1 exe.title(15) handles[i]

,out tb2
,out exe.title
Do I correctly understand:

EXE is class that represents a window and provides functions to get information about the window.

Will try to explain how to create such class.

Since EXE cannot be used, let it be Exe.

Somewhere (eg in init2, or in macro code before using the class) declare the class:

class Exe m_hwnd -str'm_exename -str'm_exepath ;;and so on

Compile the code that contains the declaration.

Create member function (use menu File -> New) named

Copy      Help
if(!this.m_exename.len) m_exename.getwinexe(m_hwnd 0)
ret this.m_exename

Similarly create more member functions.

Example macro that declares and uses the class:
Copy      Help
class Exe m_hwnd -str'm_exename -str'm_exepath ;;and so on

Exe exe ;;declare variable of Exe class
exe.m_hwnd=_hwndqm ;;initialize. Alternatively, create member function eg Init that initializes the object.

This was just one of possible implementations. Maybe you need to get some properties every time the member function is called, instead of caching into member variables. Or get all properties in Exe.Init, which would simplify other member functions.
amazing !

that was a astonishing lesson !
now with parameter for truncate title

Copy      Help
#compile Exe.Init
Exe exe
out exe.path
out exe.title
out exe.title(20)

Attached Files
.qml   Exe.qml (Size: 789 bytes / Downloads: 163)
how to declare using mutliline ?

Copy      Help
class Exe m_hwnd -str'm_exename -str'm_exepath  -str'm_exetitle -int'm_truncate -str'm_execlass str'm_exeout

works not:
Copy      Help
class Exe m_hwnd -str'm_exename -str'm_exepath  -str'm_exetitle
-int'm_truncate -str'm_execlass str'm_exeout
Copy      Help
class ConvertCH
,~m_s ~m_file ~m_dest ~m_sInclDir ~m_sFuncDll ~m_sFuncArgsWin ~m_sFuncArgsCrt
,IStringMap'm_mf IStringMap'm_mfcb IStringMap'm_mtd IStringMap'm_mt IStringMap'm_mi IStringMap'm_mc IStringMap'm_mg IStringMap'm_mcf IStringMap'm_mtag
,IStringMap'm_mh IStringMap'm_mfan IStringMap'm_mfdn IStringMap'm_mcomm IStringMap'm_mall IStringMap'm_mut IStringMap'm_mpch IStringMap'm_mo
,IExprC'm_expr IExprC'm_expr2
,ARRAY(str*)m_aems ARRAY(CHDLL)m_adll
,!m_crt !m_outIncl !m_compact !m_pch

Forum Jump:

Users browsing this thread: 1 Guest(s)