Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


how do I open links in my trainer?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Dragonpearl
Grandmaster Cheater Supreme
Reputation: 0

Joined: 17 Sep 2007
Posts: 1240
Location: behind you with a dagger

PostPosted: Fri Jan 04, 2008 9:55 am    Post subject: how do I open links in my trainer? Reply with quote

When somebody presses a button, how do I make that button go to a place on the web?

Like if I make a command button, and it says CEF, how do I make it so the person who clicks the button could go to CEF?
Back to top
View user's profile Send private message
Pseudo Xero
I post too much
Reputation: 0

Joined: 16 Feb 2007
Posts: 2607

PostPosted: Fri Jan 04, 2008 10:10 am    Post subject: Re: how do I open links in my trainer? Reply with quote

Dragonpearl wrote:
When somebody presses a button, how do I make that button go to a place on the web?

Like if I make a command button, and it says CEF, how do I make it so the person who clicks the button could go to CEF?

Google is your friend, use ShellExecute.
Back to top
View user's profile Send private message
killersamurai
Expert Cheater
Reputation: 0

Joined: 10 Sep 2007
Posts: 197
Location: Colorado

PostPosted: Fri Jan 04, 2008 3:03 pm    Post subject: Reply with quote

CreateProcess() would be a better choice than ShellExecute().

If you want to load it up using the default web browser, you can look in the registry for it.

To use CreateProcess() it would look something like this
Code:

CreateProcess(<Program path>, L"-url http://forum.cheatengine.org", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);   

si is a STARTUPINFO struct.
pi is a PROCESS_INFORMATION struct.

I've created a little program that would demonstrate how to: Get the default web browser and open it up with the URL. It's done in c++. Also, here is the source if you want to learn (beware, it isn't the most optimized code you'll see).

Code:

#include <windows.h>

int main()
{
   HKEY hKey;
   TCHAR cData[MAX_PATH];
   DWORD dwDataSize;
   DWORD dwType = 0;
   LPCTSTR lpSubKey = L"SOFTWARE\\Classes\\HTTP\\shell\\open\\command";

   LONG isSuccess = 0;
   isSuccess = RegOpenKeyEx(HKEY_LOCAL_MACHINE, lpSubKey, NULL, KEY_QUERY_VALUE, &hKey);

   if (isSuccess == ERROR_SUCCESS)
   {
      isSuccess = RegQueryValueEx(hKey, NULL, NULL, &dwType, (LPBYTE)cData, &dwDataSize);
      if (isSuccess == ERROR_SUCCESS)
      {
         TCHAR* c;
         c = (TCHAR*)memchr(cData, '-', dwDataSize);
         cData[c - cData] = 0;

         bool isThere = true;
         do
         {
         c = (TCHAR*)memchr(cData, '\"', dwDataSize);
         if (c == NULL)
         {
            isThere = false;
         }
         else
         {
            cData[c - cData] = 32;
         }
         } while (isThere);

         if (cData[0] == 32)
         {
            for (DWORD i = 0; i < dwDataSize; i++)
            {
               if (cData[i] == 0)
               {
                  break;
               }
               cData[i] = cData[i + 1];
            }
         }

         STARTUPINFO si;
         PROCESS_INFORMATION pi;

         ZeroMemory(&si, sizeof(STARTUPINFO));
         si.cb = sizeof(STARTUPINFO);

         CreateProcess(cData, L"-url http://www.bungie.net", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);         
      }
   }
   return 0;
}



The Extension 'rar' was deactivated by an board admin, therefore this Attachment is not displayed.

Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Fri Jan 04, 2008 6:40 pm    Post subject: Reply with quote

Thats a bit overkill just to launch a browser.. ShellExecute will automatically do basically what you just did and launch the systems default browser already. No reason not to use ShellExecute.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sat Jan 05, 2008 10:19 am    Post subject: Reply with quote

if ur using .NET then you cud just use Process Start

C++
System::Diagnostics::Process::Start("url");

C# & VB

System.Diagnostics.Process.Start("url");

if not, then ShellExecute

_________________
Back to top
View user's profile Send private message
Reak
I post too much
Reputation: 0

Joined: 15 May 2007
Posts: 3496

PostPosted: Sat Jan 05, 2008 10:27 am    Post subject: Reply with quote

Don't use the cheatengine strings. Some GG's detect it. Use variables like:
a := 'http://forum.cheat';
b := 'engine.org';

It works (well as far as I know).
Back to top
View user's profile Send private message
Pseudo Xero
I post too much
Reputation: 0

Joined: 16 Feb 2007
Posts: 2607

PostPosted: Sat Jan 05, 2008 10:32 am    Post subject: Reply with quote

He just makes Flash trainers.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites