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 


[C++] int main + win32 api's, what option?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
manc
Grandmaster Cheater
Reputation: 1

Joined: 16 Jun 2006
Posts: 551

PostPosted: Sun Sep 07, 2008 9:58 pm    Post subject: [C++] int main + win32 api's, what option? Reply with quote

What option/property/preference do you change in MSVC++ to start with
Code:
int main()
, yet be able to use win32api's inside?





example:
Code:

#include "windows.h"

#include <iostream>

using namespace std;

int main() {
   while (true) {
      HWND hWnd;
      hWnd = FindWindow(NULL,"MapleStory");

      PostMessage(hWnd,WM_CHAR,0x41,1);

      Sleep(1);
   }
}

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Sep 07, 2008 10:16 pm    Post subject: Reply with quote

yes, you can use the Win32 API in console programs.
Back to top
View user's profile Send private message
manc
Grandmaster Cheater
Reputation: 1

Joined: 16 Jun 2006
Posts: 551

PostPosted: Sun Sep 07, 2008 10:46 pm    Post subject: Reply with quote

Can you use int main() in win32 apps is what I'm asking i guess

like....
Win32 Project:
Code:
#include <windows.h>
int main()
{
MessageBox(NULL, "Goodbye, cruel world!", "Note", MB_OK);
return 0;
}

_________________
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Sun Sep 07, 2008 11:28 pm    Post subject: Reply with quote

In a Win32 application you use WinMain().

http://msdn.microsoft.com/en-us/library/ms633559.aspx
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Sep 07, 2008 11:28 pm    Post subject: Reply with quote

Obviously, what else did you plan on doing?

and you are getting mixed up. That's just a console application, and yes you can use the API in it.
Back to top
View user's profile Send private message
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Mon Sep 08, 2008 1:29 am    Post subject: Reply with quote

the only piece of info here left out is that if you do use User32 API's from a console programm Current Execution thread is marks it as a Win32_GUI_THREAD registering the Service Shadow Descriptor Table to tHe Thread Wink
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
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