rendered paste body#define WIN32_LEAN_AND_MEAN#include <windows.h>#include "resource.h"BITMAP bmp;HRGN rgnSkin;HWND hwnd;RECT rc;int width;int height;HDC skindc,hdc;PAINTSTRUCT ps;int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int);LRESULT CALLBACK WindowProc(HWND, UINT, WPARAM, LPARAM);HWND BuildWindow(LPCTSTR, HINSTANCE, int, int);int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){ HBITMAP skinbmp = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BITMAP1)); //loads bitmap-resource to skinbmp GetObject(skinbmp,sizeof(bmp),&bmp); //getobject bmp to skinbmp.. width = bmp.bmWidth; //store width height = bmp.bmHeight; //store height skindc = CreateCompatibleDC(0); //make a DC (device context, the area we can draw on) HBITMAP oldbmp = (HBITMAP)SelectObject(skindc, skinbmp); //save bitmap and dc if(BuildWindow("Apache Gunz Launcher",hInstance,width,height)!=0) { HRSRC hrSkin = FindResource(hInstance, MAKEINTRESOURCE(IDR_RGN1),"RGN"); //get the region-file LPRGNDATA pSkinData = (LPRGNDATA)LoadResource(hInstance, hrSkin); //load the region rgnSkin = ExtCreateRegion(NULL, SizeofResource(NULL,hrSkin), pSkinData); //create region (to draw in) FreeResource(pSkinData); //release it SetWindowRgn(hwnd,rgnSkin,true); //sets the windows region to the one loaded from file HDC hdc = GetDC(hwnd); //make dc SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_CAPTION); //set styles for window ShowWindow(hwnd, SW_SHOW); //show the window! =) DWORD dwStyle = GetWindowLong(hwnd, GWL_STYLE); dwStyle &= ~(WS_CAPTION|WS_SIZEBOX); SetWindowLong(hwnd, GWL_STYLE, dwStyle); //other styles etc.. MSG mMsg; while(1){ //this makes a message-loop.. checks for window-messages and passes them off to the messagehandler (windowproc) let's make one.. if( PeekMessage(&mMsg, 0, 0, 0, PM_REMOVE) ){ if( mMsg.message == WM_QUIT ){ break; } TranslateMessage(&mMsg); DispatchMessage(&mMsg); } } } ReleaseDC(hwnd,hdc); SelectObject(skindc, oldbmp); DeleteObject(skinbmp); DeleteDC(skindc); DestroyWindow(hwnd);}LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){ switch (msg) { case WM_PAINT: { //WM_PAINT case for repainting (adding drawing on it etc etc) BeginPaint(hwnd, &ps); //Paint(hwnd, &ps); //repaints the window.. a WM_PAINT is relevant if you have drawing on the form etc BitBlt(ps.hdc,0,0,width,height,skindc,0,0,SRCCOPY); //this updates the window EndPaint(hwnd, &ps); break; } case WM_LBUTTONDOWN: { //WM_LBUTTONDOWN gets if left mousebutton pressed on window int xpos = LOWORD(lParam); int ypos = HIWORD(lParam); /* X Button Pressed! */ if(xpos >= 736 && xpos <= 741 && ypos >= 13 && ypos <= 6){ PostQuitMessage(0); return 0; break; } /* Minimize button pressed! */ if(xpos >= 713 && xpos <= 717 && ypos >= 13 && ypos <= 7){ ShowWindow(0,SW_MINIMIZE); } /* Start button Pressed! */ if(xpos >= 519 && xpos <= 737 && ypos >= 462 && ypos <= 537){ WinExec("theduel.exe",0x05); MessageBoxA(0, "+ Enjoy our game!", "Apache Launcher", MB_OK); PostQuitMessage(0); return 0; if(xpos >= 18 && xpos <= 40 && ypos >= 403 && ypos <= 308) { public class TransparentTextBox : TextBox { PictureBox pictureBox = new PictureBox(); public TransparentTextBox() { pictureBox.Dock = DockStyle.Fill; this.Controls.Add( pictureBox ); } protected override void WndProc( ref Message m ) { base.WndProc( ref m ); switch( m.Msg ) { case Win32.WM_PAINT: Bitmap bmpCaptured = new Bitmap( this.ClientRectangle.Width, this.ClientRectangle.Height ); Bitmap bmpResult = new Bitmap( this.ClientRectangle.Width,this.ClientRectangle.Height ); Rectangle r = new Rectangle( 0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height ); CaptureWindow( this, ref bmpCaptured ); this.SetStyle( ControlStyles.SupportsTransparentBackColor, true ); this.BackColor = Color.Transparent; ImageAttributes imgAttrib = new ImageAttributes(); ColorMap[] colorMap = new ColorMap[ 1 ]; colorMap[ 0 ] = new ColorMap(); colorMap[ 0 ].OldColor = Color.White; colorMap[ 0 ].NewColor = Color.Transparent; imgAttrib.SetRemapTable( colorMap ); Graphics g = Graphics.FromImage( bmpResult ); g.DrawImage( bmpCaptured, r, 0 , 0, this.ClientRectangle.Width, this.ClientRectangle.Height, GraphicsUnit.Pixel, imgAttrib ); g.Dispose(); pictureBox.Image = ( Image )bmpResult.Clone(); break; case Win32.WM_HSCROLL: case Win32.WM_VSCROLL: this.Invalidate(); // repaint // if you use scrolling then add these two case statements break; } } private static void CaptureWindow( Control control, ref Bitmap bitmap ) { Graphics g = Graphics.FromImage( bitmap ); int i = ( int )( Win32.PRF_CLIENT | Win32.PRF_ERASEBKGND ); IntPtr iPtr = new IntPtr( 14 ); IntPtr hdc = g.GetHdc(); Win32.SendMessage( control.Handle, Win32.WM_PRINT, hdc, iPtr ); g.ReleaseHdc( hdc ); g.Dispose(); } } SendMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION,NULL); break; //this will make it so when we click the form we can move it around } case WM_CHAR: { //WM_CHAR gets if a key is pressed if (wParam == VK_ESCAPE){ PostQuitMessage(0); return 0; break; } //close window on press Escape break; } case WM_CLOSE:{ PostQuitMessage(0); return 0; break; } //when window is closed.. if you dont have this nothing will happen on the "X" } return DefWindowProc(hwnd, msg, wParam, lParam);}HWND BuildWindow(LPCTSTR szTitle, HINSTANCE hInstance, int nWidth, int nHeight) { WNDCLASS wndClass = { CS_HREDRAW | CS_VREDRAW | CS_OWNDC, WindowProc, 0, 0, hInstance, NULL, LoadCursor(NULL, IDC_ARROW), NULL, NULL, "ApacheGunz" }; //makes windowclass-struct RegisterClass(&wndClass); //registers the window-class int nSw = (WORD)GetSystemMetrics(SM_CXSCREEN); //get system x-size (screen width) int nSh = (WORD)GetSystemMetrics(SM_CYSCREEN); //get system y-size (screen height) RECT rc = { (nSw - nWidth)/2, (nSh - nHeight)/2, nWidth, nHeight }; //make a rect (rectangle, the area to make window in) in the center of the screen hwnd = CreateWindow( "ApacheGunz", szTitle, WS_POPUP, rc.left, rc.top, nWidth, nHeight, NULL, NULL, hInstance, NULL); //create the window ClassName must be exact same as in the class-struct hdc = GetDC(hwnd); //make DC ReleaseDC(hwnd, hdc); //and release return hwnd; ExitProcess( 0); }