Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

Changing Window Title To Random String

How would I go about changing a Win32 Window Title to a random string? I have a basic idea just wondering how it would be structured and written.

Here is my random string generation:

Code
void gen_random(char *s, const int len) {
    static const char alphanum[] =
        "0123456789"
        "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
        "abcdefghijklmnopqrstuvwxyz";

    for (int i = 0; i < len; ++i) {
        s[i] = alphanum[rand() % (sizeof(alphanum) - 1)];
    }

    s[len] = 0;
}
All in on Ethereum
SetWindowTextW(FindWindowW(0,L"MyCurrentWindowTitle"),L"New Title");
In C# you can do:

Code
public static string GetUniqueKey(int maxSize)
        {
            char[] chars = new char[62];
            chars =
            "abcdefghijklmnopqrstuvwxyzåäöABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ1234567890АаБбВвГгДдЕеӘәЖжЗзИиЙйКкЛлМмНнОоÖöПпПпрСсТтуФфХхҺһҺһЧч'ШшьЭэԚԜԝ".ToCharArray();
            byte[] data = new byte[1];
            RNGCryptoServiceProvider crypto = new RNGCryptoServiceProvider();
            crypto.GetNonZeroBytes(data);
            data = new byte[maxSize];
            crypto.GetNonZeroBytes(data);
            StringBuilder result = new StringBuilder(maxSize);
            foreach (byte b in data)
            {
                result.Append(chars[b % (chars.Length)]);
            }
            return result.ToString();
        }

Then to change the current form's name you can do:
Code
this.Text = GetUniqueKey(15);

Of course you need:
using System.Security.Cryptography;

Hope I helped
Why the fuck would you post some stupid fucking C# program? Like really fuck me, do you see c# section? No you see the motherfucking C/C++ section now get ur dumb ass out of here fuck me. Im in a bad mood and you just pushed my fucking buttons.
(Mar 9, 2016 05:46 AM)Block4о Wrote:  In C# you can do:

Code
public static string GetUniqueKey(int maxSize)
        {
            char[] chars = new char[62];
            chars =
            "abcdefghijklmnopqrstuvwxyzåäöABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ1234567890АаБбВвГгДдЕеӘәЖжЗзИиЙйКкЛлМмНнОоÖöПпПпрСсТтуФфХхҺһҺһЧч'ШшьЭэԚԜԝ".ToCharArray();
            byte[] data = new byte[1];
            RNGCryptoServiceProvider crypto = new RNGCryptoServiceProvider();
            crypto.GetNonZeroBytes(data);
            data = new byte[maxSize];
            crypto.GetNonZeroBytes(data);
            StringBuilder result = new StringBuilder(maxSize);
            foreach (byte b in data)
            {
                result.Append(chars[b % (chars.Length)]);
            }
            return result.ToString();
        }

Then to change the current form's name you can do:
Code
this.Text = GetUniqueKey(15);

Of course you need:
using System.Security.Cryptography;

Hope I helped

Are you fucking retarded mate?
(Mar 9, 2016 06:07 AM)Aker15 Wrote:  Why the fuck would you post some stupid fucking C# program? Like really fuck me, do you see c# section? No you see the motherfucking C/C++ section now get ur dumb ass out of here fuck me. Im in a bad mood and you just pushed my fucking buttons.

[Image: Salt_Shaker.jpg]
(Mar 9, 2016 06:07 AM)Aker15 Wrote:  Why the fuck would you post some stupid fucking C# program? Like really fuck me, do you see c# section? No you see the motherfucking C/C++ section now get ur dumb ass out of here fuck me. Im in a bad mood and you just pushed my fucking buttons.
Not blaming you at all. Sick of seeing C# stuff in this board.

OP: Take the banned guy's advice.

SetWindowText is what you're looking for.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by ShallowMEApr 9, 2020 06:49 AM 12 267 Apr 9, 2020 06:49 AM
Last Post: ShallowME
[C#] by draxyeeDec 28, 2019 03:44 PM 2 290 Dec 28, 2019 03:44 PM
Last Post: Eternal Darkness
[Python] by GREGORYNov 26, 2019 07:02 AM 2 236 Nov 26, 2019 07:02 AM
Last Post: Kallu609