#include "stdafx.h" #include "Twiny.h" #include <windows.h> #include <stdio.h> #include <stdlib.h> #define WS_EX_LAYERED 0x00080000 #define LWA_COLORKEY 0x00000001 #define LWA_ALPHA 0x00000002 Twiny::Twiny() { } Twiny::~Twiny() { } Twiny::CreatTwiny( char *pStrIniFile, HINSTANCE hInstance ) { char IniPath[MAX_PATH]; char PlugPath[MAX_PATH]; GetCurrentDirectory( MAX_PATH, IniPath); sprintf( PlugPath, "%s\\Datas\\%s.ini", IniPath, pStrIniFile); #define EXTRACT_NBR( VAR ) GetPrivateProfileString("TWINY",""#VAR""," ",IniPath,MAX_PATH,PlugPath ); VAR = atoi(IniPath); EXTRACT_NBR( X ) EXTRACT_NBR( Y ) EXTRACT_NBR( Width ) EXTRACT_NBR( Height ) #undef EXTRACT_NBR hWnd = CreateWindowEx( WS_EX_TOPMOST ,"MyWndClassEx"," ", CW_USEDEFAULT | WS_VISIBLE, X, Y, Width, Height, NULL, NULL, hInstance, NULL); SetWindowLong(hWnd, GWL_WNDPROC, (long) Twiny::WndProc); } LRESULT CALLBACK Twiny::WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { if ( message == WM_MOUSEMOVE ) { PostQuitMessage(0); return 0; } return DefWindowProc(hwnd, message, wParam, lParam); } BOOL Twiny::MakeAlpha(HWND hwnd,BYTE alpha) { /* SLWA_FUNC MySetLayeredWindowAttributes; HMODULE hUser32 = GetModuleHandle("USER32.DLL"); if (!hUser32) return FALSE; MySetLayeredWindowAttributes = (SLWA_FUNC)GetProcAddress(hUser32,"SetLayeredWindowAttributes"); if (MySetLayeredWindowAttributes) { MySetLayeredWindowAttributes(hwnd,NULL,alpha,LWA_ALPHA|LWA_COLORKEY); return TRUE; } */ return FALSE; }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question