Code: Select all
inline void Console(char *cgCmd)
{
HWND MohCons = FindWindow(0, "Mohaa Console");
EnumChildWindows(MohCons, EnumChildSendCommandProc,(LPARAM)cgCmd);
}
BOOL CALLBACK EnumChildSendCommandProc(HWND hwnd,LPARAM lParam)
{
char className[1024];
GetClassName(hwnd,className,sizeof(className));
if (strcmp("Edit",className)) return true;
if (ES_READONLY & GetWindowLong(hwnd,GWL_STYLE)) return true;
SendMessage(hwnd,WM_SETTEXT,0,lParam);
SendMessage(hwnd,WM_CHAR,13,0);
return 1;
}
Code: Select all
#PB_Window_ThickFrame=$40000
#WS_MAXIMIZE = $1000000
win=OpenWindow(0, 40, 40, 170,90, #PB_Window_ThickFrame | #PB_Window_SystemMenu ,"Window")
mohcon.l=0
cmd$="say hello console"
Procedure EnumChildSendCommandProc(hwnd, lParam)
Dim lpClassName.s(1024)
Dim L.l(1024)
exit=0
lpClassName.s = Space(1024)
L = GetClassName_(hwnd, lpClassName.s, 1024)
If (LCase(className.s) <> "edit") Or ((GetWindowLong_(hwnd, #GWL_STYLE) And #ES_READONLY) = #ES_READONLY)
EnumChildSendCommandProc = True
exit=1
EndIf
If exit<1
If (GetWindowLong_(hwnd, #GWL_STYLE) And #ES_READONLY) : exit=1 : EndIf
EndIf
SendMessage_(hwnd,#WM_SETTEXT,0,lParam)
SendMessage_(hwnd,#WM_CHAR,13,0)
EnumChildProc = 1
EndProcedure
Repeat
Sleep_(1)
EventID.l=WindowEvent()
wParam = EventwParam()
If mohcon=0
mohcon = FindWindow_(0, "Mohaa Console")
EndIf
b=b+1
If b>400 : b=0 : EndIf
If b=10
EnumChildWindows_(mohcon, @EnumChildSendCommandProc, 0)
EndIf
Select EventID
Case #PB_EventCloseWindow
quit=1
EndSelect
;
Until quit=1




