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 


[Help] Making nice windows in c++,

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

Joined: 13 Mar 2007
Posts: 542

PostPosted: Thu Oct 02, 2008 4:48 pm    Post subject: [Help] Making nice windows in c++, Reply with quote

I'm Kind of new to c++, i got the writeprocessmemory to work, for people who think i wouldn't learn, but thats not why im here,

I saw this on TheOkLibrary.org



Default [C++] Making Nice Windows
By Noz3001



Ever seen them trainers and patchers with mint window shapes and ****? This is a basic way of reoving the gay tool bar and changing the shape of your window.
You may think it sounds hard.. ITS NOT.

Anyway, simple function I made (I make most of my windows 200x300 size) looks like this:

Code:

void Region()
{
HRGN Region = CreateRoundRectRgn(20, 27, 180, 280, 15, 15);
SetWindowRgn(hWnd, Region, TRUE);
}

I call this at case WM_PAINT and it creates a region on the window with rounded edges. There is a better way to remove the toolbar but I can't be arsed explaining it.

There are a few more basic shapes on MSDN.
The only problem now, is that there is no toolbar to drag th window :/. So, add this to the message handler for your main window:

Code:

case WM_LBUTTONDOWN:
SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0 );
break;

You can now drag it by the window.


Now, i tryed to Put it in my WM_PAINT but, nothing happenes,

Heres my WM_PAINT,

Code:

void CHaloTTrainerDlg::OnPaint()
{
   if (IsIconic())
   {
      CPaintDC dc(this); // device context for painting

      SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

      // Center icon in client rectangle
      int cxIcon = GetSystemMetrics(SM_CXICON);
      int cyIcon = GetSystemMetrics(SM_CYICON);
      CRect rect;
      GetClientRect(&rect);
      int x = (rect.Width() - cxIcon + 1) / 2;
      int y = (rect.Height() - cyIcon + 1) / 2;

      // Draw the icon
      dc.DrawIcon(x, y, m_hIcon);
   }
   else
   {

      
      CDialog::OnPaint();
   }
}



Would someone please point for me, were to add Region();?

I'm using VC++ 6.
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Thu Oct 02, 2008 5:02 pm    Post subject: Reply with quote

You should have a windowproc handling messages. It doesn't go in WM_PAINT, it is a message of it's own.

Code:
case WM_LBUTTONDOWN:
     SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0 );
     break;


WM_LBUTTONDOWN is the message.
Back to top
View user's profile Send private message MSN Messenger
kb3z0n
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 542

PostPosted: Thu Oct 02, 2008 5:12 pm    Post subject: Reply with quote

I can't even get the window to take the shape, D= Trying to look around the handler messages.

Code:


void CHaloTTrainerDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
   
     SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0 );
     
   
   CDialog::OnLButtonDown(nFlags, point);
}


Is that right?

I think the send message is wrong, beacuse it says it doesn't take 4 parameters, leme messs around with it.

And where exactly do i add the Region code, so the window takes shape?
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Thu Oct 02, 2008 5:16 pm    Post subject: Reply with quote

I suppose so. Is this MFC? Do you have the HWND to pass as the 1st param?
Back to top
View user's profile Send private message MSN Messenger
kb3z0n
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 542

PostPosted: Thu Oct 02, 2008 5:19 pm    Post subject: Reply with quote

I'm using "Microsoft Visual c++ 6",

And, i'm not exactly sure, i just copied down your code D;
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
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