displayRand.text = Math.floor(Math.random() * 10) + " ";
This will now generate a random number. You can change the number after Math.random to anything depending on the range that you want. Post or email me any questions.
WTF Code?
displayRand.text = Math.floor(Math.random() * 10) + " ";
var drag:Boolean = false;
square1.addEventListener(MouseEvent.MOUSE_DOWN, mousedown);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseup);
stage.addEventListener(Event.ENTER_FRAME, enterframe);
function mousedown(e:MouseEvent):void{
drag = true;
}
function mouseup(e:MouseEvent):void{
drag = false;
}
function enterframe(e:Event):void{
if(drag == true){
square1.startDrag();
}
if(drag == false){
square1.stopDrag();
}
}
if(square1.hitTestObject(square2)){
hittest.text = "hitTest = true";
}
else{
hittest.text = "hitTest = false";
}
import flash.events.*;
var rightArrow:Boolean;
var leftArrow:Boolean;
var upArrow:Boolean;
var downArrow:Boolean;
var speed:uint = 10;
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
stage.addEventListener(Event.ENTER_FRAME, moveClip);
function keyDownHandler(event:KeyboardEvent):void{
if (event.keyCode == Keyboard.RIGHT) {
rightArrow = true;
}
if (event.keyCode == Keyboard.LEFT) {
leftArrow = true;
}
if (event.keyCode == Keyboard.UP) {
upArrow = true;
}
if (event.keyCode == Keyboard.DOWN) {
downArrow = true;
}
}
private function keyUpHandler(event:KeyboardEvent) {
if (event.keyCode == Keyboard.RIGHT) {
rightArrow = false;
}
if (event.keyCode == Keyboard.LEFT) {
leftArrow = false;
}
if (event.keyCode == Keyboard.UP) {
upArrow = false;
}
if (event.keyCode == Keyboard.DOWN) {
downArrow = false;
}
}
function enterFrameHandler(event:Event):void{
if (rightArrow) {
_clip.x += speed;
}
if (leftArrow) {
_clip.x -= speed;
}
if (upArrow) {
_clip.y -= speed;
}
if (downArrow) {
_clip.y += speed;
}
}
if(object_mc.x > stage.stageWidth){
object_mc.x = -(object_mc.width);
}
import flash.events.*;
var rightArrow:Boolean;
var leftArrow:Boolean;
var upArrow:Boolean;
var downArrow:Boolean;
var speed:uint = 10;
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
stage.addEventListener(Event.ENTER_FRAME, moveClip);
function keyPressed(event:KeyboardEvent) {
if (event.keyCode == Keyboard.RIGHT) {
rightArrow = true;
}
if (event.keyCode == Keyboard.LEFT) {
leftArrow = true;
}
if (event.keyCode == Keyboard.UP) {
upArrow = true;
}
if (event.keyCode == Keyboard.DOWN) {
downArrow = true;
}
}
function keyReleased(event:KeyboardEvent) {
if (event.keyCode == Keyboard.RIGHT) {
rightArrow = false;
}
if (event.keyCode == Keyboard.LEFT) {
leftArrow = false;
}
if (event.keyCode == Keyboard.UP) {
upArrow = false;
}
if (event.keyCode == Keyboard.DOWN) {
downArrow = false;
}
}
function moveClip(event:Event) {
if (rightArrow) {
object_mc.x += speed;
if (object_mc.x > stage.stageWidth) {
object_mc.x = -(object_mc.width);
}
}
if (leftArrow) {
object_mc.x -= speed;
if (object_mc.x < -(object_mc.width)) { object_mc.x = stage.stageWidth; } } if (upArrow) { object_mc.y -= speed; if (object_mc.y < -(object_mc.height)) { object_mc.y = stage.stageHeight; } } if (downArrow) { object_mc.y += speed; if (object_mc.y > stage.stageHeight) {
object_mc.y = -(object_mc.height);
}
}
}
Writes data to an area of memory in a specified process. The entire area to be written to must be accessible or the operation fails.And here are the parameters:
BOOL WINAPI WriteProcessMemory(
__in HANDLE hProcess,
__in LPVOID lpBaseAddress,
__in LPCVOID lpBuffer,
__in SIZE_T nSize,
__out SIZE_T *lpNumberOfBytesWritten
);
- hProcess [in]
A handle to the process memory to be modified. The handle must have PROCESS_VM_WRITE and PROCESS_VM_OPERATION access to the process.
- lpBaseAddress [in]
A pointer to the base address in the specified process to which data is written. Before data transfer occurs, the system verifies that all data in the base address and memory of the specified size is accessible for write access, and if it is not accessible, the function fails.
- lpBuffer [in]
A pointer to the buffer that contains data to be written in the address space of the specified process.
- nSize [in]
The number of bytes to be written to the specified process.
- lpNumberOfBytesWritten [out]
A pointer to a variable that receives the number of bytes transferred into the specified process. This parameter is optional. If lpNumberOfBytesWritten is NULL, the parameter is ignored.
#include "stdio.h"
#include "windows.h"
#include "tlhelp32.h"
int GetPID(LPCSTR ProcessName) //Function for getting the PID (Process ID)
{
HANDLE hProcessSnap;
// Take a snapshot of all processes in the system.
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
PROCESSENTRY32 pe32;
pe32.cntUsage = 1;
pe32.th32ModuleID = 0;
pe32.th32ParentProcessID = 0;
pe32.dwSize = sizeof(PROCESSENTRY32);
do
{
if (!strcmp(pe32.szExeFile, ProcessName))
{
return pe32.th32ProcessID;
}
}while (Process32Next(hProcessSnap, &pe32));
CloseHandle(hProcessSnap);
return 0;
}
BOOL IsActive( LPCSTR ProcName ) //Function for check if it is running
{
HANDLE hProcSnap;
hProcSnap = CreateToolhelp32Snapshot( TH32CS_SNAPALL, 0 );
PROCESSENTRY32 pe32;
do
{
if( !strcmp( pe32.szExeFile, ProcName ))
{
return TRUE;
}
}while( Process32Next( hProcSnap, &pe32 ));
CloseHandle( hProcSnap );
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
if( IsActive( "winmine.exe" )) //Check if its running
{
HANDLE hProc; //Handle to Process
unsigned long PID; //Variable to store the PID
BYTE nop = { 0x90 }; //Buffer to write
PID = GetPID( "winmine.exe" ); //Obtains PID
hProc = OpenProcess( PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_CREATE_THREAD, FALSE, PID ); //Opens process to get the handle
//Change of 01002ff5 - ff 05 9c 57 00 01 - inc [0100579c]
if( WriteProcessMemory( hProc, ( LPVOID )0x01002ff5, &nop, sizeof( nop ), 0 )) //Changing the opcode to 0x90 (hex for nop)
{
printf( "Time Successfully frozen!\n" );
}
else
{
puts( "Could not write bytes for flags" );
}
getchar();
}
else
{
puts( "MineSweeper not found!" );
getchar();
}
return 0;
}