Jump to content

Random C++ Questions


Chance
 Share

Recommended Posts

I am thinking about something a lot more complicated. Maybe you could help me out a little bit in the design. I want to create an application that has a lot of calculations (solving mathematical problems). Probably i need to split up the GUI part and calculation part in two separate parts if i want the calculations in C++ and the GUI in C#. Advantage is that the GUI is only depended on some data source and could be quite simple. So you recommend C# for GUI, which i thought was easer, but i thought the problems were also in communication between C++ application and C#.. how would i do it? Database? file as start? I am going to take a big leap by building a multi threaded framework for at least the C++ part. I can use VS2010, so that should be fine yes.

Edited by cageman
Link to comment
Share on other sites

  • 5 weeks later...

I compiled this into a dll once while trying to learn how to make dlls.

VOID WINAPI Send(char *CharacterString)
{
    char cChar;
    while((cChar=*CharacterString++))
    {
        short vk=VkKeyScan(cChar);                                  // keycode of char

        if((vk>>8)&1)
        {
            keybd_event(VK_LSHIFT,0,0,0);                            // hold shift if necessary
        }   

        keybd_event((unsigned char)vk,0,0,0);                       // key in
        keybd_event((unsigned char)vk,0,KEYEVENTF_KEYUP,0);         // key out

        if((vk>>8)&1)
        {
            keybd_event(VK_LSHIFT,0,KEYEVENTF_KEYUP,0);             // release shift if necessary
        }

    }
    keybd_event(VK_RETURN, 0x0D, KEYEVENTF_EXTENDEDKEY | 0, 0);
}

It basically cycles through a char array and types it in really fast, I use it to spam my friends on steam to be honest.

I used to use an autoit script to count to 10 really fast and pretend to be a hacker, and then I made the little dll to use with autoit and found out that actually doing this~

Func Count()
    For $I = 1 To 1000
        DllCall($hDLL, "none", "Send", "str", $I, "int", 1)
    Next
EndFunc

was just as fast as

Opt("SendKeyDelay", 0)
Func Count2()
    For $I = 1 To 10
        Send($I & "{enter}")
    Next
EndFunc

I was supprised how slow send actually is, and doing it by calling the dll a lot of times was really fast :P

I guess it's because AutoIt probably checks the string you passed it for a bunch of things like the {} tags and little control characters and has to convert things into proper format, which makes it so slow.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...