Moderator: rubem
...
$x = 2;
$y = 7;
nSetConsoleCursorPosition($y * 0x10000 + $x, nGetStdHandleOut());
nWriteConsole("Test");<?php
define('STD_OUTPUT_HANDLE', 0x100000000 - 11);
class WindowsLibrary
{
protected $libraryPtr;
public function __construct($libraryName)
{ $this->libraryPtr = wb_load_library($libraryName);
}
public function __call($functionName, $params)
{
if ($functionPtr = wb_get_function_address($functionName, $this->libraryPtr))
{ return wb_call_function($functionPtr, $params);
}
else
{ return false;
}
}
}
// init KERNEL32 for resource functions
$KERNEL32 = new WindowsLibrary("KERNEL32");
$x = 2;
$y = 7;
$handle = $KERNEL32->GetStdHandle(STD_OUTPUT_HANDLE);
$KERNEL32->SetConsoleCursorPosition($handle , $y * 0x10000 + $x);
$KERNEL32->WriteConsole($handle, wb_get_address($str = "test"), strlen($str), NULL, NULL);
echo '!'
?>$KERNEL32->SetConsoleTextAttribute($handle, $color);#define FOREGROUND_BLUE 0x0001 /* text color contains blue. */
#define FOREGROUND_GREEN 0x0002 /* text color contains green. */
#define FOREGROUND_RED 0x0004 /* text color contains red. */
#define FOREGROUND_INTENSITY 0x0008 /* text color is intensified. */
#define BACKGROUND_BLUE 0x0010 /* background color contains blue. */
#define BACKGROUND_GREEN 0x0020 /* background color contains green. */
#define BACKGROUND_RED 0x0040 /* background color contains red. */
#define BACKGROUND_INTENSITY 0x0080 /* background color is intensified. */
Before calling EnumDisplayDevices, you must initialize the cb member of DISPLAY_DEVICE to the size, in bytes, of DISPLAY_DEVICE.
http://msdn.microsoft.com/en-us/library/ms533226(VS.85).aspx
typedef struct _DISPLAY_DEVICE {
DWORD cb;
TCHAR DeviceName[32];
TCHAR DeviceString[128];
DWORD StateFlags;
TCHAR DeviceID[128];
TCHAR DeviceKey[128];
} DISPLAY_DEVICE, *PDISPLAY_DEVICE;
cb
Size, in bytes, of the DISPLAY_DEVICE structure. This must be initialized prior to calling EnumDisplayDevices.
http://msdn.microsoft.com/en-us/library/ms533254(VS.85).aspx
// Cannot cleanup here
//efree(param);frantik wrote:...So might be a bug that rubem would have to fix![]()
Neither the first nor the second version in this archive works for me: "This application has failed to start because the application configuration is incorrect.". Seems like you forget to set the correct runtime library (which could be the reason for the file size of your versions)...frantik wrote:i made dlls with the updated code.. use at your own risk as I'm not 100% sure i did everything correctly... but no memory leaks calling windows functions
http://www.swiftlytilting.com/download. ... binder.zip