|
// MainDlg.cpp : implementation of the CMainDlg class
//
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "resource.h"
#include <atlmisc.h>
#include "PropertyBagImpl.hpp"
#include "XcpCtrl.h"
#include "MainDlg.h"
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
// center the dialog on the screen
CenterWindow();
// set icons
HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME),
IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR);
SetIcon(hIcon, TRUE);
HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME),
IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
SetIcon(hIconSmall, FALSE);
CRect rc;
CWindow win = GetDlgItem(IDC_CTL_FRAME);
win.GetWindowRect( rc );
win.DestroyWindow();
ScreenToClient( rc );
HRESULT hr;
ActiveXSite* pSite;
pSite = CAxWindowlessHost<CMainDlg>::CreateControlSite(L"AgControl.AgControl", NULL, IDC_AGCONTROL1);
if ( pSite != NULL )
{
// disable right-click!
pSite->SetAllowRClick(false);
// set moniker URL
//CComBSTR bstrUrl("file:///C:/Temp/SortTheFoobars.xap");
CComBSTR bstrUrl("http://www.andybeaulieu.com/silverlight/2.0/sortthefoobars/ClientBin/SortTheFoobars.xap");
pSite->SetUrl(bstrUrl);
PropertyParams props;
props.push_back( PropertyParam(L"Windowless", L"true") );
props.push_back( PropertyParam(L"MinRuntimeVersion", L"2.0.31005.0") );
props.push_back( PropertyParam(L"Source", static_cast<LPCWSTR>(bstrUrl)) );
props.push_back( PropertyParam(L"InitParams", L"") );
hr = pSite->ActivateAx(rc, false, props);
}
return TRUE;
}
LRESULT CMainDlg::OnAppAbout(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
CSimpleDialog<IDD_ABOUTBOX, FALSE> dlg;
dlg.DoModal();
return 0;
}
LRESULT CMainDlg::OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
// TODO: Add validation code
EndDialog(wID);
return 0;
}
LRESULT CMainDlg::OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
EndDialog(wID);
return 0;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Ernest is a multi-discipline software engineer.
Skilled at software design and development for all Windows platforms.
-
MCSD (C#, .NET)
Interests: User Interface, GDI/GDI+, Scripting, Android, iOS, Windows Mobile.
Programming Skills: C/C++, C#, Java (Android), VB and ASP.NET.
I hope you will enjoy my contributions.