Quantcast
Channel: Visual C forum
Viewing all 15302 articles
Browse latest View live

Cannot find interface "IMsRdpDrive" when using VS2008 (MFC class form typelib) to add an interface of mstscax.dll

$
0
0

Recently, I'm going to do a remote desktop software with C++.And I found its introduction in msdn,here is the address.

http://msdn.microsoft.com/en-us/library/aa383022(v=vs.85).aspx

So I use the mstscax.dll to complete this.But what is the problem is that by the way of adding MFC class form typelib I cannot find the interface IMsRdpDrive on list.

In another way of adding MFC class form ActiveX control,I found the interface I want. But,when I'm gonna add it to my project,there is an error "cannot find coclass for interface IMsRdpDrive".

What I want ask are the following 2 questions.

1.What is the difference of two way(MFC class from typelib and MFC class form activeX control)?

2.Why cannot find coclass for interface IMsRdpDrive?




How to disable com AddIns in Excel by c++/mfc programming?

$
0
0

Some third-party Excel com AddIns sometimes block my function: workbook.SaveAs(....), i.e.InvokeHelper(0x785).

When I disable Excel com AddIns  from UI (sometimes requies me to run as administrator), SaveAs works well.

So I am thinking whether it is possible for me to disable/enable third-party COM addIns programmatically or CreateDispatch("Excel.Application") in safe mode (just like pressing key ctrl when starting excel).

Thanks.

Copying vector fail in debug. Works fine in Release

$
0
0

I have two projects

  1. ProjectA
  2. ProjectB

I have a function in project B

void ProjectB::getData (std::vector<double>& vertexList)
{
  vertexList= mVertexList; // Code crash here in debug mode
}

When I call this getData function from ProjectA. Code crash while assigning the vector.

It works fine in Release mode, but fails in Debug mode.

Platform Toolset used for both projects is v100


error C2664: '_com_ptr_t::_com_ptr_t(int)' : cannot convert parameter 1 from 'ATL::CComPtr' to 'int'

$
0
0

Hi,

I'm migrating a project from vs 6.0 to vs 2008, I get the following error, I am not able to fix this issue and I could not understand why this is throwing a bug in vs 2008 while the same is working fine in vs 6.0

Details on the error below:

Error Line from Code:

XML::IXMLDOMNodePtr spNode(*oIte);

Error:

error C2664: '_com_ptr_t<_IIID>::_com_ptr_t(int)' : cannot convert parameter 1 from 'ATL::CComPtr<T>' to 'int'

Output:

error C2664: '_com_ptr_t<_IIID>::_com_ptr_t(int)' : cannot convert parameter 1 from 'ATL::CComPtr<T>' to 'int' with [ _IIID=_com_IIID<XML::IXMLDOMNode,& _GUID_2933bf80_7b36_11d2_b20e_00c04f983e60> ] and [ T=XML::IXMLDOMNode ]

Definition of IXMLDOMNodePtr

_COM_SMARTPTR_TYPEDEF(IXMLDOMNode, __uuidof(IXMLDOMNode));

Definition of oIte

for ( iterator oIte(m_spXMLNode->childNodes); oIte != iterator(); ++oIte )

Definition of m_spXMLNode

XML::IXMLDOMNodePtr m_spXMLNode; 
Can anyone suggest me on how to rewrite oIte to fix this issue.

XML::IXMLDOMNodePtr spNode(*oIte);

Any help is greatly appreciated. Thanks a lot in advance.

error C4772: #import referenced a type from a missing type library; '__missing_type__' used as a placeholder

$
0
0

Hiii

I am migrating my application from vc++6.0 to vc++2008

I am getting this error C4772 in one of the header file , Below is the code line:

// define same types to be used in ICusomImportImpl.h out of the namespace!
#import "../Policy1/Policy1.tlb" rename_namespace("Policy1") raw_interfaces_only, raw_native_types, named_guids  //error
using Policy1::IBusinessImport;
using Policy1::IBusinessImportHelpers;

This error is referencing towards Policy1.tlb, but when i checked this tlb file is being  created  in right path.

Can anyone suggest me the solution for this??

Thanks

error code 0x80040200

$
0
0

I have a legacy MFC C++ application that was compiled on XP with Visual Studio 9 on XP.

The application works on XP and has an installation package.

When I install it on Windows 7 everything works except one OCX designed to provide someDCOM capabilities - it fails with an error message indicating that there is an invalid class string. This does not happen on XP.

Having seen this error before I tried to register the OCX in question and that did indeed fail with the error message "xxx.OCX" was loaded but the call to DllRegisterServer failed with error code 0x80040200

The installation package did not report any errors and when I tried to register the OCX manually I was logged on as the administrator.

As the Windows 7 PC is not a development machine I have little debugging capabilities on it and I would not know how to set about debugging the regsvr32failure anyway, but if I run code that utilizes the OCX in question I see that the OCX is instantiated and only fails when it attempts to connect with my main application using something like:

pOe = new COleException;

m_IMyInterface.CreateDispatch(_T("MyApp.Document"), pOe);

The MyApp.Document application seems to be fine and updates the registry forMyApp.Documentso that it should be available for creation by CreateDispatch and although this works on XP it fails on Windows 7 – however I do not see why that should cause the OCX to fail to register.

Although the ocx fails to register it seems to be available as an ocx because it instantiates and only fails when attempting to create an instance of the main application.

All applications dll etc. reside on the same PC.

Any thoughts on how best to tackle this?

Thank you.

 

error C2664: 'Policy::IBusinessImport::SetCustomImport' : cannot convert parameter 1 from 'CustomImportBase::ICustomImport *' to '__missing_type__ *'_

$
0
0

HI

I am migrating my application from vc++6.0 to vc++2008, I am getting this error in one of the header file

In the same header file i also got other error which i have posted in forum http://social.msdn.microsoft.com/Forums/vstudio/en-US/166911a5-326e-4ab1-9df2-28637c97ef01/error-c4772-import-referenced-a-type-from-a-missing-type-library-missingtype-used-as-a?forum=vcgeneral

Sending the error line:

inline STDMETHODIMP IBusinessImportImpl::SetCustomImport(ICustomImport *customImport)
{
 return m_spBase->SetCustomImport(customImport); //error
}

Can anyone suggest me what i need to do here??

Thanks

Animation problem using double buffering

$
0
0

Hi,

 I am trying to animate a car in a graphic scene. It was working but now i have lost that code. When it runs a window starts developing from right bottom of screen and captures my entire background graphics. Kindly solve this problem.

I am using Visual C 6.0 and windows 7.

// AnimationCarView.cpp : implementation of the CAnimationCarView class
//

#include "stdafx.h"
#include "AnimationCar.h"

#include "AnimationCarDoc.h"
#include "AnimationCarView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAnimationCarView

IMPLEMENT_DYNCREATE(CAnimationCarView, CView)

BEGIN_MESSAGE_MAP(CAnimationCarView, CView)
	//{{AFX_MSG_MAP(CAnimationCarView)
	ON_WM_CREATE()
	ON_WM_TIMER()
	ON_WM_ERASEBKGND()
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAnimationCarView construction/destruction

CAnimationCarView::CAnimationCarView()
{
	// TODO: add construction code here
	i=150,j=190,k=145,l=140,m=138,n=195,o=197,p=170,q=148,r=185;
	penGrey.CreatePen(PS_SOLID, 5, RGB(128,128,128));//GREY color
	penLGrey.CreatePen(PS_SOLID,5, RGB(220,220,220));//LGREY color
	penBlack.CreatePen(PS_SOLID, 5, RGB(0,0,0));
	pOldPen=NULL;
	brGrey.CreateSolidBrush(RGB(128, 128, 128));
	brLGrey.CreateSolidBrush(RGB(220,220,220));
	brBlack.CreateSolidBrush(RGB(0, 0, 0));
	pOldBrush=NULL;
}

CAnimationCarView::~CAnimationCarView()
{
}

BOOL CAnimationCarView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CAnimationCarView drawing

void CAnimationCarView::road(CDC* pDC){ 
	CPoint poly6[8]={CPoint(0,400), CPoint(210,400),CPoint(210,440),CPoint(0,440)};
	CPen pen(PS_SOLID, 5, RGB(220,220,220));
	CPen* pOldPen=NULL;
	pOldPen=pDC->SelectObject(&pen);
	CBrush br(RGB(220, 220, 220));
	CBrush* pOldBrush=NULL;
	pOldBrush=pDC->SelectObject(&br);
	pDC->Polygon(poly6, 4);
	pDC->SelectObject(pOldBrush);
	pDC->SelectObject(pOldPen);
	}

void CAnimationCarView::mountain(CDC* pDC)
{
	//setcolor(BROWN);
	CPen penBrown(PS_SOLID, 5, RGB(150,75,0));
	CPen* pOldPen=NULL;
	pOldPen=pDC->SelectObject(&penBrown);
	//line(0,250,700,250);
	pDC->MoveTo(0,250);
	pDC->LineTo(700,250);
	//line(0,250,0,160);
	pDC->MoveTo(0,250);
	pDC->LineTo(0,160);
	//line(0,160,30,200);
	pDC->MoveTo(0,160);
	pDC->LineTo(30,200);
	//line(30,200,80,120);
	pDC->MoveTo(30,200);
	pDC->LineTo(80,120);
    //arc(90,124,30,150,10);
	pDC->AngleArc(90,124,10,30,150);
	//line(99,119,150,180);
	pDC->MoveTo(99,119);
	pDC->LineTo(150,180);
	//line(150,180,220,100);
	pDC->MoveTo(150,180);
	pDC->LineTo(220,100);
	//arc(234,106,30,150,15);
	pDC->AngleArc(234,106,15,30,150);
	//line(248,99,320,200);
	pDC->MoveTo(248,99);
	pDC->LineTo(320,200);
	//line(320,200,370,125);
	pDC->MoveTo(320,200);
	pDC->LineTo(370,125);
	//arc(380,129,30,150,10);
	pDC->AngleArc(380,129,10,30,150);
	//line(389,124,430,180);
	pDC->MoveTo(389,124);
	pDC->LineTo(430,180);
	//line(430,180,505,90);
	pDC->MoveTo(430,180);
	pDC->LineTo(505,90);
	//arc(519,96,30,150,15);
	pDC->AngleArc(519,96,15,30,150);
	//line(533,89,605,200);
	pDC->MoveTo(533,89);
	pDC->LineTo(605,200);
	//line(605,200,700,110);
	pDC->MoveTo(605,200);
	pDC->LineTo(700,170);
	//line(700,170,700,250);
	pDC->MoveTo(700,170);
	pDC->LineTo(700,250);
	CBrush brBrown(RGB(150, 75, 0));
	CBrush* pOldBrush=NULL;
	pOldBrush=pDC->SelectObject(&brBrown);
	pDC->FloodFill(10,245,RGB(150,75,0));
	pDC->SelectObject(pOldBrush);
	pDC->SelectObject(pOldPen);
}

void CAnimationCarView::stationary_car(CDC* pDC)
{
	//int i=150,j=190,k=145,l=140,m=138,n=195,o=197,p=170,q=148,r=185;
	//CPen penGrey(PS_SOLID, 5, RGB(128,128,128));//GREY color
	CBitmap XMap,*pOldMap;
	CPen* pOldPen=NULL;
	pOldPen=pDC->SelectObject(&penGrey);
	SIZE Size;
    Size.cx = GetSystemMetrics(SM_CXSCREEN);
    Size.cy = GetSystemMetrics(SM_CYSCREEN);
	XMap.CreateCompatibleBitmap(pDC,Size.cx,Size.cy);
	CDC WorkDC;
	CDC *MyDC=&WorkDC;
	MyDC->CreateCompatibleDC(pDC);
	pOldMap=MyDC->SelectObject(&XMap);
	//line(i,402,j,402);
	MyDC->MoveTo(i,402);
	MyDC->LineTo(j,402);
	//line(j,415,k,415);
	MyDC->MoveTo(j,415);
	MyDC->LineTo(k,415);
	//line(j,402,j,415);
	MyDC->MoveTo(j,402);
	MyDC->LineTo(j,415);
	//line(k,415,i,402);
	MyDC->MoveTo(k,415);
	MyDC->LineTo(i,402);
	//setfillstyle(SOLID_FILL,6);
	//CBrush brGrey(RGB(128, 128, 128));
	CBrush* pOldBrush=NULL;
	//floodfill(p,408,6);
	//NOTE IF FloodFill done after select object, color mixing would occur 
	pOldBrush=MyDC->SelectObject(&brGrey);
	MyDC->FloodFill(p,408,RGB(128,128,128));
	//line(n,415,o,428);
	MyDC->MoveTo(n,415);
	MyDC->LineTo(o,428);
	//line(l,415,m,428);
	MyDC->MoveTo(l,415);
	MyDC->LineTo(m,428);
	//line(l,415,n,415);
	MyDC->MoveTo(l,415);
	MyDC->LineTo(n,415);
	//line(o,428,m,428);
	MyDC->MoveTo(o,428);
	MyDC->LineTo(m,428);
	//setfillstyle(SOLID_FILL,6);
	//floodfill(p,422,6);
	MyDC->FloodFill(p,422,RGB(128,128,128));
	MyDC->SelectObject(pOldBrush);
	MyDC->SelectObject(pOldPen);
	//Drawing wheels
	//circle(q,434,5);
	CBrush brBlack(RGB(0, 0, 0));
	pOldBrush=NULL;
	pOldBrush=MyDC->SelectObject(&brBlack);
	//CPen penBlack(PS_SOLID, 5, RGB(0,0,0));//Black color
	pOldPen=NULL;
	pOldPen=MyDC->SelectObject(&penBlack);
	MyDC->MoveTo(r,434);
	MyDC->AngleArc(q,434,5,0,360);
	MyDC->FloodFill(q,434,RGB(0,0,0));
	//circle(r,434,5);
	MyDC->AngleArc(r,434,5,0,360);
	pDC->BitBlt(j,k,Size.cx,Size.cy,MyDC,0,0,SRCCOPY);
	MyDC->SelectObject(pOldPen);
	MyDC->SelectObject(pOldBrush);
	MyDC->SelectObject(pOldMap);
	XMap.DeleteObject();
	MyDC->DeleteDC();

}


void CAnimationCarView::OnDraw(CDC* pDC)
{
	CAnimationCarDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	CBitmap XMap,*pOldMap;
	CRect rc;
    GetClientRect(&rc);
	XMap.CreateCompatibleBitmap(pDC,rc.Width(), rc.Height());
	CDC WorkDC;
	CDC *MyDC=&WorkDC;
	MyDC->CreateCompatibleDC(pDC);
	pOldMap=MyDC->SelectObject(&XMap);
	road(MyDC);
	mountain(MyDC);
	stationary_car(MyDC);
	pDC->BitBlt(0, 0, rc.Width(), rc.Height(), MyDC, 0, 0, SRCCOPY);
	MyDC->SelectObject(pOldMap);
	XMap.DeleteObject();
	MyDC->DeleteDC();

}

/////////////////////////////////////////////////////////////////////////////
// CAnimationCarView printing

BOOL CAnimationCarView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CAnimationCarView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CAnimationCarView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CAnimationCarView diagnostics

#ifdef _DEBUG
void CAnimationCarView::AssertValid() const
{
	CView::AssertValid();
}

void CAnimationCarView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CAnimationCarDoc* CAnimationCarView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CAnimationCarDoc)));
	return (CAnimationCarDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CAnimationCarView message handlers

/*void CTestG1View::mountain(CDC* pDC)
{
	//setcolor(BROWN);
	CPen penBrown(PS_SOLID, 5, RGB(150,75,0));
	CPen* pOldPen=NULL;
	pOldPen=pDC->SelectObject(&penBrown);
	//line(0,250,700,250);
	pDC->MoveTo(0,250);
	pDC->LineTo(700,250);
	//line(0,250,0,160);
	pDC->MoveTo(0,250);
	pDC->LineTo(0,160);
	//line(0,160,30,200);
	pDC->MoveTo(0,160);
	pDC->LineTo(30,200);
	//line(30,200,80,120);
	pDC->MoveTo(30,200);
	pDC->LineTo(80,120);
    //arc(90,124,30,150,10);
	pDC->AngleArc(90,124,10,30,150);
	//line(99,119,150,180);
	pDC->MoveTo(99,119);
	pDC->LineTo(150,180);
	//line(150,180,220,100);
	pDC->MoveTo(150,180);
	pDC->LineTo(220,100);
	//arc(234,106,30,150,15);
	pDC->AngleArc(234,106,15,30,150);
	//line(248,99,320,200);
	pDC->MoveTo(248,99);
	pDC->LineTo(320,200);
	//line(320,200,370,125);
	pDC->MoveTo(320,200);
	pDC->LineTo(370,125);
	//arc(380,129,30,150,10);
	pDC->AngleArc(380,129,10,30,150);
	//line(389,124,430,180);
	pDC->MoveTo(389,124);
	pDC->LineTo(430,180);
	//line(430,180,505,90);
	pDC->MoveTo(430,180);
	pDC->LineTo(505,90);
	//arc(519,96,30,150,15);
	pDC->AngleArc(519,96,15,30,150);
	//line(533,89,605,200);
	pDC->MoveTo(533,89);
	pDC->LineTo(605,200);
	//line(605,200,700,110);
	pDC->MoveTo(605,200);
	pDC->LineTo(700,170);
	//line(700,170,700,250);
	pDC->MoveTo(700,170);
	pDC->LineTo(700,250);
	CBrush brBrown(RGB(150, 75, 0));
	CBrush* pOldBrush=NULL;
	pOldBrush=pDC->SelectObject(&brBrown);
	pDC->FloodFill(10,245,RGB(150,75,0));
	pDC->SelectObject(pOldBrush);
	pDC->SelectObject(pOldPen);
}

CTestG1View::CTestG1View()
{
	// TODO: add construction code here
	i=150,j=190,k=145,l=140,m=138,n=195,o=197,p=170,q=148,r=185;
	penGrey.CreatePen(PS_SOLID, 5, RGB(128,128,128));//GREY color
	penLGrey.CreatePen(PS_SOLID,5, RGB(220,220,220));//LGREY color
	penBlack.CreatePen(PS_SOLID, 5, RGB(0,0,0));
	pOldPen=NULL;
	brGrey.CreateSolidBrush(RGB(128, 128, 128));
	brLGrey.CreateSolidBrush(RGB(220,220,220));
	brBlack.CreateSolidBrush(RGB(0, 0, 0));
	pOldBrush=NULL;
	
}

int CTestG1View::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;
	//void (*p)(UINT);
	//p=&CTestG1View::OnTimer;
	SetTimer(1,200,NULL);
	// TODO:  Add your specialized creation code here

	return 0;
}    

void CTestG1View::OnTimer(UINT  nIDEvent){
	if(i>0){
	i=i-3;
	Invalidate();
	j=j-3;k=k-3;l=l-3;m=m-3;n=n-3;o=o-3;p=p-3;q=q-3;r=r-3;
	}
}
void CTestG1View::road(CDC* pDC){ 
	CPoint poly6[8]={CPoint(0,400), CPoint(210,400),CPoint(210,440),CPoint(0,440)};
	CPen pen(PS_SOLID, 5, RGB(220,220,220));
	CPen* pOldPen=NULL;
	pOldPen=pDC->SelectObject(&pen);
	CBrush br(RGB(220, 220, 220));
	CBrush* pOldBrush=NULL;
	pOldBrush=pDC->SelectObject(&br);
	pDC->Polygon(poly6, 4);
	pDC->SelectObject(pOldBrush);
	pDC->SelectObject(pOldPen);
	}


void CTestG1View::stationary_car(CDC* pDC)
{
	//int i=150,j=190,k=145,l=140,m=138,n=195,o=197,p=170,q=148,r=185;
	//CPen penGrey(PS_SOLID, 5, RGB(128,128,128));//GREY color
	CBitmap XMap,*pOldMap;
	CPen* pOldPen=NULL;
	pOldPen=pDC->SelectObject(&penGrey);
	SIZE Size;
    Size.cx = GetSystemMetrics(SM_CXSCREEN);
    Size.cy = GetSystemMetrics(SM_CYSCREEN);
	XMap.CreateCompatibleBitmap(pDC,Size.cx,Size.cy);
	CDC WorkDC;
	CDC *MyDC=&WorkDC;
	MyDC->CreateCompatibleDC(pDC);
	pOldMap=MyDC->SelectObject(&XMap);
	//line(i,402,j,402);
	MyDC->MoveTo(i,402);
	MyDC->LineTo(j,402);
	//line(j,415,k,415);
	MyDC->MoveTo(j,415);
	MyDC->LineTo(k,415);
	//line(j,402,j,415);
	MyDC->MoveTo(j,402);
	MyDC->LineTo(j,415);
	//line(k,415,i,402);
	MyDC->MoveTo(k,415);
	MyDC->LineTo(i,402);
	//setfillstyle(SOLID_FILL,6);
	//CBrush brGrey(RGB(128, 128, 128));
	CBrush* pOldBrush=NULL;
	//floodfill(p,408,6);
	//NOTE IF FloodFill done after select object, color mixing would occur 
	pOldBrush=MyDC->SelectObject(&brGrey);
	MyDC->FloodFill(p,408,RGB(128,128,128));
	//line(n,415,o,428);
	MyDC->MoveTo(n,415);
	MyDC->LineTo(o,428);
	//line(l,415,m,428);
	MyDC->MoveTo(l,415);
	MyDC->LineTo(m,428);
	//line(l,415,n,415);
	MyDC->MoveTo(l,415);
	MyDC->LineTo(n,415);
	//line(o,428,m,428);
	MyDC->MoveTo(o,428);
	MyDC->LineTo(m,428);
	//setfillstyle(SOLID_FILL,6);
	//floodfill(p,422,6);
	MyDC->FloodFill(p,422,RGB(128,128,128));
	MyDC->SelectObject(pOldBrush);
	MyDC->SelectObject(pOldPen);
	//Drawing wheels
	//circle(q,434,5);
	CBrush brBlack(RGB(0, 0, 0));
	pOldBrush=NULL;
	pOldBrush=MyDC->SelectObject(&brBlack);
	//CPen penBlack(PS_SOLID, 5, RGB(0,0,0));//Black color
	pOldPen=NULL;
	pOldPen=MyDC->SelectObject(&penBlack);
	MyDC->MoveTo(r,434);
	MyDC->AngleArc(q,434,5,0,360);
	MyDC->FloodFill(q,434,RGB(0,0,0));
	//circle(r,434,5);
	MyDC->AngleArc(r,434,5,0,360);
	pDC->BitBlt(j,k,Size.cx,Size.cy,MyDC,0,0,SRCCOPY);
	MyDC->SelectObject(pOldPen);
	MyDC->SelectObject(pOldBrush);
	MyDC->SelectObject(pOldMap);
	XMap.DeleteObject();
	MyDC->DeleteDC();

}

void CTestG1View::OnDraw(CDC* pDC)
{
	CTestG1Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;
	road(pDC);
	mountain(pDC);
	stationary_car(pDC);
	//moving_car(pDC);
	// TODO: add draw code for native data here
}

  */

BOOL CAnimationCarView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) 
{
	// TODO: Add your specialized code here and/or call the base class
		//SetTimer(1,200,NULL);
	return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}

int CAnimationCarView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;
	SetTimer(1,200,NULL);
	// TODO: Add your specialized creation code here
	
	return 0;
}

void CAnimationCarView::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	if(i>0){
	i=i-3;
	Invalidate();
	j=j-3;k=k-3;l=l-3;m=m-3;n=n-3;o=o-3;p=p-3;q=q-3;r=r-3;
	}
	CView::OnTimer(nIDEvent);
}

BOOL CAnimationCarView::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
	return TRUE;
	return CView::OnEraseBkgnd(pDC);
}






















//Header file
// AnimationCarView.h : interface of the CAnimationCarView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_ANIMATIONCARVIEW_H__868E797E_E1BA_48B0_BA06_C84A7591A32B__INCLUDED_)
#define AFX_ANIMATIONCARVIEW_H__868E797E_E1BA_48B0_BA06_C84A7591A32B__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


class CAnimationCarView : public CView
{
protected: // create from serialization only
	CAnimationCarView();
	DECLARE_DYNCREATE(CAnimationCarView)

// Attributes
public:
	CAnimationCarDoc* GetDocument();

// Operations
public:
 void mountain(CDC*);
 void road(CDC* pDC);
 void stationary_car(CDC* pDC);
 int i,j,k,l,m,n,o,p,q,r;
 CPen penGrey, penLGrey, penBlack;
 CPen *pOldPen;
 CBrush brGrey, brLGrey, brBlack;
 CBrush* pOldBrush;
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAnimationCarView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CAnimationCarView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CAnimationCarView)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in AnimationCarView.cpp
inline CAnimationCarDoc* CAnimationCarView::GetDocument()
   { return (CAnimationCarDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_ANIMATIONCARVIEW_H__868E797E_E1BA_48B0_BA06_C84A7591A32B__INCLUDED_)


Kindly guide me.

Zulfi.


afxwin2.inl line 265

$
0
0

I have an MDI app, and from a dialogbar, I open a child, one by one ... If something goes wrong, I display an modal dialog, by the cause ... the issue is that after I close this dialog modal, I get an assert error:

"Debug assertion failed !"

File Afxwin2.inl, line 265 ... and there, I get:

_AFXWIN_INLINE CWnd* CWnd::GetParent() const
	{ ASSERT(::IsWindow(m_hWnd)); return CWnd::FromHandle(::GetParent(m_hWnd)); }

I had tried a lot of posible causes ... have you met by this assertion ? What is the real cause ? Can you help me ? Thank you.


Detect Stack vs. Heap Location?

$
0
0

Working in Visual Studio 2013, C++, unmanaged code.  In a function which receives a pointer to an object, is there a way for the function to detect whether the object is on the stack, as opposed to on the heap? (I’ve searched the forum for stack vs. heap issues, but found nothing about this.)

Convert C++ to GPU compatible program

$
0
0

Hi,

We are interested in converting a C++ model to a gpu compatible program.

Is there a way to do this, is there some sort of software?

Thanks

ActiveX Control without MFC/ATL

$
0
0

I created an ActiveX control without using MFC/ATL class assistent by implementing the Basic Interfaces.

I am testing the control using a MFC-Dialog. The control is created by CDialog::CreateControl( ). This works fine an the control is displayed. In the method  IOleWindow::Get Window( ) the HWND of the control is given back. But the control container tries later  in function Attach_Window( ) to attach this handle to the conatiners CWnd which leads to an exception. Obviously something goes wrong with the window handles.

This leads to the following questions:

What is going wrong here?

What has the function IOleWindow::Get Window( ) has to return,i.e. the handle of which window?

What is the right location to create the server window?  (Currently in COleObject::DoVerb)

What is the minimal set of interfaces in order to implement a working ActiveX control?

Thank you,

Thomas

Problem with CMFCToolBarComboBoxButton

$
0
0

After I added item "&" to the CMFCToolBarComboBoxButton control.  When I select it, the combo box will display blank.  Please use the sample "ToolbarDateTimePicker".  In MainFrm.cpp ::OnToolbarReset function, add the line cb.AddItem( "&" );  Also, make sure you add the code to enable the combobox.

Where does it say in the C++ Standard, that you can't take addresses of temporaries?

$
0
0
I've spent already a few hours looking for this kind of information in the Standard, to no avail.

CPaintDC context outside OnPaint()

$
0
0

So I have the following code to draw somewhat of a ">" in my OnPaint() function:

void CChildView::OnPaint()
{
CPaintDC pDC(this); // device context for painting
...
int i1, i2;
i1 = RightSide -50;
i2 = (Bottom - Top)/2-31;
for (int ii=0; ii<31; ii++)
	{
	pDC.PatBlt(i1++ ,i2++ , 8, 1, DSTINVERT);
	}
for (int ii=0; ii<31; ii++)
	{
	pDC.PatBlt(i1--,i2++ , 8, 1, DSTINVERT);
	}
...

So, I am going to use this code repeatedly, like later to erase the ">", so I create a function:

void CChildView::RArrowOn(void) { CPaintDC pDC2(this); // device context for painting int i1, i2; i1 = Right-50; i2 = (Bottom - Top)/2-31; for (int ii=0; ii<31; ii++) { pDC2.PatBlt(i1++ ,i2++ , 8, 1, DSTINVERT); } for (int ii=0; ii<31; ii++) { pDC2.PatBlt(i1--,i2++ , 8, 1, DSTINVERT); } }

So, those of you who are good at this know (as I have found out by reading lots of "help" files), you can't use a CPaintDC outside of OnPaint(). So I tried passing passing pDC to the function, which also didn't work as I suspected (but I tried anyway).

I really don't want to duplicate this code and a lot of similar code in various places in OnPaint(). A solution would be appreciated, and I have a feeling there is a simple solution.


WNetAddConnection failed.

$
0
0

Hi,

I have used "WNetAddConnection function" API to map n/w drive(to a local shared path) and its working fine.

But when I executed my application on system start up, sometimes this API fails with error code 53(ERROR_BAD_NETPATH).

When I put some delay in  my application( before calling WNetAddConnection ), it works.

Hmm.. i think the problem occurs because of WNetAddConnection  API is called before some OS initialization( may be some shares or sometime..).

Does anyone have the same problem? Any workaround is possible?

Any guidance would be appreciated.

Thanks,

Arun

LINK : fatal error LNK1104: cannot open file 'dxerr.lib'

$
0
0

I've been sent code that I need to work on, but whenever I build I get the following message.

I don't know why, I've looked for the dxerr file and looks to be there. Does anybody know how to solve this?

Showing a window on different desktop

$
0
0

I have 2 questions.

I have an application which shows a full screen window in a different desktop. The issue is when the desktop is switched to show the dialog, the new desktop background is visible for a moment and then only the full screen window is showing.

Question 1:

My code is similar to below code snippet. Is this correct way to switch desktop?

if( !::SetThreadDesktop(hNewDesk))
 {
    LogError( "SetThreadDesktop() failed" );
	return;
 }
 if (!::SwitchDesktop(hNewDesk))
  {
    LogError( "SwitchDesktop() failed" );
    return;
 }

Question 2:

I know how to start an application in a different desktop using CreateProcess() without switching to that Desktop.I wanted to create a Window in another desktop without switching to that desktop.For example Desktop 1 and Desktop 2. I wanted to create full screen window in Desktop 2 from Desktop 1 without switching to Desktop 2 so that the window is already visible in Desktop 2 when SwitchDesktop() is called. Could anyone help me in this?





Thanks, Renjith V R

Turn off annoying "find in selection"?

$
0
0

Like many others, I never search within a "selection". Is there a way to turn off that annoying automatic choice when trying to Find or Find and Replace text?

Thanks.

Google & yahoo indexing and crawl?

$
0
0
I submitted all my .html files to google for indexing yesterday. I understand it'll take about a week to crawl. During this time, am I allowed to edit those files since I need to update information? And by the way, what is SEO? How do I get that worked on my website? What else do I need? 

Thanks for your time and help! 
Viewing all 15302 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>