AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

spiel über hotkey starten?....

Ein Thema von chris1983 · begonnen am 16. Feb 2007 · letzter Beitrag vom 18. Feb 2007
Antwort Antwort
chris1983

Registriert seit: 16. Feb 2007
5 Beiträge
 
Delphi 7 Personal
 
#1

spiel über hotkey starten?....

  Alt 16. Feb 2007, 22:32
hey zusam

ich hab da ein problem in delphi

ich arbeite grade an einem trainer ich will ihn über einen hotkey starten
" R " wenn ich den trn dann starten will kommt immer die fehler meldung
" Game EXE not found " obwohl ich die richtige exe angegeben habe
(game.exe)

code:..


Delphi-Quellcode:
procedure RunGame;
var
  sti:tstartupinfo;
  lpPi:tprocessinformation;
begin
 if not CreateProcess(nil,'game.exe',nil,nil,false,CREATE_NEW_CONSOLE or
        NORMAL_PRIORITY_CLASS,nil,nil,sti,lppi)
 then begin
        MessageBox(Win,'Game EXE not found','Error',mb_ok+mb_iconinformation);
 end

 else
 if CreateProcess(nil,'game.exe',nil,nil,false,CREATE_NEW_CONSOLE or
        NORMAL_PRIORITY_CLASS,nil,nil,sti,lppi)


 then begin
    FSOUND_Close;
 end;
end;
  Mit Zitat antworten Zitat
Stefan92

Registriert seit: 9. Jan 2007
146 Beiträge
 
Delphi 7 Enterprise
 
#2

Re: spiel über hotkey starten?....

  Alt 16. Feb 2007, 22:51
Hallo,

ist die .exe denn auch im selben Verzeichnis?
Wenn nicht, musst du den ganzen Pfad angeben.

Gruß

Stefan
  Mit Zitat antworten Zitat
chris1983

Registriert seit: 16. Feb 2007
5 Beiträge
 
Delphi 7 Personal
 
#3

Re: spiel über hotkey starten?....

  Alt 16. Feb 2007, 22:59
ja der trainer ist im selben verzeichnes
wie die exe verstehe einfach nicht wo der fehler ist.
  Mit Zitat antworten Zitat
Benutzerbild von Sunlight7
Sunlight7

Registriert seit: 17. Sep 2006
Ort: Sonnensystem, Zentral
1.522 Beiträge
 
Delphi 5 Standard
 
#4

Re: spiel über hotkey starten?....

  Alt 18. Feb 2007, 07:20
Moin chris1983 und Willkommen in der DP!

Zwei Tage zu spät, aber ich habs erst jetzt gesehen

Zu Deinem Problem, Du hast nicht zufällig vergessen, die Variablen zu initialisieren

Delphi-Quellcode:
procedure RunGame;
   var sti:tstartupinfo;
       lpPi:tprocessinformation;
begin
   ZeroMemory(@sti, SizeOf(sti));
   ZeroMemory(@lpPi, SizeOf(lpPi));

   If not CreateProcess(nil,'game.exe',nil,nil,false,CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS,nil,nil,sti,lppi) then begin
      MessageBox(Win,'Game EXE not found','Error' 'Error',mb_ok+mb_iconinformation);
   end else
      if CreateProcess(nil,'game.exe',nil,nil,false,CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS,nil,nil,sti,lppi) then begin
         FSOUND_Close;
      end;
end;
Grüßle!
Windows: Ja - Microsoft: Nein -> www.ReactOS.org
  Mit Zitat antworten Zitat
chris1983

Registriert seit: 16. Feb 2007
5 Beiträge
 
Delphi 7 Personal
 
#5

Re: spiel über hotkey starten?....

  Alt 18. Feb 2007, 11:07
morgen Sunlight7

danke dir für die hilfe klapt jetzt wunderbar
nur hab ich jetzt ein zweites problem ich kann nicht in den speicher schreiben :/


hier mal der komplete source bis auf die NFO die hab ich raus genommen ^^

Delphi-Quellcode:
program GEngine;

{$define Win32App}

uses
  windows,messages,MiniFMOD,sysutils,
  win2k in 'Win2k.pas';

const

LOGO = 113;
ABOUT_DIALOG = 103;
ABOUT_CLOSE_BUTTON = 105;
INFO_EDIT = 14;
info =
..............

hier kommt die NFO rein also nicht wundern :)

......

var
Msg : TMSG;
Win : HWND;
Inst : Integer;
MusicPlayer : HMUSICMODULE;

const
WS_EX_LAYERED = $80000;
LWA_COLORKEY = 1;
LWA_ALPHA = 2;

const
WindowName = 'biohazard 4';
GAddress1 = $A0A274;
GAddress2 = $A0A27F;
GAddress3 = $63CDB2;
Gbuf1 : array[1..11] of byte = ($B9,$38,$1F,$00,$00,$09,$C1,$66,$89,$4F,$08);
Gbuf2 : array[1..5] of byte = ($E9,$34,$2B,$C3,$FF);
Gbuf3 : array[1..6] of byte = ($E9,$BD,$D4,$3C,$00,$90);

{$R res\trainer.res}  
procedure trans(Handle_:hWnd;Trans:byte);
begin
SetWindowLong(Handle_, GWL_EXSTYLE, GetWindowLong(Handle_, GWL_EXSTYLE) or WS_EX_LAYERED);
Win2k.SetLayeredWindowAttributes(Handle_, 0, Trans, LWA_ALPHA);
end;

procedure RunGame;
   var sti:tstartupinfo;
       lpPi:tprocessinformation;
begin
   ZeroMemory(@sti, SizeOf(sti));
   ZeroMemory(@lpPi, SizeOf(lpPi));

   If not CreateProcess(nil,'game.exe',nil,nil,false,CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS,nil,nil,sti,lppi) then begin
      MessageBox(Win,'Game EXE not found','Error',mb_ok+mb_iconinformation);
   end else
      if CreateProcess(nil,'game.exe',nil,nil,false,CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS,nil,nil,sti,lppi) then begin
         FSOUND_Close;
      end;
end;


function PatchMem(WindowName:pchar;BaseAddress:dword;buffer:pointer;LengthOfBuffer:dword):boolean;
var
   hwnd,id,ph:dword;
   written:cardinal;
   successful:longbool;
begin
  asm
  xchg eax,written
  mov eax,0
  end;
   hwnd:=findwindowexa(0,0,nil,WindowName);
   asm
   xchg edx,hwnd
   end;
      asm
      cmp hwnd,0
      end;
      
     getwindowthreadprocessid(hwnd,@id);
     ph:=openprocess(generic_read or generic_write,false,id);
     asm
     cmp ph,0
     end;
     begin
          patchmem:=false;
          exit;
     end;
     asm
        push written
        push LengthOfBuffer
        push buffer
        push BaseAddress
        push ph
        call WriteProcessMemory
        mov successful, eax
     end;
     patchmem:=successful;
     closehandle(0);
end;

procedure Quit;
begin
  EndDialog(win,0);
  FMUSIC_FreeSong(MusicPlayer);
  FSOUND_Close;
  halt;
end;

function AboutDlgProc(hWin, uMsg, wParam, lParam : Integer) : Integer; stdcall;
var
  OldInfo : array[0..65534] of Char;
  hIcon, hFont, Color, I : Integer;
begin
  if uMsg = WM_INITDIALOG then
begin
  trans(hWin,245);
  GetDlgItemText(hWin, INFO_EDIT, PChar(@OldInfo), 65535);
  SetDlgItemText(hWin, INFO_EDIT, PChar(String(OldInfo) + info));
  hFont := CreateFont(10, 0, 0, 0, 400, 0, 0, 0,
                      DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
                      DEFAULT_QUALITY, DEFAULT_PITCH, 'Terminal');
  if hFont <> 0 then SendDlgItemMessage(hWin, INFO_EDIT, WM_SETFONT, hFont, 0);
  SendDlgItemMessage(hWin, 14, 1096, 0, $0);
end;
  if uMsg = WM_LBUTTONDOWN then
begin
  ReleaseCapture;
  SendMessage(hWin,WM_NCLBUTTONDOWN,HTCAPTION,0);
end;
  Result := 0;
 if (uMsg = WM_DESTROY) or (uMsg = WM_CLOSE) or
    ((uMsg = WM_COMMAND) and (wParam = ABOUT_CLOSE_BUTTON))
    then EndDialog(hWin,0);
end;

function SettingsDlgProc(Window : hWnd; Msg,WParam,LParam : Integer): Integer; StdCall;
var
  OldInfo : array[0..65534] of Char;
begin
case Msg of
  wm_InitDialog : begin
  trans(window,205);

  FSOUND_File_SetCallbacks(@XMFile_OpenCallback, @XMFile_CloseCallback,
     @XMFile_ReadCallback, @XMFile_SeekCallback, @XMFile_TellCallback);
  FSOUND_Init(44100, 0);
  MusicPlayer := FMUSIC_LoadSong('XMMUSIC', nil);
  FMUSIC_PlaySong(MusicPlayer);
  end;
  WM_LBUTTONDOWN : begin
  ReleaseCapture;
  SendMessage(Window,WM_NCLBUTTONDOWN,HTCAPTION,0);
  end;
  wm_Close : DestroyWindow(Win);
  wm_Destroy : PostQuitMessage(0);
end;
  Result := 0;
   case Msg of
     WM_COMMAND : begin
   end;
 end;
end;

Procedure RunSettings;
begin
  Win := CreateDialog(hInstance,PCHar(100),0,@SettingsDlgProc);
  Showwindow(Win,SW_SHOW);
  Updatewindow(Win);
 end;

begin
  RunSettings;
while GetMessage(Msg,0,0,0) do
begin
  TranslateMessage(Msg);
  DispatchMessage(Msg);
//end;
  if (GetAsyncKeyState(VK_END) <> 0) then quit;
  if (GetAsyncKeyState($52) <> 0) then RunGame;
  if (GetAsyncKeyState($49) <> 0) then DialogBoxParam(hInstance, PChar(ABOUT_DIALOG), Win,@AboutDlgProc, 0);
  if (GetAsyncKeyState(VK_F1) <> 0) then patchmem(WindowName,GAddress1,@Gbuf1,sizeof(Gbuf1));
                                          patchmem(WindowName,GAddress2,@Gbuf2,sizeof(Gbuf2));
                                          patchmem(WindowName,GAddress3,@Gbuf3,sizeof(Gbuf3));

end;
end.
  Mit Zitat antworten Zitat
Benutzerbild von Sunlight7
Sunlight7

Registriert seit: 17. Sep 2006
Ort: Sonnensystem, Zentral
1.522 Beiträge
 
Delphi 5 Standard
 
#6

Re: spiel über hotkey starten?....

  Alt 18. Feb 2007, 21:01
Abend!

Neues Problem -> Neue Frage -> Neuer Thread

Sonst kommt ein Modi und macht hier dicht, weil pro Thread nur ein Thema erwünscht ist

Grüßle!
Windows: Ja - Microsoft: Nein -> www.ReactOS.org
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:23 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz