[CODE]ScreenSnapr link fixer

Posts 1–7 of 7 · Page 1 of 1
[CODE]ScreenSnapr link fixer
It seems lots of people on UC use ScreenSnapr, CyberDwak found out that if you replace /v/ with /e/ it'll show without the advertisement, so credits go to him.

orWaPO.png &lsaquo; ScreenSnapr <- with ad
http://screensnapr.com/e/orWaPO.png <- without ad

So here's the screensnapr link fixer, cba to tidy it up.
Code:
#include <windows.h>
#include <ios>

int main()
{
	while(1)
	{
		if(GetAsyncKeyState(VK_LCONTROL)&1)
		{
			if(OpenClipboard(NULL))
			{
				char *ha = (char*)GetClipboardData(CF_TEXT);
				std::string tmp(ha);
				if(!tmp.find("http://screensnapr.com/v/"))
				{
					memcpy(ha, "http://screensnapr.com/e/", strlen("http://screensnapr.com/e/"));
					EmptyClipboard();
					SetClipboardData(CF_TEXT, (HANDLE)ha);
				}
				CloseClipboard();
			}
		}
		Sleep(100);
	}
}
Only replaces if its found at the start of the string
Go improve it if you think it's a good waste of ur time =p
Quote Originally Posted by Hell_Demon View Post
Go improve it if you think it's a good waste of ur time =p
This made me laugh.

Btw Wesley is there a log() function coded for C++ without having to download any shit?
Quote Originally Posted by fukojr2 View Post


This made me laugh.

Btw Wesley is there a log() function coded for C++ without having to download any shit?
Not my code, but I've used this in the past =3

Code:
#include <windows.h>
#include <tchar.h>
#include <iostream>
#include <time.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/timeb.h> 

void __cdecl add_log(const char * fmt, ...)
{
#ifndef _NO_ADD
   va_list va_alist;
   char logbuf[256];
   FILE * fp;
   struct tm * current_tm;
   time_t current_time;

   time (&current_time);
   current_tm = localtime (&current_time);

   sprintf (logbuf, "[%02d:%02d:%02d] ", current_tm->tm_hour, current_tm->tm_min, current_tm->tm_sec);

   va_start (va_alist, fmt);
   _vsnprintf (logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), fmt, va_alist);
   va_end (va_alist);

   if ( (fp = fopen ( FILELOCATION , "a")) != NULL )
   {
      fprintf ( fp, "%s\n", logbuf );
      fclose (fp);
   }
#endif _NO_ADD
}
Code:
if(!tmp.find("http://screensnapr.com/v/"))
Omg liek wdf I dont get it?@! ... find - C++ Reference... oh nvm.

Go improve it if you think it's a good waste of ur time =p
k

Code:
#include <windows.h>
#include <ios>

int main()
{
	while(1)
	{
		if(GetAsyncKeyState(VK_LCONTROL)&1)
		{
			if(OpenClipboard(NULL))
			{
				std::string tmp = (char*)GetClipboardData(CF_TEXT);
                                int i;
				if(!i = tmp.find("http://screensnapr.com/v/"))
				{
					tmp.replace(//Gahh! cba to finish! D=
					EmptyClipboard();
					SetClipboardData(CF_TEXT, (HANDLE)ha);
				}
				CloseClipboard();
			}
		}
		Sleep(100);
	}
}
Quote Originally Posted by why06 View Post
Code:
if(!tmp.find("http://screensnapr.com/v/"))
Omg liek wdf I dont get it?@! ... find - C++ Reference... oh nvm.
!tmp.find = tmp.startswith, since tmp.find returns the index which is 0 if the string starts with the string you're trying to find =p
Quote Originally Posted by Hell_Demon View Post
!tmp.find = tmp.startswith, since tmp.find returns the index which is 0 if the string starts with the string you're trying to find =p
You lost me there.

WtfBBQSauce
Quote Originally Posted by fukojr2 View Post


You lost me there.

WtfBBQSauce
a.find(b) returns the index in string a where string b was found. if it was not found it returns a.npos.
if a starts with string b a.find(b) will return 0. since 0 is false, we inverse it with ! to turn it into true, which will make the if successful and continue =3
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Need help?