Verfasst: 27.06.2006 16:17
> Edel, gibt es den Befehl nicht nur unter WinXP o_O?
zumindest unter W2K prof. funktioniert es auch.
Grüße ... Kiffi
zumindest unter W2K prof. funktioniert es auch.
Grüße ... Kiffi
Code: Alles auswählen
import "kernel32.lib"
erscheint sofort SYNTAX ERROR ?
PS: Benutze XP und PB 3.94
Code: Alles auswählen
If OpenConsole()
hLib = GetModuleHandle_("Kernel32")
GetConsoleWindow = GetProcAddress_(hLib,"GetConsoleWindow")
Handle = CallFunctionFast(GetConsoleWindow)
RunProgram("calc.exe")
Delay(50) ; warten bis das programm fertig geladen wurde
SendMessage_(Handle,#WM_ACTIVATE,#WA_ACTIVE,0)
Input()
CloseConsole()
EndIf
Brauchst du nicht, auch unter 4.0 nicht.Ironsmurf hat geschrieben:PS: Habe die Datei
kernel32.lib
schon in die entsprechenden Verzeichnisse kopiert
Code: Alles auswählen
Procedure EnumPrc(lhWnd.l, *pParam.LONG)
Protected sTitleA.s, sTitleB.s, lPID.l
Static *pBufferA, *pBufferB
If Not *pBufferA: *pBufferA = AllocateMemory($400): EndIf
If Not *pBufferB: *pBufferB = AllocateMemory($400): EndIf
If GetConsoleTitle_(*pBufferA, MemorySize(*pBufferA))
GetWindowText_(lhWnd, *pBufferB, MemorySize(*pBufferB))
If Not CompareMemoryString(*pBufferA, *pBufferB)
GetWindowThreadProcessId_(lhWnd, @lPID)
If lPID = GetCurrentProcessId_() And *pParam
*pParam\l = lhWnd
Else
ProcedureReturn #True
EndIf
ProcedureReturn #False
Else
ProcedureReturn #True
EndIf
Else
ProcedureReturn #True
EndIf
EndProcedure
Procedure KonsolehWnd()
Protected lDLL, lhWnd
If OSVersion() => #PB_OS_Windows_2000
lDLL = OpenLibrary(#PB_Any, "Kernel32.dll")
If lDLL
If GetFunction(lDLL, "GetConsoleWindow")
lhWnd = CallFunction(lDLL, "GetConsoleWindow")
Else
EnumWindows_(@EnumPrc(), @lhWnd)
EndIf
CloseLibrary(lDLL)
ProcedureReturn lhWnd
Else
ProcedureReturn #False
EndIf
Else
EnumWindows_(@EnumPrc(), @lhWnd)
ProcedureReturn lhWnd
EndIf
EndProcedure
OpenConsole()
SetWindowText_(KonsolehWnd(), "test")
Repeat
Delay(1)
Until GetAsyncKeyState_(#VK_ESCAPE)