|
Hello,
I hav a situation where i need to detect any changes in a specified directory. Changes here include new files comming in and updated files.
I have managed to use FindFirstChangeNotification functions to detect any changes in the directory. However the problem comes when i want to know which file is the affected ones.
Any ideas or hint would be great. Thanks
hwkean
|
|
|
|
|
If you are running on NT, use ReadDirectoryChangesW() instead.
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
Thanks,
I have test run on ReadDirectoryChangesW() but I can't get it running. It keeps giving me a link error and that my ReadDirectoryChangesW() was not defined. I have included all the necessary header files but to no avail.
Please help
|
|
|
|
|
This is covered in the VC forum FAQ here
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
I would like to be able to perfrom a ping fom my VC code without using ICMP.DLL
Anyone have any ideas?
Cheers
Rich
|
|
|
|
|
|
Help me please
I need one MFC Extension dll in my workspace using MFC as shared dll (it also will be used as shared dll) and one static-link library just to compile functions from it into my other projects(with same MFC classes). But I constantly getting errors because of these AFX_EXT... , pragma comments and so on, sometimes redifinition error of class functions. Can anyone tell me the right way to do that, please ...
|
|
|
|
|
If you want to create both extension DLL and static lib from the same sources, you need to replace AFX_EXT_CLASS macro with your own. So this...
class AFX_EXT_CLASS CYourClass : public CSomething
{
};
... becomes this:
class YOUR_SPECIAL_MACRO CYourClass : public CSomething
{
};
Definition of YOUR_SPECIAL_MACRO depends on what's the target. If it's an extension DLL it evaluates to AFX_EXT_CLASS, if it's a static lib it should evaluate to nothing.
#ifdef YOURLIB_IS_STATIC
#define YOUR_SPECIAL_MACRO
#else
#define YOUR_SPECIAL_MACRO AFX_EXT_CLASS
#endif
You should add YOURLIB_IS_STATIC symbol to C++ Preprocessor defines (in Project Settings dialog) when you're compiling or using (linking to) a static lib. Ensure that YOURLIB_IS_STATIC is not defined if you're compiling/using extension DLL.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
How do I add a minimize button to a window that has the toolbar style flag set? It only shows the close button.
|
|
|
|
|
I was just wondering how to code the below...
A minimize button, not the default one on the top right, but just a simple button that can minize a window once clicked.
A button to access an outside readme text file.
Please help...
|
|
|
|
|
1) You just need to a create a normal command button to do this. In the command handler, you just need to call:
ShowWindow(SW_MINIMIZE);
2) To access an outside readme file, I assume you mean you want to use the user's default viewer to view an external file. If so, the easiest way is to use ShellExecute with the "open" verb, which will look up the user's selected text file viewer for you. I usually try to open the file in Notepad if it fails:
int viRes = (int)ShellExecute(GetSafeHwnd(), "open", "my_file_to_read.txt", NULL, "C:\\Temp", SW_SHOW );
if (viRes == SE_ERR_NOASSOC)
{
STARTUPINFO vtStartupInfo;
PROCESS_INFORMATION vtProcessInfo;
CString vcstrCommand;
CString vcstrParams;
DWORD vdwLen;
vdwLen = GetWindowsDirectory(vcstrCommand.GetBuffer(_MAX_PATH), _MAX_PATH);
vcstrCommand.ReleaseBuffer(vdwLen);
vcstrCommand += "\\Notepad.exe";
vcstrParams = vcstrCommand + " ";
vcstrParams += m_cstrLogFilename;
memset(&vtStartupInfo, 0, sizeof(vtStartupInfo));
vtStartupInfo.cb = sizeof(vtStartupInfo);
if (!CreateProcess(vcstrCommand, vcstrParams.GetBuffer(vcstrParams.GetLength()), NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &vtStartupInfo, &vtProcessInfo))
{
vcstrParams.ReleaseBuffer();
CString vcstrMsg;
vcstrMsg.Format("The logfile \"%s\" could not be opened using Notepad.", (LPCTSTR)m_cstrLogFilename);
AfxMessageBox(vcstrMsg);
}
else
vcstrParams.ReleaseBuffer();
}
else if (viRes < 32)
{
CString vcstrMsg;
vcstrMsg.Format("The logfile \"%s\" could not be opened using your default viewer.", (LPCTSTR)m_cstrLogFilename);
AfxMessageBox(vcstrMsg);
}
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Thank you so much for your help, I can't believe how simple it were. Again, thanks, I appreciate it.
|
|
|
|
|
Hi all,
I just create one program using timer and it connect to database to process something. I try to leave my program running one day, but what I get next morning is it prompt out a dialog box say "Cannot generate SSPI context".
I don't know what it is. + +
Can anybody help me to resolve on this??
I really appriate it. Thank you.
FM
|
|
|
|
|
I just create one program using timer and it connect to database to process something.
This means that you open database, write something, and close database every XXX seconds?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Yes. But it will continue to loop after it finishing the task (open, write and close). This is done by using KillTimer and SetTimer back.
Thanks in advance.
p/s: My supervisor said it is because my program keep generating a user in the database until it exceeds the limit and gives me that dialog box saying "cannot generate SSPI context". Could this be the problem?? But I already check my code and I close every database that I open.
+ =
FM
|
|
|
|
|
My supervisor said it is because my program keep generating a user in the database until it exceeds the limit and gives me that dialog box saying "cannot generate SSPI context". Could this be the problem??
Exactly, it looks like resource leak. SSPI == Security Support Provider Interface; it's used to "establish authenticated connections and to exchange data securely over those connections".
To avoid problems with long period of time before error occurs, replace the timer and use database in a tight loop: you should see the problem much earlier.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
How to replace the timer, and with what?? And can I know what do you mean by using database in a tight loop??
This application cannot be stopped or closed, unless there is a network connection error.
Could be the network error??
Thank you so much for your help.
FM
|
|
|
|
|
To diagnose and fix the error you need to make it easier to reproduce - waiting many hours for SSPI context error is a waste of time, right? Two solutions are possible:
1) easier: set the timer elapse period to 10 msec.
2) create an infinite loop that repeatedly calls database code. This will be marginally 'faster', but application will not respond to menu selections, etc.
I'm not sure if automatic error detection tools like BoundsChecker can detect problems with SSPI. If you have such a tool, give it a try.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Dear Sir,
I have a question about how to kill a process:
We know, when a child process is created in the parent process, the child
process can be killed with the TerminateProcess(hHandleProcess, 1),But if
others child processes are created by the child process, how can I
kill them all.
For Example (from Tornado IDE):
When we use GNU tools to compile and link the source files, we usually use
the make.exe to interpret the makefile document, so the make.exe can be a
child process of a application(may be an IDE). But we know make.exe
will create may sub-processes(gcc.exe, ld.exe, make.exe, ect.), so how can I
kill the child process(make.exe) and all it's sub-processes in the application
(IDE).
I hope your help!!
dong geming
|
|
|
|
|
You could use job objects, but they are available only on Windows 2000. The other option is to enumerate all processes in the system, retrieve parent-child information and kill apropriate ones. Note that there's no universal method for this - you'll have to use different APIs on Win9x and NT.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I'm using a CListCtrl in report mode and I want to use it with some multiline text (i.e. it has carriage lines in it). The problem is that the edit control the list view uses are single line elements and do not understand carriage returns or line feeds so i get a bunch of wonderful bars in the text. Anyone have an good solutions to the problem?
Okay I got the owner draw thing to work and I know have carriage returns. The problem is I can't see the text as the row height does not change. Anyone have any ideas on how to change the row height?
-Mathew
|
|
|
|
|
You'll have to use owner-draw. Search for LVS_OWNERDRAWFIXED in VC++ help, there's also sample in KB article Q131788.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I have the owner draw part working, but I don't see how to get it to recognize carriage returns and line feeds. Any ideas?
Mathew
|
|
|
|
|
|
i'm taking a corispndence course and i'm on my second excersize. useing appwizard, i need to make a grid useing the fgrid control, np but i need to code a command button to clear all fields in the grid. is there some kind of short method for clearing them without havin to code each field? like a clear all fields kinda code?
|
|
|
|