Wenn man Visual Studio 2010 hat und es selbst kompiliert dann sollte es gehen. Hatte früher auch immer dieses Problem und glaube mich zu erinnern das es an der Kompilierung liegt.
Es gibt ja den Debugger und den Release Ordner. Das sind zwei verschiedene Kompilierungsvarianten. Wenn man sein Projekt veröffentlichen will, dann sollte man die Release Kompilierung benutzen.
Ich gebe dir ein Thanks wegen der Source, daraus kann ich eventuell etwas lernen.
Not to bash your work or anything, but just a few things to point out:
1. I noticed you are using GetPixel(), this API call is blocked by XTrap when trying to call it on the device context of S4's window. To get around this, I noticed you create a DC for the whole display, and from there GetPixel() that device context with the intent of capturing S4's window's pixels. This results in a situation requiring that S4's window is not overlapped by any other windows, or this will flat-out read the wrong pixel, and fail. I do not believe you mentioned this.
2. Your bot extremely lacks error checking. You have a few checks here and there, but you could perform a lot more in places which would be beneficial, should an error occur.
3. You attempt to find S4's window an perform a few other actions upon the loading of your bot's form. Not only is this not needed, seeing as the Find Window, etc buttons are there on the form already, this was coded strangely in that if S4's window handle is not found, an Overflow Exception occurs within a GetWindowRect() call you have made in your S4 information finding function. The error occurs because of this little snippet of code:
Code:
Private Sub S4InfosFinden()
If S4Found = True Then
''Informationen finden
If GetWindowRect(S4.Handle, S4.WRect) = 0 Then
MsgBox("Error 1")
End
End If
The GetWindowRect() function overflows because you have not checked if the handle is valid before performing the operation. Another note, the value of the handle does not seem to be returning 0 when finding the handle has failed. This is not default behavior, at least not in my experience of using FindWindow() in C++. I think you are peforming improper actions on this handle variable, or otherwise performing call(s) wrong for such a strange outcome.
Again, these are just some observations, and please do not take this as a personal attack, or any form of insulting your coding abilities. Please just try to further bug-check a beta application before releasing.
EDIT: You also seem to be creating and destroying the device context you create in every call to your GetPixelColor() function. It would be very beneficial to create the device context on form load, and to destroy it when your app closes, as opposed to creating and destroying it each time the function is called.
Also, where is your changelog? Version 1.0 and 4.0 don't look all that different, and you're not supposed to increment whole version numbers that fast.
As for the hotkeys, look into the API call RegisterHotKey():
1. I noticed you are using GetPixel(), this API call is blocked by XTrap when trying to call it on the device context of S4's window. To get around this, I noticed you create a DC for the whole display, and from there GetPixel() that device context with the intent of capturing S4's window's pixels. This results in a situation requiring that S4's window is not overlapped by any other windows, or this will flat-out read the wrong pixel, and fail. I do not believe you mentioned this.
Of cource, i know that :) but, seriously, who plays with a window in the middle of s4 screen? :D
Quote:
2. Your bot extremely lacks error checking. You have a few checks here and there, but you could perform a lot more in places which would be beneficial, should an error occur.
Yes, that's true xD
Quote:
3. You attempt to find S4's window an perform a few other actions upon the loading of your bot's form. Not only is this not needed, seeing as the Find Window, etc buttons are there on the form already, this was coded strangely in that if S4's window handle is not found, an Overflow Exception occurs within a GetWindowRect() call you have made in your S4 information finding function. The error occurs because of this little snippet of code:
Code:
Private Sub S4InfosFinden()
If S4Found = True Then
''Informationen finden
If GetWindowRect(S4.Handle, S4.WRect) = 0 Then
MsgBox("Error 1")
End
End If
The GetWindowRect() function overflows because you have not checked if the handle is valid before performing the operation.
Another note, the value of the handle does not seem to be returning 0 when finding the handle has failed. This is not default behavior, at least not in my experience of using FindWindow() in C++. I think you are peforming improper actions on this handle variable, or otherwise performing call(s) wrong for such a strange outcome.
Mhm.. but why occures a overflow exception and not my msgbox? the description of the api was that if the action has failed GetWindowRect == 0
and how could i check if handle is the right?
Edit: And another Question, why doesn't it found the right handle? *confused*
Quote:
EDIT: You also seem to be creating and destroying the device context you create in every call to your GetPixelColor() function. It would be very beneficial to create the device context on form load, and to destroy it when your app closes, as opposed to creating and destroying it each time the function is called.
I will try :D thank you
Quote:
Also, where is your changelog? Version 1.0 and 4.0 don't look all that different, and you're not supposed to increment whole version numbers that fast.
no, no.. this is the first version :D i called it sniper bot 4.0 at first.. but then i decided to make a weapon bot^^
this is the version 0.1 of the bot :D
Thank you very much for the Tips ! :D I'm not so experienced in debugging programms... i will save all in my little brain ^_^
You are correct, if GetWindowRect() fails, the return value is 0, however, it is trying to get the coordinates of a window handle which is invalid, and that is the part that is causing it to fail, not the return of the function.
I have taken a look at your code, and determined the solution to the problem, it is because you are attempting to store the return value of FindWindow as a long instead of what it should be, an IntPtr. The following revisions should fix this crash:
Code:
Public Structure Window
[COLOR="Red"]Public Handle As IntPtr[/COLOR]
Public WRect As Rect
Public Position As Point
Public Size As Point
Public Innersize As Point
Public InnerPos As Point
End Structure
and
Public Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As[COLOR="Red"] IntPtr[/COLOR]
Try compiling it now without S4 running, instead of crashing it should pop up with your error message stating S4's window has not been found.
It would most likely be the handle. It would be trying to acquire it as the type long while it's really an IntPtr and it would crash. I'm not sure why it doesn't crash on your computer set as a long... The real way to define it is as an IntPtr, as FindWindow normally returns an HWND, which is really a HANDLE, which is really a void* (pointer to a void). That is not equivalent to a long value, which is why it crashes.
(If you want to get technical, HWND is a struct, I know)
Well, I have 32-bit as well, so I suppose the reason it doesn't crash for you may be because you're on 64-bit. But, as I said, the solution is switching the type from long to IntPtr and it should work for both types of operating systems fine.
Well, I have 32-bit as well, so I suppose the reason it doesn't crash for you may be because you're on 64-bit. But, as I said, the solution is switching the type from long to IntPtr and it should work for both types of operating systems fine.
yes, it works on 64
and long doesn't worked on my 32-bit virtual maschine, so i think we have the solution, thanks (:
i will upload a new version tomorrow
[Release] Florensia Pixel Bot 1.0 08/25/2010 - Florensia - 102 Replies FLOPI - Florensia Online Pixel Bot
A pixel based bot for Florensia Online.
Features
• Auto Target
• Auto Loot
• Auto Rest
Release [Dekaron Pixel Bot remade] 01/18/2009 - Dekaron Exploits, Hacks, Bots, Tools & Macros - 18 Replies *removed*
Make your own bot then.
[Release] Snootae Bot 2.0 (got a pixel potter :P) 05/05/2008 - MapleStory - 6 Replies FOR ALL THOSE WITH PROBLEMS OF SEEING THE GUI, THE FONT IS NOT WORKING, AND WINDOWS IS WITH THE WINDOW, RUN "SnootaeBotFontChecker.exe", AND RE-OPEN BOT, IF THAT DOESN'T WORK, TRY MANUALING INSTALLING FONT BY DRAGGING TO C:\WINDOWS\Fonts, OR WHERE EVER ELSE YOUR FONTS ARE KEPT, IF IT STILL DOESN'T WORK, TRY RESTARTING COMPUTER.
Snootae Bot 2.0
Made By Snootae/AdamG62
thanks to:
FERRISBUELERYOURMYHERO
Rot1