Page MenuHomedesp's stash

No OneTemporary

diff --git a/Scylla/AboutGui.cpp b/Scylla/AboutGui.cpp
index 3e87d15..5fb88ed 100644
--- a/Scylla/AboutGui.cpp
+++ b/Scylla/AboutGui.cpp
@@ -1,124 +1,125 @@
#include "AboutGui.h"
#include "definitions.h"
const WCHAR AboutGui::TEXT_VISIT[] = L"Visit <a>http://kickme.to/grn</a> and <a>http://forum.tuts4you.com</a>";
const WCHAR AboutGui::TEXT_DEVELOPED[] = L"Developed with Microsoft Visual Studio, written in pure C/C++";
const WCHAR AboutGui::TEXT_CREDIT_DISTORM[] = L"This tool uses the <a>diStorm disassembler library</a> v3";
const WCHAR AboutGui::TEXT_CREDIT_YODA[] = L"The PE Rebuilder engine is based on Realign DLL v1.5 by yoda";
const WCHAR AboutGui::TEXT_CREDIT_SILK[] = L"The small icons are taken from the <a>Silk icon package</a>";
const WCHAR AboutGui::TEXT_CREDIT_WTL[] = L"<a>Windows Template Library</a> v8 is used for the GUI";
const WCHAR AboutGui::TEXT_GREETINGS[] = L"Greetz: metr0, G36KV and all from the gRn Team";
const WCHAR AboutGui::TEXT_LICENSE[] = L"Scylla is licensed under the <a>GNU General Public License v3</a>";
const WCHAR AboutGui::URL_VISIT1[] = L"http://kickme.to/grn";
const WCHAR AboutGui::URL_VISIT2[] = L"http://forum.tuts4you.com";
const WCHAR AboutGui::URL_DISTORM[] = L"http://code.google.com/p/distorm/";
const WCHAR AboutGui::URL_WTL[] = L"http://wtl.sourceforge.net";
const WCHAR AboutGui::URL_SILK[] = L"http://www.famfamfam.com";
const WCHAR AboutGui::URL_LICENSE[] = L"http://www.gnu.org/licenses/gpl-3.0.html";
BOOL AboutGui::OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
{
StaticTitle.Attach(GetDlgItem(IDC_STATIC_ABOUT_TITLE));
StaticDeveloped.Attach(GetDlgItem(IDC_STATIC_DEVELOPED));
StaticGreetings.Attach(GetDlgItem(IDC_STATIC_GREETINGS));
StaticYoda.Attach(GetDlgItem(IDC_STATIC_YODA));
-
LinkVisit.Attach(GetDlgItem(IDC_SYSLINK_VISIT));
LinkDistorm.Attach(GetDlgItem(IDC_SYSLINK_DISTORM));
LinkWTL.Attach(GetDlgItem(IDC_SYSLINK_WTL));
LinkSilk.Attach(GetDlgItem(IDC_SYSLINK_SILK));
LinkLicense.Attach(GetDlgItem(IDC_SYSLINK_LICENSE));
+ // Create a bold font for the title
LOGFONT lf;
CFontHandle font = StaticTitle.GetFont();
font.GetLogFont(&lf);
lf.lfWeight = FW_BOLD;
FontBold.CreateFontIndirect(&lf);
StaticTitle.SetFont(FontBold, FALSE);
StaticTitle.SetWindowText(TEXT(APPNAME)TEXT(" ")TEXT(ARCHITECTURE)TEXT(" ")TEXT(APPVERSION));
StaticDeveloped.SetWindowText(TEXT_DEVELOPED);
StaticGreetings.SetWindowText(TEXT_GREETINGS);
StaticYoda.SetWindowText(TEXT_CREDIT_YODA);
setupLinks();
CenterWindow();
+ // Set focus to the OK button
GotoDlgCtrl(GetDlgItem(IDOK));
return FALSE;
}
void AboutGui::OnClose()
{
TooltipDistorm.DestroyWindow();
TooltipWTL.DestroyWindow();
TooltipSilk.DestroyWindow();
TooltipLicense.DestroyWindow();
FontBold.DeleteObject();
EndDialog(0);
}
LRESULT AboutGui::OnLink(NMHDR* pnmh)
{
const NMLINK* link = (NMLINK*)pnmh;
ShellExecute(NULL, L"open", link->item.szUrl, NULL, NULL, SW_SHOW);
return 0;
}
void AboutGui::OnExit(UINT uNotifyCode, int nID, CWindow wndCtl)
{
SendMessage(WM_CLOSE);
}
void AboutGui::setupLinks()
{
- LITEM item;
- item.mask = LIF_ITEMINDEX | LIF_URL;
- item.iLink = 0;
-
+ // Set link text (must be set before assigning URLs)
+ LinkVisit.SetWindowText(TEXT_VISIT);
LinkDistorm.SetWindowText(TEXT_CREDIT_DISTORM);
- wcscpy_s(item.szUrl, _countof(item.szUrl), URL_DISTORM);
- LinkDistorm.SetItem(&item);
-
LinkWTL.SetWindowText(TEXT_CREDIT_WTL);
- wcscpy_s(item.szUrl, _countof(item.szUrl), URL_WTL);
- LinkWTL.SetItem(&item);
-
LinkSilk.SetWindowText(TEXT_CREDIT_SILK);
- wcscpy_s(item.szUrl, _countof(item.szUrl), URL_SILK);
- LinkSilk.SetItem(&item);
-
LinkLicense.SetWindowText(TEXT_LICENSE);
- wcscpy_s(item.szUrl, _countof(item.szUrl), URL_LICENSE);
- LinkLicense.SetItem(&item);
- LinkVisit.SetWindowText(TEXT_VISIT);
- wcscpy_s(item.szUrl, _countof(item.szUrl), URL_VISIT1);
- LinkVisit.SetItem(&item);
- item.iLink = 1;
- wcscpy_s(item.szUrl, _countof(item.szUrl), URL_VISIT2);
- LinkVisit.SetItem(&item);
+ // Assign URLs to anchors in the link text
+ setLinkURL(LinkVisit, URL_VISIT1, 0);
+ setLinkURL(LinkVisit, URL_VISIT2, 1);
+ setLinkURL(LinkDistorm, URL_DISTORM);
+ setLinkURL(LinkWTL, URL_WTL);
+ setLinkURL(LinkSilk, URL_SILK);
+ setLinkURL(LinkLicense, URL_LICENSE);
+ // Create tooltips for the links
TooltipDistorm.Create(m_hWnd, NULL, NULL, TTS_NOPREFIX, WS_EX_TOPMOST);
TooltipWTL.Create(m_hWnd, NULL, NULL, TTS_NOPREFIX, WS_EX_TOPMOST);
TooltipSilk.Create(m_hWnd, NULL, NULL, TTS_NOPREFIX, WS_EX_TOPMOST);
TooltipLicense.Create(m_hWnd, NULL, NULL, TTS_NOPREFIX, WS_EX_TOPMOST);
+ // Assign control and text to the tooltips
setupTooltip(TooltipDistorm, LinkDistorm, URL_DISTORM);
setupTooltip(TooltipWTL, LinkWTL, URL_WTL);
setupTooltip(TooltipSilk, LinkSilk, URL_SILK);
setupTooltip(TooltipLicense, LinkLicense, URL_LICENSE);
}
+void AboutGui::setLinkURL(CLinkCtrl& link, const WCHAR* url, int index)
+{
+ LITEM item;
+ item.mask = LIF_ITEMINDEX | LIF_URL;
+ item.iLink = index;
+
+ wcscpy_s(item.szUrl, _countof(item.szUrl), url);
+ link.SetItem(&item);
+}
+
void AboutGui::setupTooltip(CToolTipCtrl tooltip, CWindow window, const WCHAR* text)
{
CToolInfo ti(TTF_SUBCLASS, window);
window.GetClientRect(&ti.rect);
ti.lpszText = const_cast<WCHAR *>(text);
tooltip.AddTool(ti);
}
diff --git a/Scylla/AboutGui.h b/Scylla/AboutGui.h
index 0f8c8d5..faedc53 100644
--- a/Scylla/AboutGui.h
+++ b/Scylla/AboutGui.h
@@ -1,90 +1,93 @@
#pragma once
#include <windows.h>
#include "resource.h"
// WTL
#include <atlbase.h> // base ATL classes
#include <atlapp.h> // base WTL classes
#include <atlwin.h> // ATL GUI classes
#include <atlcrack.h> // WTL enhanced msg map macros
#include <atlctrls.h> // WTL controls
class AboutGui : public CDialogImpl<AboutGui>
{
public:
enum { IDD = IDD_DLG_ABOUT };
BEGIN_MSG_MAP(AboutGui)
MSG_WM_INITDIALOG(OnInitDialog)
MSG_WM_CLOSE(OnClose)
NOTIFY_HANDLER_EX(IDC_SYSLINK_DISTORM, NM_CLICK, OnLink)
NOTIFY_HANDLER_EX(IDC_SYSLINK_DISTORM, NM_RETURN, OnLink)
NOTIFY_HANDLER_EX(IDC_SYSLINK_WTL, NM_CLICK, OnLink)
NOTIFY_HANDLER_EX(IDC_SYSLINK_WTL, NM_RETURN, OnLink)
NOTIFY_HANDLER_EX(IDC_SYSLINK_SILK, NM_CLICK, OnLink)
NOTIFY_HANDLER_EX(IDC_SYSLINK_SILK, NM_RETURN, OnLink)
NOTIFY_HANDLER_EX(IDC_SYSLINK_VISIT, NM_CLICK, OnLink)
NOTIFY_HANDLER_EX(IDC_SYSLINK_VISIT, NM_RETURN, OnLink)
COMMAND_ID_HANDLER_EX(IDOK, OnExit)
COMMAND_ID_HANDLER_EX(IDCANCEL, OnExit)
END_MSG_MAP()
protected:
// Controls
CStatic StaticTitle;
CStatic StaticDeveloped;
CStatic StaticGreetings;
CStatic StaticYoda;
CLinkCtrl LinkVisit;
CLinkCtrl LinkDistorm;
CLinkCtrl LinkWTL;
CLinkCtrl LinkSilk;
CLinkCtrl LinkLicense;
CToolTipCtrl TooltipDistorm;
CToolTipCtrl TooltipWTL;
CToolTipCtrl TooltipSilk;
CToolTipCtrl TooltipLicense;
// Handles
CFontHandle FontBold;
// Texts
static const WCHAR TEXT_VISIT[];
static const WCHAR TEXT_DEVELOPED[];
static const WCHAR TEXT_CREDIT_DISTORM[];
static const WCHAR TEXT_CREDIT_YODA[];
static const WCHAR TEXT_CREDIT_WTL[];
static const WCHAR TEXT_CREDIT_SILK[];
static const WCHAR TEXT_GREETINGS[];
static const WCHAR TEXT_LICENSE[];
// URLs
static const WCHAR URL_VISIT1[];
static const WCHAR URL_VISIT2[];
static const WCHAR URL_DISTORM[];
static const WCHAR URL_WTL[];
static const WCHAR URL_SILK[];
static const WCHAR URL_LICENSE[];
protected:
// Message handlers
BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam);
void OnClose();
LRESULT OnLink(NMHDR* pnmh);
void OnExit(UINT uNotifyCode, int nID, CWindow wndCtl);
+ // GUI helpers
+
void setupLinks();
+ void setLinkURL(CLinkCtrl& link, const WCHAR* url, int index = 0);
void setupTooltip(CToolTipCtrl tooltip, CWindow window, const WCHAR* text);
};
diff --git a/Scylla/MainGui.rc b/Scylla/MainGui.rc
index 9e944d9..a668c0e 100644
Binary files a/Scylla/MainGui.rc and b/Scylla/MainGui.rc differ

File Metadata

Mime Type
text/x-diff
Expires
Sat, Sep 21, 2:41 PM (1 d, 11 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
b5/9d/450e355207e05a1b727f4a1056b2

Event Timeline