|
It depends on how comfortable you are with the system registry and if you are running WinNT/2000/2003/XP? I don't know if the Win98/ME directory is structured exactly the same way but a little exploring will probably get you similar information.
If you are not familiar with the system registry take a look at it using the H:\WINDOWS\system32\regedt32.exe (H:\WINNT\system32\regedt32.exe for NT) program. The H: drive is the system drive on my system so you will have to substitute your system drive, probably C:, if you have a single operating system loaded on your machine. You can also enter the "set" comand from the command line in a DOS command window and there will be an environment variable named SystemDrive that will tell you, as the name implies, what your system drive is. You can alternatively go to Control Panel=>System and look under the Advanced tab for a button labeled "Environment Variables" and use the windir system variable to construct the path to the regedit32 program.
Anyway, when you execute the regedit32 program you will be able to see what resides in your system registry. As the program name implies you can also edit the contents of your system registry but I would highly recommend against this unless you are very familiar with what the consequnces of the edit are.
Under the key "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources" you will find an entry for each ODBC data source defined on your system and it's associated data provider. You can enumerate the data sources and parse the strings for *.fdb, in your case, and you have enough information to access the data base via ODBC services.
If you want more information about the data base use the data source string name to go further down the ODBC.INI tree and look for the string named "DBQ" under the data source name. The "DBQ" string value will be the path to the data base. From there you can test for the existance of the data base and from the "FIL" string value you can determine what type of data base you will be working with.
There are examples of accessing the system registry and using ODBC services programmitacly in MSDN if you are using the Microsoft Visual C++ compiler. If you are using another compiler consult their API documentation for how to accomplish the same results.
|
|
|
|
|
Hi all, ibe been trying to find a memory leak for the last 5 hours, and then i discovered what i think is a "small bug" in CSimpleArray<> collection helper, here´s an example:
class acls
{
public:
CString m_str;
// constructor, copy constructor, etc. here
};
// in some function...
// create some objects to add...
acls mycls;
mycls.m_str="ABC";
acls another;
another.m_str="CDE";
// and create the array & add the objects
CSimpleArray<acls> arr;
arr.Add(mycls);
arr.Add(another);
arr.RemoveAt(1);
this results in a memory leak pointing to the 2nd object added to the array, the interesting part is, that if you remove the very first item instead (RemoveAt(0)) there is no leak.
Can NE1 suggest a way arround this that does not involve NOT using CSimpleArray? my project is allmost finished, and rewritting everything not to use these arrays would take me forever.
thanks!
|
|
|
|
|
Ernesto D. wrote:
mycls another;
Shouldn't this be:
acls another;
I'd be very, very surprised if there was a problem with CSimpleArray.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
yep, my mistake there. check out the new "real world" example ibe just posted. I got the same leak.
|
|
|
|
|
Ernesto D. wrote:
check out the new "real world" example ibe just posted.
And where would that be?
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Umm, just below this post man! i added it as a reply
|
|
|
|
|
heres another example, this one ibe just created as a normal Win32 console app, and included afx.h and atlbase.h to my stdafx.h.
Ibe just compiled & executed this, and got the same leak
// leak.cpp : Defines the entry point for the console application.
#include "stdafx.h"
class CClass
{
public:
CClass(){}
CClass(const CClass& rv) { m_member=rv.m_member;}
const CClass& operator=(const CClass& rv){m_member=rv.m_member; return *this;}
CString m_member;
};
int main(int argc, char* argv[])
{
CClass c1;
CClass c2;
c1.m_member="ABC";
c2.m_member="DEF";
CSimpleArray<CClass> arr;
arr.Add(c1);
arr.Add(c2);
arr.RemoveAt(1);
return 0;
}
the results (in debug window) after program exits are:
Detected memory leaks!
Dumping objects ->
strcore.cpp(118) : {44} normal block at 0x003E2498, 16 bytes long.
Data: < DEF > 01 00 00 00 03 00 00 00 03 00 00 00 44 45 46 00
Object dump complete.
as a side note, if you remove the item at position 0 of the array instead of 1, then tere is no leak. this IS a bug in CSimpleArray isnt it?
|
|
|
|
|
Test the Add() and RemoveAt() and make sure the all return TRUE. SDK docs indicate CAtlArray should be used instead of CSimpleArray. I'd also add a Destructor to CClass and check when it is being called as that is where the CString will be deleted.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Thanks, ibe found what the problem is, check out the implementation of the CSimpleArray class template included in VC6:
BOOL RemoveAt(int nIndex)
{
if(nIndex != (m_nSize - 1))
{
m_aT[nIndex].~T();
memmove((void*)&m_aT[nIndex], (void*)&m_aT[nIndex + 1], (m_nSize - (nIndex + 1)) * sizeof(T));
}
m_nSize--;
return TRUE;
}
as you can notice, if you remove the last element, the element is NOT destroyed.
ibe been told however, that this "small glitch" is fixed in .NET, i guess the rest of us "mortals" using VC6 are stuck with it.
|
|
|
|
|
Dear:
when create ISAPI filter , then add OnSendRawData notification either by the wizard or manualy , and build it then add it to IIS the filter wont load and status keep down(not loaded),,WHY?
Regards
|
|
|
|
|
Howto scroll and scaling matrix[2000][2000] with rectangles in Form View (any sample in VC6).
|
|
|
|
|
Howto scroll and scaling matrix[2000][2000] with rectangles in Form View (any sample).
|
|
|
|
|
Hi everyone,
I have a problem:
Windows allow multiple keyboard configuration language and somebody can change this with Alt+Shift (generally).
How to detect when this change happen.
Thakns in advance.
Ivan Cachicatari
www.latindevelopers.com
|
|
|
|
|
|
|
|
|
i've coded one COM class with two methods exposed. i also created 2 parameters (global ones) in the class. i am using Visual studio's ATL project. i compiled the COM class as an apartment threaded one.
i've created two instances from this class in another project, and after few tests, i got to understand that the global parameters were affected in both objects when they were changed in one of the instances.
what i need to do, is be able to create two instances in two different threads (one instance created per thread), and that global parameters will be global per instance - and not for both, so if values are changed during call to one of the instance's methods, the second one's global parameters won't be affected.
i compiled the COM class as an apartment threaded one.
Can anyone see the problem?
|
|
|
|
|
Is their a way to allow a function template to use private variables in a class. I need to have my template function modify certain private variables in a class. Can anyone point me in the right direction. I would be extremly greatful if anyone can show me or point me into the right direction.
|
|
|
|
|
maybe calling public functions in that class to modify those private atributes...
|
|
|
|
|
How can I see if there is a download in progress from my app?
If something if download from internet how can I see that and cancel the download if I want?.
I have never coded a internet app before so if someone have a code sampel or something please help me...
|
|
|
|
|
One solution is winsock. Check out MSDN.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/ntwrkprot.asp
Check out my website for software development links.
http://www.dslextreme.com/users/kuphryn/links.html
I highly recommend Network Programming for Microsoft Windows, Second Edition by Anthony Jones and Jim Ohmund.
Kuphryn
|
|
|
|
|
Well That don't help me...
I need to find some code exempel..
|
|
|
|
|
Larsson wrote:
If something if download from internet how can I see that...
See here and here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I've the following situation:
MFC Dialog based Application
\_CMainDlg
\_CMainDlg
So the CMainDlg opens another dialog of the same type:
m_DoubleCalc = new CMainDlg (NULL, IDD_CALC_DIALOG_MINI);
m_DoubleCalc->Create(IDD_CALC_DIALOG_MINI, this);
The 2 Dialogs are running at the same time, the problem is that
it seems like that the previous CMainDlg eats messages from the
other CMainDlg it has created. The wired thing is some messages
seem to work while other dont.
I'am searching now for hours, but I still have no clue.
Thank you
Mario
|
|
|
|