Click here to Skip to main content
15,901,001 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
appollosputnik1-Mar-12 1:53
appollosputnik1-Mar-12 1:53 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
Jochen Arndt1-Mar-12 2:03
professionalJochen Arndt1-Mar-12 2:03 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
appollosputnik1-Mar-12 3:14
appollosputnik1-Mar-12 3:14 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
Jochen Arndt1-Mar-12 3:38
professionalJochen Arndt1-Mar-12 3:38 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
appollosputnik1-Mar-12 3:58
appollosputnik1-Mar-12 3:58 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
Jochen Arndt1-Mar-12 4:14
professionalJochen Arndt1-Mar-12 4:14 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
appollosputnik1-Mar-12 4:30
appollosputnik1-Mar-12 4:30 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
appollosputnik1-Mar-12 4:32
appollosputnik1-Mar-12 4:32 
this is my dialog class of the dll.......In the view class you can see I have done ReleaseDC everywhere. Check if could help resolve this error. Thanks a lot for your help.
[code]
// DlgsViewDlg.cpp : implementation file
//

#include "stdafx.h"
#include "DlgsView.h"
#include "DlgsViewDlg.h"
#include "MyView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

static UINT BASED_CODE indicators[] =
{
ID_INDICATOR_NISH,
ID_INDICATOR_TIME
};

// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
CAboutDlg();

// Dialog Data
enum { IDD = IDD_ABOUTBOX };

protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support

// Implementation
protected:
DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()


// CDlgsViewDlg dialog


CString CDlgsViewDlg::fileName = L"";

CDlgsViewDlg::CDlgsViewDlg(CString filename, CWnd* pParent /*=NULL*/)
: CDialog(CDlgsViewDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
fileName = filename;
}

CDlgsViewDlg::~CDlgsViewDlg()
{
delete m_pNewView;

}

void CDlgsViewDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CDlgsViewDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_COMMAND(ID_FILE_NEW,OnFileNew)
//}}AFX_MSG_MAP
ON_COMMAND(ID_UTILITY_EXIT, &CDlgsViewDlg::OnUtilityExit)
ON_COMMAND(ID_EXIT, &CDlgsViewDlg::OnExit)
ON_COMMAND(ID_UTILITY_LOADPROFILE, &CDlgsViewDlg::OnUtilityLoadprofile)
ON_COMMAND(ID_UTILITY_GENERATESURFACE, &CDlgsViewDlg::OnUtilityGeneratesurface)
ON_COMMAND(ID_UTILITY_DRAW1, &CDlgsViewDlg::OnUtilityDraw1)
ON_COMMAND(ID_UTILITY_DRAW3, &CDlgsViewDlg::OnUtilityDraw3)
ON_COMMAND(ID_UTILITY_SAVEASIMAGE, &CDlgsViewDlg::OnUtilitySaveasimage)
ON_COMMAND(ID_VIEW_WIREFRAME, &CDlgsViewDlg::OnViewWireframe)
ON_COMMAND(ID_VIEW_SHADE, &CDlgsViewDlg::OnViewShade)
ON_COMMAND(ID_VIEW_NORMAL, &CDlgsViewDlg::OnViewNormal)
ON_COMMAND(ID_VIEW_PAN, &CDlgsViewDlg::OnViewPan)
ON_COMMAND(ID_VIEW_ZOOM, &CDlgsViewDlg::OnViewZoom)
ON_COMMAND(ID_VIEW_ROTATE, &CDlgsViewDlg::OnViewRotate)
ON_COMMAND(ID_VIEW_TOPVIEW, &CDlgsViewDlg::OnViewTopview)
ON_COMMAND(ID_VIEW_FRONTVIEW, &CDlgsViewDlg::OnViewFrontview)
ON_COMMAND(ID_VIEW_SIDEVIEW, &CDlgsViewDlg::OnViewSideview)
ON_COMMAND(ID_VIEW_ISOMETRICVIEW, &CDlgsViewDlg::OnViewIsometricview)
ON_COMMAND(ID_VIEW_ISOMETRICVIEW32787, &CDlgsViewDlg::OnViewIsometricview32787)
ON_COMMAND(ID_VIEW_ISOMETRICVIEW32788, &CDlgsViewDlg::OnViewIsometricview32788)
ON_COMMAND(ID_VIEW_ISOMETRICVIEW32789, &CDlgsViewDlg::OnViewIsometricview32789)
ON_COMMAND(ID_VIEW_COLORMODEL, &CDlgsViewDlg::OnViewColormodel)
ON_COMMAND(ID_VIEW_FITTOSCREEN, &CDlgsViewDlg::OnViewFittoscreen)
ON_COMMAND(ID_HELP_MANUAL, &CDlgsViewDlg::OnHelpManual)
ON_COMMAND(ID_COLORMODEL, &CDlgsViewDlg::OnColormodel)
ON_COMMAND(ID_DRAWHALFSURFACE, &CDlgsViewDlg::OnDrawhalfsurface)
ON_COMMAND(ID_DRAWTHREEFOURTHSURFACE, &CDlgsViewDlg::OnDrawthreefourthsurface)
ON_COMMAND(ID_FITTOSCREEN, &CDlgsViewDlg::OnFittoscreen)
ON_COMMAND(ID_FRONT, &CDlgsViewDlg::OnFront)
ON_COMMAND(ID_GENERATESURFACE, &CDlgsViewDlg::OnGeneratesurface)
ON_COMMAND(ID_ISONORTHEAST, &CDlgsViewDlg::OnIsonortheast)
ON_COMMAND(ID_ISONORTHWEST, &CDlgsViewDlg::OnIsonorthwest)
ON_COMMAND(ID_ISOSOUTHEAST, &CDlgsViewDlg::OnIsosoutheast)
ON_COMMAND(ID_ISOSOUTHWEST, &CDlgsViewDlg::OnIsosouthwest)
ON_COMMAND(ID_LOADPROFILE, &CDlgsViewDlg::OnLoadprofile)
ON_COMMAND(ID_NORMAL, &CDlgsViewDlg::OnNormal)
ON_COMMAND(ID_PAN, &CDlgsViewDlg::OnPan)
ON_COMMAND(ID_ROTATE, &CDlgsViewDlg::OnRotate)
ON_COMMAND(ID_SAVEASIMAGE, &CDlgsViewDlg::OnSaveasimage)
ON_COMMAND(ID_SHADE, &CDlgsViewDlg::OnShade)
ON_COMMAND(ID_SIDE, &CDlgsViewDlg::OnSide)
ON_COMMAND(ID_TOP, &CDlgsViewDlg::OnTop)
ON_COMMAND(ID_WIREFRAME, &CDlgsViewDlg::OnWireframe)
ON_COMMAND(ID_ZOOM, &CDlgsViewDlg::OnZoom)
ON_COMMAND(ID_HELP, &CDlgsViewDlg::OnHelp2)
END_MESSAGE_MAP()


BOOL CDlgsViewDlg::OnInitDialog()
{
CDialog::OnInitDialog();

m_pNewView = new CMyView();
ShowWindow(SW_SHOWMAXIMIZED);
CRect clientRect;
GetClientRect(&clientRect);
clientRect.DeflateRect(10, 30);
// Creation of the view window
if(! m_pNewView->Create(NULL, NULL, WS_VISIBLE | WS_CHILD, clientRect,
this, WM_USER))
{
MessageBox(L"Failed to create view");
}


menu.LoadMenu(IDR_MAINFRAME1);
SetMenu(&menu);


if(!m_FirstToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD |
WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS |
CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_FirstToolBar.LoadToolBar(IDR_TOOLBAR1))
{
EndDialog(IDCANCEL);
}

RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,0);

m_wndStatusBar.Create(this); //We create the status bar

m_wndStatusBar.SetIndicators(indicators,2); //Set the number of panes

CRect rect;
GetClientRect(&rect);
//Size the two panes
m_wndStatusBar.SetPaneInfo(0,ID_INDICATOR_NISH,
SBPS_NORMAL,rect.Width()-100);
m_wndStatusBar.SetPaneInfo(1,ID_INDICATOR_TIME,SBPS_STRETCH ,0);

//This is where we actually draw it on the screen
RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,
ID_INDICATOR_TIME);

m_wndStatusBar.SetPaneText(0,L"MainWindow Initialized");


if(!fileName.IsEmpty()) {
m_pNewView->loadProfile(fileName);
m_pNewView->domainSetUpForProfile();
m_pNewView->drawLines();
m_pNewView->drawArcs();
m_pNewView->drawProfile();
m_pNewView->isModel=true;
m_pNewView->OnGeneratesurface();
m_pNewView->OnShade();
m_pNewView->OnIsosouthwest();
}

return TRUE; // return TRUE unless you set the focus to a control
}

void CDlgsViewDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}

// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.

void CDlgsViewDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting

SendMessage(WM_ICONERASEBKGND, reinterpret_cast<wparam>(dc.GetSafeHdc()), 0);

// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;

// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}

// The system calls this function to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CDlgsViewDlg::OnQueryDragIcon()
{
return static_cast<hcursor>(m_hIcon);
}

void CDlgsViewDlg ::OnFileNew()
{
AfxMessageBox(L"On file Menu");
}



void CDlgsViewDlg::OnUtilityExit()
{
// TODO: Add your command handler code here
OnExit();
}

void CDlgsViewDlg::OnExit()
{
// TODO: Add your command handler code here
CWnd* pWin = AfxGetMainWnd();
::PostMessage(pWin->m_hWnd, WM_CLOSE,0,0);
}

void CDlgsViewDlg::OnUtilityLoadprofile()
{
// TODO: Add your command handler code here
OnLoadprofile();
}

void CDlgsViewDlg::OnUtilityGeneratesurface()
{
// TODO: Add your command handler code here
OnGeneratesurface();
}

void CDlgsViewDlg::OnUtilityDraw1()
{
// TODO: Add your command handler code here
OnDrawhalfsurface();
}

void CDlgsViewDlg::OnUtilityDraw3()
{
// TODO: Add your command handler code here
OnDrawthreefourthsurface();
}

void CDlgsViewDlg::OnUtilitySaveasimage()
{
// TODO: Add your command handler code here
OnSaveasimage();
}

void CDlgsViewDlg::OnViewWireframe()
{
// TODO: Add your command handler code here
OnWireframe();
}

void CDlgsViewDlg::OnViewShade()
{
// TODO: Add your command handler code here
OnShade();
}

void CDlgsViewDlg::OnViewNormal()
{
// TODO: Add your command handler code here
OnNormal();
}

void CDlgsViewDlg::OnViewPan()
{
// TODO: Add your command handler code here
m_pNewView->OnViewPan();
}

void CDlgsViewDlg::OnViewZoom()
{
// TODO: Add your command handler code here
m_pNewView->OnViewZoom();
}

void CDlgsViewDlg::OnViewRotate()
{
// TODO: Add your command handler code here
m_pNewView->OnViewRotate();
}

void CDlgsViewDlg::OnViewTopview()
{
// TODO: Add your command handler code here
OnTop();
}

void CDlgsViewDlg::OnViewFrontview()
{
// TODO: Add your command handler code here
OnFront();
}

void CDlgsViewDlg::OnViewSideview()
{
// TODO: Add your command handler code here
OnSide();
}

void CDlgsViewDlg::OnViewIsometricview()
{
// TODO: Add your command handler code here
OnIsosouthwest();
}

void CDlgsViewDlg::OnViewIsometricview32787()
{
// TODO: Add your command handler code here
OnIsonorthwest();
}

void CDlgsViewDlg::OnViewIsometricview32788()
{
// TODO: Add your command handler code here
OnIsosoutheast();
}

void CDlgsViewDlg::OnViewIsometricview32789()
{
// TODO: Add your command handler code here
OnIsonortheast();
}

void CDlgsViewDlg::OnViewColormodel()
{
// TODO: Add your command handler code here
OnColormodel();
}

void CDlgsViewDlg::OnViewFittoscreen()
{
// TODO: Add your command handler code here
OnFittoscreen();
}

void CDlgsViewDlg::OnHelpManual()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Opening documentation...");
m_pNewView->OnHelpManual();
}


/////////////////////////////////////////////////////
///////////TOOLBAR///////////////////////////////////
void CDlgsViewDlg::OnColormodel()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Color change for the model...");
m_pNewView->OnColormodel();
}

void CDlgsViewDlg::OnDrawhalfsurface()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Drawing the surface the selected profile...");
m_pNewView->OnDrawhalfsurface();
}

void CDlgsViewDlg::OnDrawthreefourthsurface()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Drawing the surface the selected profile...");
m_pNewView->OnDrawthreefourthsurface();
}

void CDlgsViewDlg::OnFittoscreen()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Fit to the screen...");
m_pNewView->OnFittoscreen();
}

void CDlgsViewDlg::OnFront()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Front view...");
m_pNewView->OnFront();
}

void CDlgsViewDlg::OnGeneratesurface()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Drawing the surface the selected profile...");
m_pNewView->OnGeneratesurface();
}

void CDlgsViewDlg::OnIsonortheast()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Isometric north east view...");
m_pNewView->OnIsonortheast();
}

void CDlgsViewDlg::OnIsonorthwest()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Isometric north west view...");
m_pNewView->OnIsonorthwest();
}

void CDlgsViewDlg::OnIsosoutheast()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Isometric south east view...");
m_pNewView->OnIsosoutheast();
}

void CDlgsViewDlg::OnIsosouthwest()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Isometric south west view...");
m_pNewView->OnIsosouthwest();
}

void CDlgsViewDlg::OnLoadprofile()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Drawing profile for the selected file...");
m_pNewView->OnLoadprofile();
}

void CDlgsViewDlg::OnNormal()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Model normal mode...");
m_pNewView->OnNormal();
}

void CDlgsViewDlg::OnPan()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Pan...");
m_pNewView->OnPan();
}

void CDlgsViewDlg::OnRotate()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Rotate...");
m_pNewView->OnRotate();
}

void CDlgsViewDlg::OnSaveasimage()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Save As Image");
m_pNewView->OnSaveasimage();
}

void CDlgsViewDlg::OnShade()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Model shading...");
m_pNewView->OnShade();
}

void CDlgsViewDlg::OnSide()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Model side view...");
m_pNewView->OnSide();
}

void CDlgsViewDlg::OnTop()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Model top view...");
m_pNewView->OnTop();
}

void CDlgsViewDlg::OnWireframe()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Model wireframe...");
m_pNewView->OnWireframe();
}

void CDlgsViewDlg::OnZoom()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Model zoom...");
m_pNewView->OnZoom();
}

void CDlgsViewDlg::OnHelp2()
{
// TODO: Add your command handler code here
m_wndStatusBar.SetPaneText(0,L"Opening documentation...");
m_pNewView->OnHelpManual();
}

void CDlgsViewDlg::PostNcDestroy()
{
// TODO: Add your specialized code here and/or call the base class

CDialog::PostNcDestroy();
delete this;
}

[/code]
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
Jochen Arndt1-Mar-12 5:34
professionalJochen Arndt1-Mar-12 5:34 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
appollosputnik1-Mar-12 6:02
appollosputnik1-Mar-12 6:02 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
Wes Aday1-Mar-12 6:13
professionalWes Aday1-Mar-12 6:13 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
Jochen Arndt1-Mar-12 6:16
professionalJochen Arndt1-Mar-12 6:16 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
Wes Aday1-Mar-12 6:19
professionalWes Aday1-Mar-12 6:19 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
appollosputnik1-Mar-12 6:25
appollosputnik1-Mar-12 6:25 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
Jochen Arndt1-Mar-12 6:34
professionalJochen Arndt1-Mar-12 6:34 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
Chris Meech1-Mar-12 6:40
Chris Meech1-Mar-12 6:40 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
appollosputnik1-Mar-12 16:34
appollosputnik1-Mar-12 16:34 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
Richard MacCutchan1-Mar-12 20:42
mveRichard MacCutchan1-Mar-12 20:42 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
appollosputnik1-Mar-12 21:54
appollosputnik1-Mar-12 21:54 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
Richard MacCutchan1-Mar-12 23:12
mveRichard MacCutchan1-Mar-12 23:12 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
appollosputnik1-Mar-12 20:19
appollosputnik1-Mar-12 20:19 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
Jochen Arndt1-Mar-12 21:46
professionalJochen Arndt1-Mar-12 21:46 
GeneralRe: loading dll second time giving error "A required resource was unavailable" Pin
appollosputnik2-Mar-12 3:59
appollosputnik2-Mar-12 3:59 
QuestionHow to read USB type Disk Drive device? Pin
Le@rner29-Feb-12 21:42
Le@rner29-Feb-12 21:42 
AnswerRe: How to read USB type Disk Drive device? Pin
Richard MacCutchan29-Feb-12 22:38
mveRichard MacCutchan29-Feb-12 22:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.