Login

This is a discussion on Login within the Windows Programming forums, part of the Platform Specific Boards category; Code: #include <windows.h> #include <iostream> #include "resource.h" using namespace std; char userName [256]; char userPassword [256]; bool Login = false; ...

  1. #1
    Banned
    Join Date
    Oct 2004
    Posts
    250

    Login

    Code:
    #include <windows.h>
    #include <iostream>
    #include "resource.h"
    using namespace std;
    
    char userName [256];
    char userPassword [256];
    
    bool Login = false;
    bool Probing = true;
    
    LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
    {
    	switch (message)
    	{
    	case WM_CLOSE:
    		EndDialog(hwnd,true);
    		break;
    	case WM_COMMAND:
    		switch (LOWORD(wParam))
    		{
    		case IDC_BUTTON10:
    			EndDialog(hwnd,true);
    			break;
    		case IDC_BUTTON9:
    
    			GetDlgItemText(hwnd,IDC_EDIT1,userName,200);
    			GetDlgItemText(hwnd,IDC_EDIT2,userPassword,200);
    
    			ShowWindow(hwnd,SW_MINIMIZE); // start and minimize
    			Sleep(2000);
    
    			HINSTANCE open = ShellExecute(HWND_DESKTOP,"open","www.fatelords.com/login.php",NULL,NULL,SW_SHOWNORMAL);
    
    			if (!Login)
    			{
    				Sleep(15000); // allow time for page to load
    				// i have a slow connection to the server
    				// so i made it 15 seconds 
    
    				for(int j=0; j < 13; j++)
    				{
    				keybd_event(VK_TAB,1,0,0);
    				keybd_event(VK_TAB,1,KEYEVENTF_KEYUP,0);
    				}
    
    				for (int i=0; i<strlen(userName); i++)
    				{
    					if (userName[i] == '@')
    					{
    						keybd_event(VK_SHIFT,1,0,0);
    						keybd_event(VkKeyScan('2'),1,0,0); // stimulate '@'
    						keybd_event(VK_SHIFT,1,KEYEVENTF_KEYUP,0);
    					}
    					else
    					{
    						keybd_event(VkKeyScan(userName[i]),1.0,0,0);
    					}
    				}
    
    				// End username Login
    
    				keybd_event(VK_TAB,1,0,0);
    				keybd_event(VK_TAB,1,KEYEVENTF_KEYUP,0);
    
    
    				for (int i=0; i<strlen(userPassword); i++)
    				{
    					keybd_event(VkKeyScan(userPassword[i]),1,0,0);
    				}
    
    				keybd_event(VK_RETURN,1,0,0); // 'Enter' button
    
    				Login = true;
    
    			} // end login part
    
    			break;
    		}
    		break;
    	}
    
    	return false;
    }
    
    int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,
    				   LPSTR lpCmdLine,int nCmdShow)
    {
    	DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),NULL,DLGPROC(WndProc));
    	return true;
    }
    Im making a program to login to a online game and play for you but i need to be able to somehow 'Read the symbols on the picture' and type them in is there any way to do this?

  2. #2
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    create a bunch of .jpg's and name them b156z4e.jpg, and in your program have a table of all the filenames you've made. then pick a name randomly (let's use b156z4e for example). now you add .jpg to the end and get b156z4e.jpg. you display that, and match the user's input against the filename you picked out (b156z4e).

    or you could do it all dynamically.
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Difficult. You'd need to do image analysis.

    Kuphryn

  4. #4
    fuh
    fuh is offline
    Attack hamster fuh's Avatar
    Join Date
    Dec 2002
    Posts
    176
    Quote Originally Posted by kuphryn
    Difficult. You'd need to do image analysis.
    Actually, you wouldn't. You'd just have to do something where you generate a random filename and store the part of the filename before the .jpg or .bmp or .whatever and store that in an array of chars or something. Then, just do a "TheChar+='.blah;'" and use TheChar as the first part of the filename to load it. When the user enters the code they see you compare TheChar and the input, and if they're the same do your magic.
    Stupid things pop singers say

    "I get to go to lots of overseas places, like Canada."
    - Britney Spears

    "I love what you've done with the place!"
    -Jessica Simpson upon meeting the Secretary of Interior during tour of the White House

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. unable to login to facebook
    By zykostar in forum C# Programming
    Replies: 4
    Last Post: 03-30-2010, 02:04 PM
  2. Login
    By brietje698 in forum C++ Programming
    Replies: 3
    Last Post: 10-07-2007, 09:51 AM
  3. Having problems with a login script...
    By Junior89 in forum C++ Programming
    Replies: 6
    Last Post: 01-06-2006, 11:05 AM
  4. login script - URGENT!!!
    By linzeeuk in forum C Programming
    Replies: 5
    Last Post: 05-05-2003, 02:26 PM
  5. Replies: 7
    Last Post: 07-19-2002, 11:49 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21