#ifndef FontsH #define FontsH //--------------------------------------------------------------------------- #include <windows.h> //--------------------------------------------------------------------------- // Definitions of font formats #define FF_NORMAL 0 #define FF_BOLD 2 #define FF_ITALIC 4 #define FF_UNDERLINE 8 #define FF_STRIKEOUT 16 //--------------------------------------------------------------------------- HFONT BuildFont(LPCTSTR lpszName, INT iSize, WORD wFontFormat); HFONT SetFont(HWND hwnd, LPCTSTR lpszName, INT iSize, WORD wFontFormat); VOID SetFont(HWND hwnd, HFONT hFont); //--------------------------------------------------------------------------- #endif |
SetFont(hEdit, TEXT("Times New Roman", 10, FF_BOLD | FF_ITALIC);
| NACH OBEN |
//---------------------------------------------------------------------------
#ifndef DynDialogsH
#define DynDialogsH
//---------------------------------------------------------------------------
#include <windows.h>
//---------------------------------------------------------------------------
// Definitions of icon representations in ShowMessage()
#define SM_NONE 0
#define SM_WARNING 1
#define SM_INFO 2
#define SM_ERROR 3
//---------------------------------------------------------------------------
LPWORD DWORD_ALIGN(LPWORD);
LPWORD NON_DWORD_ALIGN(LPWORD);
LPWORD InitDialog(LPVOID lpv, LPCTSTR title, DWORD style, WORD ctrlno,
LPCTSTR fontname, WORD fontsize, UINT x, UINT y, UINT cx, UINT cy);
LPWORD CreateDlgControl(LPWORD lpw, LPCTSTR ctrl_class, WORD id, LPCTSTR caption,
DWORD style, UINT x, UINT y, UINT cx, UINT cy);
VOID ShowMessage(HWND hwnd, LPCTSTR lpszMsg, LPCTSTR lpszTitle, WORD wIcon);
VOID ShowMessage(HWND hwnd, INT val, LPCTSTR lpszTitle, WORD wIcon);
//---------------------------------------------------------------------------
#endif
|
| NACH OBEN |
//--------------------------------------------------------------------------- #ifndef InputBoxH #define InputBoxH //--------------------------------------------------------------------------- #include <windows.h> //--------------------------------------------------------------------------- // Input-Box-Childs #define ID_INPUT 200 #define ID_INFOTEXT 201 //--------------------------------------------------------------------------- int InputBox(HWND hwnd, LPCTSTR prompt, LPCTSTR title, LPTSTR buffer, INT buflength); BOOL CALLBACK InputBoxDlgProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam); //--------------------------------------------------------------------------- #endif |
| NACH OBEN |
//--------------------------------------------------------------------------- #ifndef MemoryDialogH #define MemoryDialogH //--------------------------------------------------------------------------- // Definitions of dialog control IDs #define ID_GROUP 10 #define ID_STATIC_FROM 11 #define ID_STATIC_TO 12 #define ID_EDIT_FROM 13 #define ID_EDIT_TO 14 #define ID_BUTTON_SHOW 15 #define ID_BUTTON_SAVE 16 #define ID_EDIT_MEMORY 17 //--------------------------------------------------------------------------- LRESULT ShowMemory(HWND hwnd, BYTE* addr_from, BYTE* addr_to); BOOL TestValues(DWORD dwFrom, DWORD dwTo); DWORD HexToInt(unsigned char* buf, INT digits); VOID DisplayMemory(HWND hDlg, DWORD dwFrom, DWORD dwTo); CHAR* FillLines(DWORD dwFrom, DWORD dwTo); VOID SaveToFile(HWND hDlg, DWORD dwFrom, DWORD dwTo); BOOL CALLBACK ShowMemDlgProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam); //--------------------------------------------------------------------------- #endif |
CHAR lpszString[30] = "Dies ist eine Zeichenkette";
ShowMemory(hwnd, (BYTE*)lpszString, (BYTE*)&lpszString[29]);
| NACH OBEN |
#ifndef RegionsH #define RegionsH //--------------------------------------------------------------------------- #define LR_FROMRESOURCE 1 #define LR_FROMFILE 2 //--------------------------------------------------------------------------- typedef VOID CALLBACK (*PROGRESSCALLBACK)(float pc); //--------------------------------------------------------------------------- RECT Rect(LONG, LONG, LONG, LONG); BOOL IsBitInByte(BYTE p, UINT no); HBITMAP CreateMask(HBITMAP hBmpSrc, COLORREF clTransparent); HRGN GetLastRgnPart(UINT rect_counter, RGNDATA* lpRgnData); HRGN BitmapToRegion(HBITMAP hBmp, COLORREF clTransparent, PROGRESSCALLBACK prgcall); BOOL SaveRegion(HRGN hRgn, LPCTSTR lpszFileName); BOOL LoadRegion(HINSTANCE hInstance, HRGN& hRgn, WORD wFlags, LPCTSTR lpszName); BOOL CopyRegion(HRGN& hRgnDest, HRGN hRgnSrc); //--------------------------------------------------------------------------- #endif |
| NACH OBEN |
//--------------------------------------------------------------------------- #ifndef AppTerminatingH #define AppTerminatingH //--------------------------------------------------------------------------- #include <windows.h> //--------------------------------------------------------------------------- // Ein paar Definitionen #define TA_FAILED 0 #define TA_CANNOT_OPEN 1 #define TA_SUCCESS_CLEAN 2 #define KA_FAILED 0 #define KA_CANNOT_OPEN 1 #define KA_SUCCESS_KILL 2 //--------------------------------------------------------------------------- BOOL CALLBACK TerminateAppEnum(HWND hwnd, LPARAM lParam); WORD TerminateAppByWindowClosing(DWORD pID, DWORD dwTimeout); WORD KillApp(DWORD pID); //--------------------------------------------------------------------------- #endif |
DWORD pID = 0;
HWND hEditor = NULL;
WORD wTA;
hEditor = FindWindow(NULL, "Unbenannt - Editor");
if(!hEditor)
{
MessageBox(hwnd, "Fenster nicht gefunden", "ERROR", MB_OK);
return;
}
GetWindowThreadProcessId(hEditor, &pID);
wTA = TerminateAppByWindowClosing(pID, 5000);
if(wTA != TA_SUCCESS_CLEAN)
{
char* buf1 = "Der Prozess konnte nicht durch blo�es Schlie�en des\n\
Fensters beendet werden. Wollen Sie ihn killen?";
char* buf2 = "Der Prozess konnte nicht gekillt werden";
char* buf3 = "Der Prozess konnte nicht ge�ffnet werden";
if(wTA == TA_CANNOT_OPEN)
MessageBox(hwnd, buf3, "ERROR", MB_OK|MB_ICONERROR);
else
{
INT resp = MessageBox(hwnd, buf1, "Information", MB_YESNO | MB_ICONINFORMATION);
if(resp == IDYES)
if(KillApp(pID) == TA_FAILED)
MessageBox(hwnd, buf2, "Fehler", MB_OK|MB_ICONERROR);
}
}
|
| NACH OBEN |
//--------------------------------------------------------------------------- #ifndef ColorButtonH #define ColorButtonH //--------------------------------------------------------------------------- VOID RegisterColorButtonClass(HINSTANCE hInstance); COLORREF GetColor(HWND hwnd); VOID SetColor(HWND hwnd, COLORREF color); COLORREF GetFontColor(HWND hwnd); VOID SetFontColor(HWND hwnd, COLORREF color); //--------------------------------------------------------------------------- #endif |
| NACH OBEN |