how get string out of a textbox?

Ask for Help on Using the Language With Memory Hacking Software

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

how get string out of a textbox?

Postby SpeedWing » Sat Oct 10, 2009 4:06 am

I want to use the "AtoI()" function to store the string in a textbox to an integer.

I want to send keystrokes to firefox ( works with giving the integer a value like "int sleeptime = 350"

sleeptime is the delay between the keystrokes.

I have no idea how to get the text out of that textbox. the help file only showed me how to create the textbox ( if it is in the helpfile I am blind I guess :oops: )

Code: Select all
bool bAddy;
int sleeptime; //if I set this integer to for example 500 the script works.

VOID Spawnmenu() {
    HWND spawnmenu = CreateDialog(NULL, "Udom Spawner", 129, 176, 136, 57, "ret_spawnmenu");
    if ( spawnmenu == NULL ) { return; }
    bAddy = false;

    enum {
        CTRL_LABEL0,
        CTRL_TEXTBOX0,
        spawncheckv,
    };

    if (!AddLabel(spawnmenu, 0, 0, 40, 20, CTRL_LABEL0, "Delay:")) { return; }
    if (!AddEdit(spawnmenu, 40, 0, 40, 20, CTRL_TEXTBOX0, "textbox")) { return; }
    if (!AddCheck(spawnmenu, 80, 0, 40, 20, spawncheckv, "Go!", "spawncheck")) { return; }
}

BOOL ret_spawner( HWND hWnd, UINT uiMsg, LONG wParam, LONG lParam ) {
    //This function will handle the window messages.
    //The return value is ignored.
}

VOID spawncheck( HWND hOwner, HWND hCheck, BOOL bChecked ) {
   if(bChecked==true){
      bAddy = true;
   }
   else{
      bAddy = false;
   }

   if (bAddy == true){
      HANDLE hAddy = CreateThread("Addy", 0);
      if (!hAddy) { bAddy = false; return; }
      CloseHandle(hAddy);   
   }                
}
         

VOID Addy(DWORD dwParam){
   if(bAddy == true){
   Sleep(500);
      //backwards
      for(int i = 0; i < 50; i++){
         KeyboardEvent( VK_MENU , 0 );
         KeyboardEvent( VK_LEFT , 0 );
         KeyboardEvent( VK_MENU ,  KEYEVENTF_KEYUP ); 
         KeyboardEvent( VK_LEFT ,  KEYEVENTF_KEYUP );
         Sleep(sleeptime);
      }
      
      //forwards
      for(int i = 0; i < 50; i++){
         KeyboardEvent( VK_MENU , 0 );
         KeyboardEvent( VK_RIGHT , 0 );
         KeyboardEvent( VK_MENU ,  KEYEVENTF_KEYUP ); 
         KeyboardEvent( VK_RIGHT ,  KEYEVENTF_KEYUP );
         Sleep(sleeptime);
      }
      Warning("Done");
   }
}   

VOID textbox( HWND hOwner, HWND hEdit ) {
   sleeptime = AtoI(?????);  //it gave a number close to 0. ( sorry if it is hEdit, but it did not work >.<)
}

VOID On_HK_0( DWORD dw1, DWORD dw2 ) {
    Spawnmenu();
}
User avatar
SpeedWing
Defragler
 
Posts: 2031
Joined: Tue Jan 01, 2008 1:00 am
Location: If there is a Will there is a Solution.

Postby L. Spiro » Sat Oct 10, 2009 10:30 am

GetWindowText().


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3126
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby SpeedWing » Sat Oct 10, 2009 4:43 pm

thank you very much, works perfectly now :D.

Image

Code: Select all
bool bAddy;
int sleeptime;
int laps;

VOID On_StartUp( HWND hWnd ) {
   DWORD dwParms[] = { 0, 0, 0 };
    RegisterHotkey(VK_F1,MOD_ALT,HK_FUNC_SCRIPTFUNCTION,dwParms,true);
}


VOID Spawnmenu() {
    HWND spawnmenu = CreateDialog(NULL, "Udom Spawner", 240, 207, 132, 73, "ret_spawnmenu");
    if ( spawnmenu == NULL ) { return; }

    enum {
        CTRL_LABEL0,
        CTRL_LABEL1,
        CTRL_BUTTON0,
        CTRL_TEXTBOX0,
        CTRL_TEXTBOX1,
    };

    if (!AddLabel(spawnmenu, 0, 0, 40, 20, CTRL_LABEL0, "Delay:")) { return; }
    if (!AddLabel(spawnmenu, 0, 20, 40, 20, CTRL_LABEL1, "Laps:")) { return; }
    if (!AddButton(spawnmenu, 80, 0, 40, 40, CTRL_BUTTON0, "Go!", "Go")) { return; }
    if (!AddEdit(spawnmenu, 40, 0, 40, 20, CTRL_TEXTBOX0, "textbox")) { return; }
    if (!AddEdit(spawnmenu, 40, 20, 40, 20, CTRL_TEXTBOX1, "lapbox")) { return; }
}

BOOL ret_spawner( HWND hWnd, UINT uiMsg, LONG wParam, LONG lParam ) {
    //This function will handle the window messages.
    //The return value is ignored.
}


         
VOID Go( HWND hOwner, HWND hButton ) {
    Addy();
}

VOID Addy(){
      HWND hWnd = FindWindow( "Ultimate Dominion - Outworld - Mozilla Firefox" );
      SetForegroundWindow( hWnd );
      Sleep(200);
      for(int il = 0; il < laps; il++){
         //backwards
         for(int i = 0; i < 50; i++){
            KeyboardEvent( VK_MENU , 0 );
            KeyboardEvent( VK_LEFT , 0 );
            KeyboardEvent( VK_MENU ,  KEYEVENTF_KEYUP ); 
            KeyboardEvent( VK_LEFT ,  KEYEVENTF_KEYUP );
            Sleep(sleeptime);
         }
         
         //forwards
         for(int i = 0; i < 50; i++){
            KeyboardEvent( VK_MENU , 0 );
            KeyboardEvent( VK_RIGHT , 0 );
            KeyboardEvent( VK_MENU ,  KEYEVENTF_KEYUP ); 
            KeyboardEvent( VK_RIGHT ,  KEYEVENTF_KEYUP );
            Sleep(sleeptime);
         }
      }
      Active();
}   
   
VOID Active(){
      HWND hWnd = FindWindow( "Udom Spawner" );
      SetForegroundWindow( hWnd );
}
VOID textbox( HWND hOwner, HWND hEdit ) {
   int iSize = 4;   
   char * sleeptext = Malloc(iSize);
   GetWindowText( hEdit, sleeptext, iSize );
   sleeptime = AtoI(sleeptext);
}

VOID lapbox( HWND hOwner, HWND hEdit ) {
   int iLength = 4;   
   char * laptext = Malloc(iLength);
   GetWindowText( hEdit, laptext, iLength );
   laps = AtoI(laptext);
}
VOID On_HK_0( DWORD dw1, DWORD dw2 ) {
    Spawnmenu();
}
User avatar
SpeedWing
Defragler
 
Posts: 2031
Joined: Tue Jan 01, 2008 1:00 am
Location: If there is a Will there is a Solution.


Return to Help

Who is online

Users browsing this forum: No registered users and 1 guest