|
ptr_Electron wrote: ...it is working fine in the Debug mode
Doubtful. Bugs are bugs, whether in debug mode or release mode. The problem has likely just been masked by something else.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
ptr_Electron wrote: void MainFrame::OnStart()
{
Dlg->DoModal(); // dialog is displayed and after closing the dialog app. crashes
}
I think you are sending some user defined message and You are not handling WPARAM and LPARAM.
You need to define the parameters even if you are not using them. Just add these parameters and your crash in release mode will be resolved.
void MainFrame::OnStart(WPARAM wParam, LPARAM lParam)
{
Dlg->DoModal();
}
Also dont forget to edit the function declaration in CMainFrame.
Regards,
Sandip.
|
|
|
|
|
Hi frinds
I want to include animations in Dialog based MFC application
please help me in this matter
hassan
|
|
|
|
|
|
|
Hi all,
I have this error:
1>UpdateServiceModule.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class ATL::CStringT<wchar_t,class ATL::StrTraitATL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __cdecl GetProductSiteCode(void)" (__imp_?GetProductSiteCode@@YA?AV?$CStringT@_WV?$StrTraitATL@_WV?$ChTraitsCRT@_W@ATL@@@ATL@@@ATL@@XZ)
1>D:\SVN\Licensin System\Work Package\UpdateManager\Debug\UpdateService.exe : fatal error LNK1120: 1 unresolved externals
I am not sure what the problem is because I have included the CaptureServerCpl.lib ung my solution and have included its directory to where the solution searches for libraries.
Please advise.
Thanks
Jayjay
|
|
|
|
|
monsieur_jj wrote: I am not sure what the problem is because I have included the CaptureServerCpl.lib ung my solution a
The error says that the linker is looking for a function which has a calling convention of __cdecl is it due to this.
Might be that your function has __stdcall but your project specifies a default calling convention of __cdecl .
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hi Nibu,
This is how i wrote it at the dll project:
#define DLLEXPORT __declspec(dllexport)
.
.
.
.
class CJJPropertyPage5 : public CPropertyPage
{ DECLARE_DYNCREATE(CJJPropertyPage5)
public:
DLLEXPORT CString GetProductSiteCode(void);
.
.
.
Now this is how I am calling it at my exe:
#define DLLIMPORT __declspec(dllimport)
DLLIMPORT CString GetProductSiteCode(void);
Is there a difference? what seems to be wrong?
Thanks,
Jayjay
|
|
|
|
|
monsieur_jj wrote: DLLIMPORT CString GetProductSiteCode(void);
Change this to the following...
DLLIMPORT CString __stdcall GetProductSiteCode(void);
IMO default calling convention in both projects looks different. This might be causing the problem, though this is just a guess.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hi Nibu,
I have tried that and this is the error i got:
1>UpdateServiceModule.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class ATL::CStringT<wchar_t,class ATL::StrTraitATL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __stdcall GetProductSiteCode(void)" (__imp_?GetProductSiteCode@@YG?AV?$CStringT@_WV?$StrTraitATL@_WV?$ChTraitsCRT@_W@ATL@@@ATL@@@ATL@@XZ) referenced in function "public: bool __thiscall redmap::CUpdateServiceModule::DoCheckForProductUpdates(class ns1__Update,struct redmap::RMproduct *)" (?DoCheckForProductUpdates@CUpdateServiceModule@redmap@@QAE_NVns1__Update@@PAURMproduct@2@@Z)
1>D:\SVN\Licensin System\Work Package\UpdateManager\Debug\UpdateService.exe : fatal error LNK1120: 1 unresolved externals
What looks different in both project? Is it an issue if the dll project an MFC project then the exe project is a atl/wtl project?
|
|
|
|
|
monsieur_jj wrote: // Construction
public:
DLLEXPORT CString GetProductSiteCode(void);
.
Oops you are exporting a member function, but in fact you should export the whole class, you cannot export member functions of a class selectively, either the whole class or none.
I missed that part.
monsieur_jj wrote: class CJJPropertyPage5 : public CPropertyPage
{ DECLARE_DYNCREATE(CJJPropertyPage5)
class DLLEXPORT CJJPropertyPage5 : public CPropertyPage
And then import the class where you are planning to use it.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hi Nibu,
Do i have to rewrite the whole class?
Thanks,
Jayjay
|
|
|
|
|
monsieur_jj wrote: Do i have to rewrite the whole class?
Nah, just move DLLEXPORT to place where I've shown in my earlier post. This is what I would do for exporting and importing a class.
#if defined EXPORT_FROM_DLL
#define DLLEXPORT __declspec( dllexport )
#else
#define DLLEXPORT __declspec( dllimport )
#endif
class DLLEXPORT CMyPropertyPage : public CPropertyPage
{
public:
}; Make sure that you declare EXPORT_FROM_DLL in your dll project so that the class get's exported and when you include this header file in another project your class get's auto imported since EXPORT_FROM_DLL is not defined this project.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
I am a bit confused on what I should do specifically.
This is about 1/5 of the class:
#include "..\MacAddress.h"
#include "..\NetworkConnectionInformation.h"
#include "..\DeviceLocation.h"
#if defined EXPORT_FROM_DLL
#define DLLEXPORT __declspec( dllexport )
#else
#define DLLEXPORT __declspec( dllimport )
#endif
class CJJPropertySheet;
class DLLEXPORT CJJPropertyPage5 : public CPropertyPage
{
DECLARE_DYNCREATE(CJJPropertyPage5)
public:
CString m_strURL;
void Register(void);
static UINT StartRegistration(LPVOID pParam);
UINT m_uiTimer;
CString GetProductSiteCode(void);
CJJPropertyPage5();
~CJJPropertyPage5();
As you can see I already added what you recommended. Now on the import side. My question is do I have to rewrite the class into one of my headers? something like:
class DLLIMPORT CJJPropertyPage5 : public CPropertyPage
{
public:
CString GetProductSiteCode(void);
CJJPropertyPage5();
~CJJPropertyPage5();
From what I understood i dont have to rewrite the members that I will not use directly.
Is that right? and also do I have to include the header file of the orginal class?
Thanks,
Jayjay
|
|
|
|
|
monsieur_jj wrote: My question is do I have to rewrite the class into one of my headers? something like:
Not at all. Reuse the header file. That's how classes are exported and imported.
monsieur_jj wrote: do I have to include the header file of the orginal class?
Exactly! You don't have to rewrite the whole class declaration here.
monsieur_jj wrote: class DLLIMPORT CJJPropertyPage5
Don't change DLLEXPORT to DLLIMPORT . Of course the naming is confusing, better rename DLLEXPORT to DLL_EXPORT_IMPORT .
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hi Guys,
I am working on a desktop search engine.
Trying to access the Microsoft Index service catalog using ADO's,I am able to connect to the Catalog and Query it.
CommandText = "select filename,vpath from scope() where FREETEXT(Contents, '" + str + "') order by rank desc ";
strContent = (char *) (_bstr_t) pRecordset->Fields->GetItem ("filename")->Value;
the above gives me the file name
but the below access to the vpath failes.
strContent = (char *) (_bstr_t) pRecordset->Fields->GetItem ("vpath")->Value;
can any one give me some suggestions on this so that i can get the vpath to a CString.
Thanks.
|
|
|
|
|
Is there a direct method of handeling items returned from SHGetSpecialFolderLocation(...). At the moment I am converting them into a path with SHGetPathFromIDList(...), to continue with CreateFile(...) etc. It seems to me an awfull lot of wasted efford by microsoft if an LPITEMIDLIST was only usefull as a halfway house to creating a path that you can actually work with.
Regards,
Bram van Kampen
|
|
|
|
|
An ITEMIDLIST is interpreted by a shell namespace as it see fit. For most of the shell this maps to file paths but this need no be the case: for example the "Control Panel" folder doesn't map to a folder called "Control Panel". ITEMIDLIST 's are an abstraction of the concept of a file system path which is a superset of the filesystem.
Steve
|
|
|
|
|
So, as such, ITEMIDLIST is only a Shell Item, maybe where the inards of the shell exposes itself. So there is no incantation of a function like: 'SHOpenFileFromPIDL(ITEMIDILIST*pidl, DWORD ShareAndOpenFlags)'.
Why in that case does SHGetSpecialFolderLocation not return a String!
Regards,
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: Why in that case does SHGetSpecialFolderLocation not return a String!
Do you mean like SHGetSpecialFolderPath() does?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Yes, I did not know such function (SHGetSpecialFolderPath) existed. Not in my documentation. Is there anything Usefull one can do with an ITEMIDLIST, other than extract a Path from it.
Regards,
Bram van Kampen
|
|
|
|
|
I've been two days at this problem and can't figure it out - I'd really appreciate your advice and time to help me
The problem is this:
My application draws a road and shows vehicles moving on it. When scrolled right and I zoom in, the scrollbars move to the left, back towards the origin. Conversly, when I zoom out they scroll to the right. As you can see from the code below I have tried adjusting for the viewport origin, but still no luck.
Some more information:
My logical coords have their origin at the start and centre of the road. I therefore set my viewport origin at (left border, Rect.Height()/2). To scale I use a scale factor times my draw area. I am not using CZoomView[^] because I need the above special considerations.
Here is the code I have:
void CTrafficView::OnPrepareDC(CDC *pDC, CPrintInfo *pInfo)
{
CScrollView::OnPrepareDC(pDC, pInfo);
pDC->SetMapMode(MM_ANISOTROPIC);
pDC->SetWindowExt(m_DrawArea);
int xExtent = m_Scale * m_DrawArea.cx;
int yExtent = m_Scale * m_DrawArea.cy;
pDC->SetViewportExt(xExtent, yExtent);
GetClientRect(&m_ClientRect);
CPoint viewOrg;
viewOrg.y = m_ClientRect.Height()/2;
viewOrg.x = m_Border_Lhs*m_Scale;
viewOrg -= GetDeviceScrollPosition();
pDC->SetViewportOrg(viewOrg);
}
void CTrafficView::ResetScrollBars()
{
CClientDC aDC(this);
OnPrepareDC(&aDC);
CSize temp = m_DrawArea;
aDC.LPtoDP(&temp);
SetScrollSizes(MM_TEXT, temp);
}
void CTrafficView::OnToolsZoomin()
{
CPoint pt;
GetClientRect(&m_ClientRect);
pt.x = (m_ClientRect.Width() / 2);
pt.y = (m_ClientRect.Height() / 2);
CClientDC aDC(this);
OnPrepareDC(&aDC);
CPoint vp = aDC.GetViewportOrg();
pt = pt - vp;
CScrollView::ScrollToPosition(pt);
m_Scale += 0.2;
ResetScrollBars();
Invalidate();
}
Thanks so much for any help you can give - I have to present my program at a meeting with the client tomorrow
modified on Thursday, August 7, 2008 7:26 AM
|
|
|
|
|
i have a main dialog with some controls,
i also have a second dialog(modeless) and i want to make it into child.
when selected style "popup" in the child dlg properties
the "child" dlg acts normal, but its not what i want, because i only want the child dlg to appear inside the main dlg, not anywhere else on the screen.
opening the child dlg, when selected style "child" in the dlg properties,
the main dlg gets painted onto the child dlg making it a transparent mess.
how can i get the "child" dlg to be painted correctly?
this is the code that opens the modeless "child" dlg:
void CMyApp::OpenChDlg()
{
CChildDlg *dlg;
dlg = new CChildDlg;
dlg->Create(IDD_CHILDDLG);
dlg->ShowWindow(true);
}
thx
|
|
|
|
|
To be a child, doesn't the child need a parent?
What about passing a valid parent to Create()?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thanx,
but how do i find the name of the parent?
ive tried some of my class names and so on..
i tried to find it in CWnd *pParent and the main dlg class, but i cant get a hold of it,
..errors..
even tried this:
made a global var at the start of maindlg:
CWnd* pParentWnd = CWnd::GetActiveWindow();
stored in pParentWnd
CChildDlg *dlg;
dlg = new CChildDlg;
dlg->Create(IDD_CHILDDLG, pParentWnd);
dlg->ShowWindow(true);
// works fine until move the mouse, then messed up and its overpainted by the maindlg..
theres something im missing..
thx
modified on Wednesday, August 6, 2008 4:22 PM
|
|
|
|