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 


last C++ question..
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
AwayTheWInd
Master Cheater
Reputation: 0

Joined: 11 Sep 2007
Posts: 450

PostPosted: Wed Apr 02, 2008 5:19 pm    Post subject: last C++ question.. Reply with quote

ye.. last qusetion for today..

whats wrong with this cuz i get some really weird message when i try this:

char Angle [256];
printf(Angle,"Angle = %d")
MessageBoxA(0,Angle,"Angle",MB_OK);


?

_________________
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Wed Apr 02, 2008 5:44 pm    Post subject: Reply with quote

why dont u just post in the same topic?

We just! went over this.

printf's Syntax is TEXT THEN VARIABLES
printf( "Text %d, %s, %c", aDecimal, aString, aChar );

anyways, what you want is "sprintf". It copies a string of text you define to an array of charecters or a string.

Code:
char Angel[256];
int AngelsVal = 1;
sprintf(Angel,"Angel = %d", AngelsVal);
MessageBox( 0, Angel, "Angle", MB_OK );

_________________
Back to top
View user's profile Send private message
AwayTheWInd
Master Cheater
Reputation: 0

Joined: 11 Sep 2007
Posts: 450

PostPosted: Sat Apr 05, 2008 9:45 pm    Post subject: Reply with quote

ok..cuz lurc wants me to post in the same topic...

is it possible to have a messagebox u make pop over a window like gunbound.
and...
if thats not possible. can someone post the function for drawing text over a window cuz i cant understand the stuff i find on google o.O

ty in advace? Wink

_________________
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: Sat Apr 05, 2008 9:52 pm    Post subject: Reply with quote

The first param of a MessageBox is the handle to the window the owns the message box. Leaving it 0 means no owner so it does not take focus over anything. Instead, pass the hWnd of the program you want it to show over, such as the handle to Gunbound like you want.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
AwayTheWInd
Master Cheater
Reputation: 0

Joined: 11 Sep 2007
Posts: 450

PostPosted: Sat Apr 05, 2008 9:55 pm    Post subject: Reply with quote

so like i define gunbound first:

HWND GunBound

blahblahblah....

MessageBoxA(hGunBound,"blah","blah",0)

is that right?

_________________
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: Sat Apr 05, 2008 10:04 pm    Post subject: Reply with quote

Your define was:

HWND GunBound;

So you would need to use:

MessageBox( GunBound, ....

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
AwayTheWInd
Master Cheater
Reputation: 0

Joined: 11 Sep 2007
Posts: 450

PostPosted: Mon Apr 07, 2008 8:34 pm    Post subject: Reply with quote

um.. that doesnt work. and i think u dont understand. im injecting a DLL into gunbound. so i dont need htat first param. i want it to POP OVER gunbound. ure method just does the same thing as 0, make it pop behind it so i have to alt tab. is there a drawing function? or is there a way to solve this? +rep for effort xD

edit: cant rep o.O

_________________
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Mon Apr 07, 2008 9:06 pm    Post subject: Reply with quote

i believe that in the last param you can use

MB_OK | MB_SETFORGROUND

It may pop up above.

_________________
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: Tue Apr 08, 2008 1:48 am    Post subject: Reply with quote

AwayTheWInd wrote:
um.. that doesnt work. and i think u dont understand. im injecting a DLL into gunbound. so i dont need htat first param. i want it to POP OVER gunbound. ure method just does the same thing as 0, make it pop behind it so i have to alt tab. is there a drawing function? or is there a way to solve this? +rep for effort xD

edit: cant rep o.O


I do understand you, I was correcting your error in your post above.

And just because you are injected does not mean you do not need that param. The first param is the owner window handle:

MessageBox: http://msdn2.microsoft.com/en-us/library/ms645505(VS.85).aspx
[in] Handle to the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window.

You can use MB_SYSTEMMODAL as the flag to force the person to click the messagebox before continuing, along with that, MB_SYSTEMMODAL gets a style of WS_EX_TOPMOST, or you can simply use MB_TOPMOST like lurc said to give it topmost.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
AwayTheWInd
Master Cheater
Reputation: 0

Joined: 11 Sep 2007
Posts: 450

PostPosted: Tue Apr 08, 2008 6:57 pm    Post subject: Reply with quote

um..apparently gunbound doesnt like it when there are stuff on top of it.
how can i use the draw function to write words? whenever i search it up, its always about drawing shapes.

---->>>>> draw(?????????????????????)

how would i do thatl iek i want to draw "buffer" on top of GunBound?

_________________
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: Tue Apr 08, 2008 11:12 pm    Post subject: Reply with quote

AwayTheWInd wrote:
um..apparently gunbound doesnt like it when there are stuff on top of it.
how can i use the draw function to write words? whenever i search it up, its always about drawing shapes.

---->>>>> draw(?????????????????????)

how would i do thatl iek i want to draw "buffer" on top of GunBound?


Depending on the engine used by the game you could hook (which GameGuard will probably stop you from doing this..) the interface that is being used (DirectX, OpenGL, etc.) and output text yourself through the engines drawing functions.

You can also draw to the window of the game using the GDI functions such as:
- DrawText http://msdn2.microsoft.com/en-us/library/ms533909(VS.85).aspx
- TextOut http://msdn2.microsoft.com/en-us/library/ms534019(VS.85).aspx

If the game has a console in the game, you could obtain the pointer to the function call and send messages to the console from your hook.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
AwayTheWInd
Master Cheater
Reputation: 0

Joined: 11 Sep 2007
Posts: 450

PostPosted: Wed Apr 09, 2008 2:39 pm    Post subject: Reply with quote

it wont work the way the syntax is...so i propose another idea to solve my problem which i have not clearly stated. is there any way i can make a messagebox exit itself after like 250 milliseconds?
_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Apr 09, 2008 3:42 pm    Post subject: Reply with quote

Wiccaan wrote:
AwayTheWInd wrote:
um..apparently gunbound doesnt like it when there are stuff on top of it.
how can i use the draw function to write words? whenever i search it up, its always about drawing shapes.

---->>>>> draw(?????????????????????)

how would i do thatl iek i want to draw "buffer" on top of GunBound?


Depending on the engine used by the game you could hook (which GameGuard will probably stop you from doing this..) the interface that is being used (DirectX, OpenGL, etc.) and output text yourself through the engines drawing functions.

You can also draw to the window of the game using the GDI functions such as:
- DrawText http://msdn2.microsoft.com/en-us/library/ms533909(VS.85).aspx
- TextOut http://msdn2.microsoft.com/en-us/library/ms534019(VS.85).aspx

If the game has a console in the game, you could obtain the pointer to the function call and send messages to the console from your hook.


I imagine using GDI would be flickery as hell though, right?
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: Thu Apr 10, 2008 12:05 am    Post subject: Reply with quote

If used correctly it wont flicker at all.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
AwayTheWInd
Master Cheater
Reputation: 0

Joined: 11 Sep 2007
Posts: 450

PostPosted: Thu Apr 10, 2008 2:21 pm    Post subject: Reply with quote

what do u mean by "hooked"?
_________________
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
Goto page 1, 2, 3  Next
Page 1 of 3

 
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