|
Hi all.
Can we create DSN Name and set a datadase path through Install shield 2010.
i.e I dont want to create DSN name going through Control Panel->ODBC
and then select .mdb file and create DSN Name and selecta database path
Any ideas will be helpful
I dont know,is this the right forum for this question.
Thanks
Raj
|
|
|
|
|
How is this a C/C++/MFC question?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi, I am getting below compiler error on Visual Studio 2005:
isodirbrowserlistctrl.cpp(46) : error C2906: 'const AFX_MSGMAP *CListDataCtrl<B,T>::GetThisMessageMap(void)' : explicit specialization requires 'template <>' with [B=CListCtrl,T=CBrowserListCtrlData
Here is the code with .h and .cpp files. This code used to compile and run fine on Visual Studio 6.0. I guess I need to use BEGIN_TEMPLATE_MESSAGE_MAP. But BEGIN_TEMPLATE_MESSAGE_MAP can not handle more than one template arguments. In my case, there are 2 template arguments.
class CListDataBase
{
public:
CListDataBase() : m_iItem(-1), m_pCtl(0) {};
void SetControl(CListCtrl* pCtl) { m_pCtl = pCtl; }
CListCtrl* GetControl() { return m_pCtl; }
void SetItemNumber(int iItem) { m_iItem = iItem; }
int GetItemNumber() { return m_iItem; }
protected:
int m_iItem;
CListCtrl *m_pCtl;
};
template <class B, class T>
class CListDataCtrl : public B
{
public:
CListDataCtrl() {};
public:
public:
T* GetListData(int iItem)
{
T *pResult = (T*) GetItemData(iItem);
return pResult;
}
void DeleteListDataPrim(int iItem)
{
T* pData = (T*) GetItemData(iItem);
delete pData; pData = 0;
SetItemData(iItem, 0);
}
void DeleteListData(int iItem)
{
DeleteListDataPrim(iItem);
}
BOOL DeleteListNode(int iItem)
{
DeleteListData(iItem);
return DeleteItem(iItem);
}
void SetListData(int iItem, T* pData)
{
pData->SetItemNumber(iItem);
pData->SetControl(this);
DeleteListData(iItem);
SetItemData(iItem, (DWORD) pData);
}
void DeleteAllListData()
{
int cMax = GetItemCount();
for (int i=0; i<cMax; i++)
{
delete (T*) GetItemData(i);
SetItemData(i, 0);
}
}
void DeleteEntireList()
{
DeleteAllListData();
DeleteAllItems();
}
T* InsertItemData(LPCTSTR ptszText, int iItem, T* pData = 0)
{
if (!pData)
{
pData = new T;
}
int iNewItem = InsertItem(iItem, ptszText);
SetListData(iNewItem, pData);
return pData;
}
public:
virtual ~CListDataCtrl() {};
protected:
DECLARE_MESSAGE_MAP()
#endif // !defined(AFX_LISTDATACTRL_H__D2FAE7C7_4E4E_11D2_BA1B_00A02489AC7A__INCLUDED_)
#include "ListDataCtrl.h"
#include "DirectoryInfo.h"
#include "DirDn.h"
class CBrowserListCtrlData : CListDataBase
{
public:
CDirDn m_rdnEntry;
CDirectoryInfo* m_pDirInfo;
HTREEITEM hTreeParent;
CString m_csFullDn;
};
typedef CListDataCtrl<CListCtrl,CBrowserListCtrlData> CIsoDirBrowserListCtrlBase;
class CIsoDirBrowserListCtrl : public CIsoDirBrowserListCtrlBase
{
public:
CIsoDirBrowserListCtrl();
public:
public:
public:
virtual ~CIsoDirBrowserListCtrl();
protected:
DECLARE_MESSAGE_MAP()
};
<pre lang="x-cpp">
#include "stdafx.h"
#include "isodirbrowser.h"
#include "IsoDirBrowserListCtrl.h"
CIsoDirBrowserListCtrl::CIsoDirBrowserListCtrl()
{
}
CIsoDirBrowserListCtrl::~CIsoDirBrowserListCtrl()
{
}
BEGIN_MESSAGE_MAP(CIsoDirBrowserListCtrlBase, CListCtrl)
END_MESSAGE_MAP()
BEGIN_MESSAGE_MAP(CIsoDirBrowserListCtrl, CIsoDirBrowserListCtrlBase)
END_MESSAGE_MAP()
Here is the code with .h and .cpp files. This code used to compile and run fine on Visual Studio 6.0. I guess I need to use BEGIN_TEMPLATE_MESSAGE_MAP.But I can't use BEGIN_TEMPLATE_MESSAGE_MAP because it works only when there is single template argument. In my case, I have 2 template arguments.
#define BEGIN_TEMPLATE_MESSAGE_MAP(theClass, type_name, baseClass) \
PTM_WARNING_DISABLE \
template < typename type_name > \
const AFX_MSGMAP* theClass< type_name >::GetMessageMap() const \
{ return GetThisMessageMap(); } \
template < typename type_name > \
const AFX_MSGMAP* PASCAL theClass< type_name >::GetThisMessageMap() \
{ \
typedef theClass< type_name > ThisClass; \
typedef baseClass TheBaseClass; \
static const AFX_MSGMAP_ENTRY _messageEntries[] = \
{
Can above BEGIN_TEMPLATE_MESSAGE_MAP be changed to cater for 2 template arguments. I mean can I have BEGIN_TEMPLATE_MESSAGE_MAP_2 for 2 template arguments? Can someone tell me what will have to be written in BEGIN_TEMPLATE_MESSAGE_MAP_2 macro to handle 2 template arguments for VS2005?
PLEASE NOTE that I need to have BEGIN_TEMPLATE_MESSAGE_MAP_2 for Visual Studio 2005. Please help.
|
|
|
|
|
See if this[^] can help.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
I looked at it. But it has Customized BEGIN_TEMPLATE_MESSAGE_MAP only for VC7. It doesn't have mention of Customized BEGIN_TEMPLATE_MESSAGE_MAP for VS2005/VC8.
|
|
|
|
|
Well, other than "extracting" the macros yourself and adding the template parameters where needed i have no better idea yet if those don't work for VS2005/8 as you said...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Is there a standard vectorized way to copy a list of doubles to a list of int8 values? I would like to code the following:
typedef __uint8 unsigned __int8;
double *const srcList = new double [ARRAY_SIZE];
__uint8 *const dstList = new __uint8[ARRAY_SIZE];
for (size_t i = 0; i < ARRAY_SIZE; ++i)
dstList[i] = static_cast<__uint8>(max<double>(0, min<double>(255, srcList[i]))); I would like to code this more like the following:
__uint8 ToUint8(double const inVal) {
return static_cast<__uint8>(max<double>(0, min<double>(255, srcList[i])));
}
std::???(srcList, srcList + ARRAY_SIZE, dstList, &ToUint8); Is there some existing function that will make the above work, or do I need to just make the iterator myself? Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
you or the build in functions have to parse the entire list.
try stl's
for_each
|
|
|
|
|
std::transform(src.begin(), src.end(),
dst.begin(),
[] (double v)->(__uint8) {
return (__uint8)v;
});
... if you're on vc++10, define trivial std::unary_function converter otherwise. You could also try one of the selectors or projectors from <algorithm> , with the other overload of transform then.
Cheers,
Paul
|
|
|
|
|
I've got a DLL hook in place, it's all working fine, the hook is for a game, and it works in windowed mode, but not in fullscreen mode.
I'm using FindWindow to look for the window title, but I'm thinking it changes during fullscreen.
What I really need is the hooked .exe's ProcessId, for use with OpenProcess, so I can get the handle to use with WriteProcessMemory, etc,.
Can someone help me out here.
|
|
|
|
|
If the DLL is injected into the EXE you can use GetCurrentProcess to get the handle of the EXE.
|
|
|
|
|
Thank you, that did the trick.
(I feel dumb for not trying that earlier, I was thinking it would probably return the dll, since that's where I called it from, but upon further thought, I realize that the dll is actually part of the process once injected.)
|
|
|
|
|
Which is better writing my own custom Linked List class or using STL?
Which is better not just from the point of speed, but also memory usage?
|
|
|
|
|
I don't know the answer, however I'm rather pragmatic on such issues: what makes you think your implementation would be better in some way (speed, memory, whatever)?
|
|
|
|
|
|
That does not even start to look like the answer to my question.
If you think you can design and build a better linked list, and can afford to spend the time to do it right, then do it, debug it, test it, document it, and compare it to existing implementations.
|
|
|
|
|
I have done this where each node is an element but the forward and back 'pointers' are offsets from the base address to a block of memory, rather than individual 'nodes' allocated from the current process heap. If you put this into a custom Win32 Heap, then the entire list deletes almost instantly! I am not sure that is the case even if you feed the STL a custom allocator - it still asks for a node one at a time? Anyways, that was done years before STL existed.
|
|
|
|
|
I agree there can be circumstances where a specialized implementation (or even an entirely different data structure, e.g. some kind of tree) is (much) better; however the OP did not give any hint in that sense.
|
|
|
|
|
Fareed Rizkalla wrote: Which is better writing my own custom Linked List class or using STL?
unless proven otherwise : STL.
Fareed Rizkalla wrote: Which is better not just from the point of speed, but also memory usage?
unless proven otherwise : STL, and if you really need to tweak something you can try to create and use your own allocator; but the time and effort needed for that is not that worthwhile.
BUT
if you have a very peculiar application that needs very customized linked list and does not care about portability, accessibility, expendability, write your own.
Also, if you ever want to do some performance analysis of STL, remember to do it in RELEASE mode, the debug mode is considerably slower than release mode.
Watched code never compiles.
|
|
|
|
|
Custom lists are typically deployed when object need themselves to form a chain (objects that knows about their containment and know who is before and after. For this STL has no solution)
Where no such need exist, a double linked list -however you implement it- can do nothing more that what std::list do. The algorithms to manage links are the same from about a century, and are nothing more that a swap between four pointers.
The only advantage happens when you can code and test them faster then learning how STL methods and concept are defined.
About portability ... Sorry but must disagree with many previous posts.
Simply, I cannot understand how a self contained code that does nothing more pointer assignment, new and delete, cannot be portable. It can be buggy, but not unportable. Who speaks about "portability" is just doing "marketing lies" (and simply repeating acritically what read on STL books: The prove is that is using the exact same phrase -including adverbs and commas- everybody else sustaining the same thesis is using, so it's not his own original thought).
The problem arise when your code need to interact with some other code doing his own implementation... and the two implementations conflict in prerequisite. But if normal good design rules are observed, I don't see that problem.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
Looking for c++ winsock example code that will enable the following: Allow for multiple clients each on a different machine ie different ip address to connect in. I would like to listen on the same port for all clients and also once connectivity is established be able to send and receive using this same port for each and all the connections.
Currently, with the code I have written connections seem to get established and I initially receive data from the client but when I attempt to send to client I do not get any errors but the client isn't receiving my message either. Then when viewed in Wireshark I see that the messages are associated with "ezmessagesrv". Something to do with unknown caller.
One question, the server socket I use to establish the bind and listen, once the accept returns successfully with the new client socket connection should I close the server socket (the one I use to do the listening) and reinitialize before attempting to listen for other client connections?
|
|
|
|
|
Well their are differences between implementations of the Windows version and *nix.
Here is the link
|
|
|
|
|
|
Hi,
I am porting code from VS 6.0 to VS2005. However I am seeing that OnInitDialog() function is not getting called from DoModal() in VS2005.
I already tried adding breakpoints and messagebox to see if OnInitDialog function of CPpSelectDn class is getting called. However I found that it is not getting called.
#include "isodirbrowser.h"
#include "IsoCommonCtl.h"
class CPpSelectDn : public CPropertyPage
{
DECLARE_DYNCREATE(CPpSelectDn)
public:
class CContextInfo
{
public:
SELECTDN sdn;
};
public:
CContextInfo* m_pInfo;
CPpSelectDn();
CPpSelectDn(CContextInfo *pInfo);
~CPpSelectDn();
enum { IDD = IDD_ISOCMN_SELECTDN };
CStatic m_edtBrowserPrompt;
CString m_csBrowserPrompt;
CIsoDirBrowser m_ctlBrowser;
public:
virtual BOOL OnApply();
protected:
virtual void DoDataExchange(CDataExchange* pDX);
protected:
virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()
};
------------------------------------------------------------------------------------
#include "stdafx.h"
#include "resource.h"
#include "PpSelectDn.h"
#include "IsoGenericMfc.h"
IMPLEMENT_DYNCREATE(CPpSelectDn, CPropertyPage)
CPpSelectDn::CPpSelectDn() :
CPropertyPage(CPpSelectDn::IDD)
{
}
CPpSelectDn::CPpSelectDn(CContextInfo *pInfo) :
CPropertyPage(CPpSelectDn::IDD),
m_pInfo(pInfo)
{
m_csBrowserPrompt = _T("");
}
CPpSelectDn::~CPpSelectDn()
{
}
void CPpSelectDn::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
DDX_Control(pDX, IDC_ISOCMN_SELDNPROMPT, m_edtBrowserPrompt);
DDX_Text(pDX, IDC_ISOCMN_SELDNPROMPT, m_csBrowserPrompt);
DDX_Control(pDX, IDC_ISOCMN_DIRBROWSER, m_ctlBrowser);
}
BEGIN_MESSAGE_MAP(CPpSelectDn, CPropertyPage)
END_MESSAGE_MAP()
BOOL CPpSelectDn::OnInitDialog()
{
CPropertyPage::OnInitDialog();
SetFontDynamically(this);
AfxMessageBox(L"Simple message box.");
if (m_pInfo->sdn.lpstrTabText)
{
TC_ITEM tcItem;
tcItem.mask = TCIF_TEXT;
tcItem.pszText = (LPTSTR) m_pInfo->sdn.lpstrTabText;
((CPropertySheet*)GetParent())->GetTabControl()->SetItem(0, &tcItem );
}
m_edtBrowserPrompt.SetWindowText(m_pInfo->sdn.lpstrPrompt);
m_ctlBrowser.SetIsoDirInfo(1,(long)(m_pInfo->sdn.nSSLMode));
m_ctlBrowser.SetDefaultFolderFilter(m_pInfo->sdn.lpstrFolderFilter);
m_ctlBrowser.SetSplitMode(FALSE);
m_ctlBrowser.AddDirectory(
m_pInfo->sdn.lpstrTopUrl,
m_pInfo->sdn.lpstrBindUser,
m_pInfo->sdn.lpstrBindPassword);
return TRUE;
}
BOOL CPpSelectDn::OnApply()
{
BOOL bResult = FALSE;
long lCount = m_ctlBrowser.GetSelectedCount(0);
if (lCount > 0)
{
CString csDn = m_ctlBrowser.GetSelectedUrl(0, 0);
_tcsncpy(m_pInfo->sdn.lpstrDn, csDn, m_pInfo->sdn.iMaxDn);
bResult = TRUE;
}
else
{
MessageBox(_T("You must select a directory node or cancel."));
}
if (bResult)
{
bResult = CPropertyPage::OnApply();
}
return bResult;
}
------------------------------------------------------------------------------------
#include "stdafx.h"
#include "resource.h"
#include "IsoGenUtils.h"
#include "IsoCommonCtl.h"
#include "DlgPromptName.h"
#include "PpSelectDn.h"
#include "PpEntryEditor.h"
#include "IsoGenericMfc.h"
#include "DlgFilterEditor.h"
#include "DlgEditReq.h"
ISOCOMMONCTL_DECL BOOL GetDistinguishedName(LPSELECTDN lpsdn)
{
BOOL bResult = FALSE;
if (lpsdn->cbSize == sizeof(SELECTDN))
{
CString csTitle(lpsdn->lpstrTitle);
if (csTitle.GetLength() == 0)
{
csTitle = _T("Browse Directory Folders");
}
CSetModuleHelp modHelp(g_hInstDll);
CPropertySheet sheet(csTitle);
CPpSelectDn::CContextInfo ctx;
ctx.sdn = *lpsdn;
if (!ctx.sdn.lpstrPrompt)
{
ctx.sdn.lpstrPrompt = _T("Select a folder:");
}
CPpSelectDn pageSelect(&ctx);
GenUtilLoadPropPage(g_hInstDll, &pageSelect, pageSelect.IDD);
sheet.m_psh.dwFlags |= PSH_HASHELP;
sheet.AddPage(&pageSelect);
if (sheet.DoModal() == IDOK)
{
_tcsncpy(lpsdn->lpstrDn, ctx.sdn.lpstrDn, lpsdn->iMaxDn);
bResult = TRUE;
}
}
return bResult;
}
Can anyone please help me in understanding why OnInitDialog function of CPpSelectDn class is not getting called when sheet.DoModal() is called? Am I missing something? This used to call OnInitDialog function of CPpSelectDn class correctly when sheet.DoModal() is called with Visual studio 6.0.
modified on Monday, August 30, 2010 10:24 AM
|
|
|
|
|
Please format your code properly so it is readable. Replace the <code></code> tags with the correct <pre></pre> tags. Also use the preview button to check your entry before finally posting it.
It's time for a new signature.
|
|
|
|
|