|
|
Hello everyone,
I am building a DLL file. But the related import library file .lib is not generated. I am using Visual Studio 2003. What points should I check in order to generate the import library file?
thanks in advance,
George
|
|
|
|
|
|
Very good resource, thank you Sarath!
regards,
George
|
|
|
|
|
Hi all,
To reteive the system time i used
CTime::GetCurrentTime();
When the return value is formatted I got the systm time in HOUR,MINUTES and SECONDS format..is there any function using which i can get 100th of a second also???
Thanks in advance
Rajeev
|
|
|
|
|
you can call GetAsSystemTime function of CTime to get SYSTEMTIME structure used to store the time. from that you can access milliseconds and other information supported
one more.
GetAsDBTIMESTAMP is also there you can get the fraction represents billionths of a second ranging from 0 to 999,999,999.
Note This method is only available when OLEDB.h is included.
See MSDN for more details.
-- modified at 2:14 Friday 18th August, 2006
|
|
|
|
|
Use GetSystemTime(LPSYSTEMTIME lpSystemTime) , which works with a pointer to SYSTEMTIME as argument:
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;
SkyWalker
|
|
|
|
|
Hi,
I have developed an application which creates .mdb files in a specific folder named store . This folder is created during installation. But when the program is uninstalled, since there are additional(new) files in the folder store , the folder does not get deleted from the computer.
I thought, maybe I should create a small .exe program that deletes all the .mdb files from the store folder before the uninstall is run.
The problem here is that I do not know the names of the files in the folder. Is there anyway or any function by which I can find and delete all .mdb files from the folder store ?
Thanks.
Fortitudine Vincimus!
|
|
|
|
|
Is this good?
<br />
WIN32_FIND_DATA find; <br />
SetCurrentDirectory("c:\\temp"); <br />
HANDLE handle=FindFirstFile("*.mdb",&find);<br />
while(FindNextFile(handle,&find)!=0)<br />
DeleteFile(find.cFileName);<br />
FindClose(handle);<br />
or you can use from
|
|
|
|
|
Because you do findfirst() and findnext() before you do DeleteFile(), I think this will leave one mdb file behind.
|
|
|
|
|
No problem we can use from a Do while and yes its right.
<br />
WIN32_FIND_DATA find; <br />
SetCurrentDirectory("c:\\temp"); <br />
HANDLE handle=FindFirstFile("*.mdb",&find);<br />
do<br />
DeleteFile(find.cFileName);
while(FindNextFile(handle,&find)!=0);<br />
FindClose(handle);<br />
|
|
|
|
|
This is the program that I tried.
#include "afxdisp.h"
void main()
{
WIN32_FIND_DATA find;
char aExePath[_MAX_PATH];
char aDrive[_MAX_DRIVE];
char aDir[_MAX_DIR];
CString aPath;
::GetModuleFileName( AfxGetInstanceHandle(),aExePath,sizeof(aExePath));
_splitpath(aExePath,aDrive,aDir,NULL,NULL);
aPath.Format("%s%s",aDrive,aDir);
aPath = aPath + "sbh_store";
SetCurrentDirectory(aPath);
HANDLE handle=FindFirstFile("*.mdb",&find);
do
DeleteFile(find.cFileName);
while(FindNextFile(handle,&find)!=0);
FindClose(handle);
}
Here I get the error
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
When I comment out
CString aPath;<br />
::GetModuleFileName( AfxGetInstanceHandle(),aExePath,sizeof(aExePath));
I do not get the unresolved external symbol error. I guess I am missing something.
Please can you tell me what I am not doing right. Have I missed out a header?
-- modified at 5:40 Friday 18th August, 2006
Fortitudine Vincimus!
|
|
|
|
|
|
Ah! How did I miss it.
Thanks a billion!
Fortitudine Vincimus!
|
|
|
|
|
|
Yes. Changing the settings helped.
But there is something I do not understand.
I used
::GetModuleFileName( AfxGetInstanceHandle(),aExePath,sizeof(aExePath));
in my application using mfc. There I had no problem.
But in the C++ program that I wrote to delete files form a folder, AfxGetInstanceHandle() was causing assersion failure. I could'nt figure out why.
When I changed it to NULL
>::GetModuleFileName( NULL,aExePath,sizeof(aExePath));
it worked fine.
Why?
Fortitudine Vincimus!
|
|
|
|
|
|
is it safe(shell API have some dependency on the version?) to use shell API, if we there are some other win32 APi to do the same task?
is it faster than Win32 APIs?
|
|
|
|
|
According to my experience, it's risky to do changes in a directory structure while doing a FindFirst/Findnext loop. I have had problems doing that (such as deleting the found files) in the past.
IMO, ShFileOperation is safer, and I would use it.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
I tried using SHFileOperation. But the program is crashing.
This is what I did:
SHFILEOPSTRUCT del;
del.hwnd = NULL;
del.wFunc = FO_DELETE;
del.pFrom = "C:\\temp\\*.mdb";
del.fFlags = FOF_FILESONLY;
SHFileOperation(&del);
Something is wrong here. I tried searching the net, but I am not able to figure it out. Please can you help me.
Thanks.
Fortitudine Vincimus!
|
|
|
|
|
you need to set del.pTo ,too.
i.e.
set it to NULL if you are not using it.
code will be,
SHFILEOPSTRUCT del;
del.hwnd = NULL;
del.wFunc = FO_DELETE;
del.pFrom = "C:\\temp\\*.mdb";
del.fFlags = FOF_FILESONLY;
del.pTo = NULL;
SHFileOperation(&del);
Oh ! you got it right already.
-- modified at 5:59 Friday 18th August, 2006
|
|
|
|
|
OH! I got it!!
The pTo member of the
SHFILEOPSTRUCT<br /> structure shoud be assigned NULL!
Thanks.
Fortitudine Vincimus!
|
|
|
|
|
hi,
i don't want to give you an answer, instead i would like to ask about how you can make your app create an mdb file. because this is what i trying to do right now. if you don't mind, would you share me you little secret?
thanks in advance.
cheers
-- modified at 10:25 Friday 18th August, 2006
|
|
|
|
|
Hello,
I use DAO to make the connection. There are some really nice samples that come in msdn. I wrote my own little class to do the stuff taking help from the samples.
Here is the database creation part. My database needed to be locked with a password.
void CDBcreate::CreateDatabase(CString m_strDBName)
{
int dwOptions =0;
dwOptions |=dbVersion30;
if (m_pTableDef)
{
m_pTableDef->Close();
delete m_pTableDef;
m_pTableDef = NULL;
}
if (m_pDatabase)
{
m_pDatabase->Close();
delete m_pDatabase;
m_pDatabase=NULL;
}
m_pDatabase = new CDaoDatabase;
m_pDatabase->Create(m_strDBName, dbLangGeneral,dwOptions);
CString strConnect( _T( ";pwd=" ) );
COleVariant NewPassword( "password", VT_BSTRT ),OldPassword( "", VT_BSTRT );
DAO_CHECK( m_pDatabase->m_pDAODatabase->NewPassword( V_BSTR( &OldPassword ),
V_BSTR( &NewPassword ) ) );
m_bOpen=TRUE;
}
Fortitudine Vincimus!
|
|
|
|
|
Hi,
What is an array in VC++? Is it a class? Lets say I create an array of ints with int i[20] , then does it mean that objects of a hidden array class is created? What actually is an array? And is there a Dynamic array implementation in the std namespace?
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
<marquee behavior="alternate" scrollamount="5" scrolldelay="50">
|
|
|
|