|
Thank you for your help it works ... even the LPNMHEADER phdr = reinterpret_cast(pNMHDR); compile error I changed to this: HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
Thank you for help, I am really appreciate it!
|
|
|
|
|
Hi! I'm working on a application that uses MSAccess database, i run SQL commands like :
kl.Format("%s%s%s","SELECT Maquina.nicname FROM Maquina WHERE Maquina.maquinaid='", machineid,"'");
pRst->Open((_bstr_t)kl, strConn, adOpenStatic, adLockReadOnly, adCmdText);
Therefor, to use this commands i need this two variables :
_RecordsetPtr pRst("ADODB.Recordset");
_bstr_t strConn("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=proteres.mdb");
I've been defining them locally in all my functions, but now i was trying to make them global for the all application, or even the same class, but i get always the same compile errors for the declaration:
error C2059: syntax error : 'string'
error C2059: syntax error : 'string'
I tried to declare them like:
class CMachine_financial_information : public CDialog
{
// Construction
public:
CMachine_financial_information(CWnd* pParent = NULL, CString maquina=""); // standard constructor
// Dialog Data
//{{AFX_DATA(CMachine_financial_information)
enum { IDD = IDDU_MACHINE_FINANCIAL_INFORMATION };
CListCtrl m_lstcFinanceiro;
CString m_static_tempo;
CString m_static_collected_money;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMachine_financial_information)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
public:
LVITEM lvi;
SortInfo m_SortInfo;
CCtrlSort m_CtrlSort;
----> _RecordsetPtr pRst("ADODB.Recordset"); <------
----> _bstr_t strConn("DRIVER={Microsoft Access Driver <------(*.mdb)};DBQ=proteres.mdb");
// Implementation
protected:
//{{AFX_MSG(CMachine_financial_information)
virtual BOOL OnInitDialog();
afx_msg void OnSelchangecomboperiod();
virtual void OnCancel();
afx_msg void Oncancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
void dinheirocofre(CString, int);
void enchelistctrl(CString);
CString machine;
};
Can anyone help me with this problem?
Thank you in advance
|
|
|
|
|
I don't think you can initialize the _bstr_t in the header at least not with that syntax
----> _RecordsetPtr pRst("ADODB.Recordset"); <------
----> _bstr_t strConn("DRIVER={Microsoft Access Driver <------(*.mdb)};DBQ=proteres.mdb");
|
|
|
|
|
Thanks, do you think i should cast them into another data tye, which should be the best option?
Thank you
|
|
|
|
|
How can I get the name of the program that have created a window given its HWND
|
|
|
|
|
Check out http://www.mooremvp.freeserve.co.uk/Win32/framed_tip038.htm
|
|
|
|
|
Thanks you.
It seems more difficult than I thought!!!
|
|
|
|
|
Yea it is. Getting the PID is not the problem, as you can see. Getting the process name from the PID is difficult.
But there is an easier solution if PSAPI.DLL is installed. By default it is there on W2K and XP, redistributable for NT is available. No support for 95/98/Me. Here is how I use it:
In my constructor I have something like
HINSTANCE hInst;
m_pfGetModuleBaseName = NULL;
m_pfEnumProcessModules = NULL;
hInst = LoadLibrary (_T("psapi.dll"));
if (hInst != NULL)
{
m_pfGetModuleBaseName = (GETMODULEBASENAME) GetProcAddress (hInst, _T("GetModuleBaseNameA"));
m_pfEnumProcessModules = (ENUMPROCESSMODULES)GetProcAddress (hInst, _T("EnumProcessModules"));
FreeLibrary (hInst);
}
}
Then I use it as follows
HANDLE hProc;
HMODULE ahMod[10];
DWORD dwNeeded;
BOOL bStatus = FALSE;
char szProcessName[80];
rStrProcessName = "";
if (m_pfEnumProcessModules == NULL || m_pfGetModuleBaseName == NULL)
return (FALSE);
// Need to get a handle to the process so we can query the modules
hProc = OpenProcess (PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, FALSE, dwPID);
if (hProc)
{
// Get the first few modules. The .exe is always the first one.
if (m_pfEnumProcessModules (hProc, ahMod, sizeof(ahMod), &dwNeeded))
{
// Get the exe name. It is always the first module.
if (m_pfGetModuleBaseName (hProc, ahMod[0], szProcessName, sizeof(szProcessName)))
{
rStrProcessName = szProcessName;
bStatus = TRUE;
}
}
CloseHandle (hProc);
}
return (bStatus);
}
|
|
|
|
|
In the source code from the URL: The function RegQueryValueEx has as first parameter HKEY_PERFORMANCE_DATA but this key is only available for NT/2k/XP. How can I make this function works with 98/NT/2000/XP?
|
|
|
|
|
Ah the joys of enumerating process under the different versions of Windows. For 95/98 the best method is to use the ToolHelp API. See the example on MSDN under Process32First().
What we have done here is wrap all of the messy platform specific details into a class.
D
|
|
|
|
|
I've already seen it but it's written that it is running on Windows CE!!
When I try to compile the code from the URL the compiler doesn't know the structure PPERF_DATA_BLOCK, PPERF_OBJECT_TYPE, PPERF_INSTANCE_DEFINITION, PPERF_COUNTER_BLOCK and PPERF_COUNTER_DEFINITION. And I don't find it in the MSDN.
|
|
|
|
|
I'm not sure I understand your first sentence. Be careful with MSDN, there are usually two definitions when you search for something. One is for CE and one is for standard Win32. The ToolHelp API functions work under CE and 98 so you might have been looking at the CE example.
The PPERF_* structures are defined in WinPerf.h. The "PP" mean pointer to structure so if you take the first "P" off, you can see them in MSDN (look for PERF_DATA_BLOCK instead of PPERF_DATA_BLOCK).
|
|
|
|
|
I have been looking for "toolhelp" and there was only "toolhelp module" in the MSDN...
Now, it's working.
Thank you.
|
|
|
|
|
I found an "easier" way using windows hook that works both on 98 and on NT.
I create a dll to hook messages from the window and in the dll function that get the messages, i can call GetModuleFileName as the dll is maped to the process adress space .
|
|
|
|
|
Hello.
Actually I am using SQLConfigDataSource() to create a DSN User or System but now I need to create a ODBC DSN File.
I need this to connect a report made by Crystal Reports to SQL server at run time because de Server name change.
Which is the function to create a DSN File in the default common ODBC directory?.
Thanks in advance.
|
|
|
|
|
What is the way I can debug reference counting ? Can I print out a list of all AddRef() and Release() calls ?
|
|
|
|
|
#define _ATL_DEBUG_INTERFACES in your stdafx.h and rebuild. this will show you every AddRef and Release.
-c
Conservative:
One who admires radicals centuries after they're dead.
-- Leo C. Rosten
|
|
|
|
|
It seems that if compile a DLL under VS.NET, I'm no longer able to use it from an executable compiled under VS 6.0 (even if re-compiled) .
Does anybody know about the MFC 6.0 / MFC 7.0 compatibility issues ?
Exe using MFC 6.0 with a DLL using MFC 7.0 ?
Exe using MFC 7.0 with a DLL using MFC 6.0 ?
All are compiled with dynamically linked MFC libraries.
Thank you for your answers !
|
|
|
|
|
It stands to reason that if your app is compiled to use MFC 4.x and your DLLs are using MFC 7,0. you'll have problems.
Link statically.
|
|
|
|
|
i have defined a global handle to MUTEX and creating it in one funtion and releasing in the other funtion, but it won't allow me to do so. what to do for it. i need to own it. how it is possible
|
|
|
|
|
Before release it,you should unlock it first
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
You can't have one thread aquire the mutex and another release. If you are trying to do this in the same thread, then you have other problems.
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|
|
Hello friends,
for what are the 4 digits (x.x.x.x) mostly used? I mean for what should i use the four digits?
Sorry for this silly questions, but i really want to know that.
Thank you for your help!
Fiffi
|
|
|
|
|
Version numbers:
Major.Minor.Patch.Build is what we use it for.
1.2.1.53
Version 1.2A build 53.
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|
|
Hello Tim,
Thank you very much for your Help!
Fiffi
|
|
|
|