|
Is there some type of message I can set up or receive so that my app can tell when a new file is added to a particular folder?
[insert witty comment here]
bdiamond
|
|
|
|
|
|
There's also FindFirstChangeNotification() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
the limitation of the system way of doing things is that it cant watch network folders (afaik) ... depending what ur doing with the files and how often u could just scan the folders every n seconds and update ur list from that
"there is no spoon" biz stuff about me
|
|
|
|
|
l a u r e n wrote:
...it cant watch network folders...
Yes, files and folders on network volumes can be monitored just fine.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
thank you. I accomplished what I was trying to do with ReadDirectoryChangesW() just fine. And it works for me on network folders as long as the drive is mapped. The only problem I'm having now is that I'm trying to let the user cancel 'watching' and start again. I put the function in a separate thread and am calling SuspendThread(),then delete(), which seems to be working, but I was just enlightened by Michael Blake through watching the task manager, this is not working correctly as it is steadily increasing the number of handles and threads being used and could eventually cause Windows to crash.
[insert witty comment here]
bdiamond
|
|
|
|
|
bdiamond wrote:
And it works for me on network folders as long as the drive is mapped.
It works with UNC as well.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I've tried using this syntax for the folder name: "\\Server1\files\" with and without ending backslash, and it just won't work for me. when I map the same folder to drive letter and use "L:\" it works just fine. Also, that was only a test. The real folder is a folder that holds zip files for bug reports for our clients that I want to alert me everytime we get a new bug sent and it parses the file and puts it in our bug database for use with our bug program (an app I wrote). If I use my "G:\" drive, I get the notification. If I use the real folder I want, ReadDirectoryChangesW() returns as soon as something is placed in the folder, but it doesn't succeed. A call to GetLastError returns "Unspecified Network Error". Usually ReadDirectoryDirectoryChangesW() hangs until it receives a notification, then continues with code in loop. Do you have any idea what the h___ is going on? Thanks in advance.
[insert witty comment here]
bdiamond
|
|
|
|
|
Check out the fwatch sample in MSDN. It comes with a .ini file where you include the names of the files you want to watch. Mine looks like:
[Directories]
\\pbssvr\ddrive\Users\David2Brian\53=
[Files]
cwb3mijs.dll=
cwb3uijs.dll= Now whenever anything happens to cwb3mijs.dll or cwb3uijs.dll, a line is printed to stdout.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I think I may have found what the problem is. The folder I'm trying to monitor is actually on a UNIX machine. Our network admin has it where it shows up in our network like it's on one of the regular windows servers, but it's not. I tried the fwatch program and put in the path (regular, and mapped as a drive letter), and it still won't work. It works on my local machine's folders and even on a folder on a different windows 2000 server, but not on the directory I'm trying to get it to work on. I guess I just wasted about 8 hours of company time
[insert witty comment here]
bdiamond
|
|
|
|
|
bdiamond wrote:
I guess I just wasted about 8 hours of company time
Nonsense. Programming is never about wasted time. Whether you found one way that does work, or a dozen ways that don't work, you've learned something nontheless. Right? Remember that Thomas Edison said that every wrong attempt discarded is often a step forward.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Of course you're right, thanks for the encouragement. I've rewritten it now using a user-configurable amount of minutes that will be used with the CFileFind class. After processing the zip file it will delete it, or move it to a backup location if they have one specified. Thanks for all your help!
[insert witty comment here]
bdiamond
|
|
|
|
|
Is there any way to capture an image from an USB WebCam?
|
|
|
|
|
yes there is.
here is what you have to do:
1) use the code you find below
2) create a BITMAPINFOHEADER
3) write the BITMAPINFOHEADER and the bitmap, that is captured below to a file.
hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
hdcCompatible = CreateCompatibleDC(hdcScreen);
hbmScreen = CreateCompatibleBitmap(hdcScreen, Videobild.right, Videobild.bottom);
if (hbmScreen == NULL)
MessageBox("Bmp konnte nicht erstellt werden");
hbmScreen = ::CreateDIBSection(dc.GetSafeHdc(), (LPBITMAPINFO) m_dibFile.m_lpBMIH,DIB_RGB_COLORS, (LPVOID*) &m_dibFile.m_lpImage, NULL, 0);
GDIObject=SelectObject(hdcCompatible, hbmScreen);
if(GDIObject==NULL)
MessageBox("Object konnte nicht selected werden");
if (!BitBlt(hdcCompatible, 0,0, Videobild.right, Videobild.bottom, hdcScreen, Videobild.left,Videobild.top, SRCCOPY))
MessageBox("Object konnte nicht geBitBltet werden");
|
|
|
|
|
There is always a way. I haven't actually looked at it for 2 years, so I can't help you directly. You'll probably want to look at DirectShow, everything that you want should be there. I believe I remember an example program in the SDK called Stillcap. Anyway good luck.
|
|
|
|
|
With a CTabCtrl added to a dialog box, it is possible to create it with style TCS_VERTICAL and TCS_RIGHT.
If I however want to use the nice and easy to use Property Sheet and Page classes, I have not yet found a method or variable to do the same setting.
I have found the method to get a handle to the sheet's TabCtrl, but how can I control the style ???
It seems as if the style can only be specified at create time.
I have found some nice code articles related to tab controls and property sheets on Code Project, but so far nothing like this.
Does anyone know ???
Regards,
/Thomas
|
|
|
|
|
There are a few classes that let you replace the tab control with a tree. This is an elegant solution especially on XP where the tab control is not drawn properly when it is not at the top. CTreePropSheet[^]and CTreePropSheetEx[^] both inherit from CPropertySheet and use CPropertyPage object for the pages so this should have minimum impact on your existing code.
Yves
|
|
|
|
|
Thanks for the tip !
The "tree" class looks nice, but in my case I'm afraid it will not work well.
The reason for that is that I'm doing a Windows CE application for a device with a small touch screen, to be clicked with the finger tips, and I'm afraid that the symbols in the tree are too small to click on.
The tabs in a property sheet are simply bigger, at least when I as in my case have only 4-5 of them.
|
|
|
|
|
Is it possible to bold a line of text that has been added to a list box control (via AddString)? I do not want to bold all lines, only one line with a given index. Thanks!!
|
|
|
|
|
|
Hello Friends,
I got a problem.
I had splitted the actual view into 4 parts. every view is been derived from different view's class.
The main problem is the one splitter window which has been derived from the FormView has got 2 edit boxes which will resizing itself based upon the size of the window. and when I click in someother view some message has to be displayed in these edit boxes. for example when I click in View1 then some message which I pass from View1 has to be displayed in the edit boxes present in the View2.
I am trying but its always giving me assertion failed and when I debug it its giving the asserting failed in the SetWindowText message. I had created 2 different variables of type CEdit.
Neelesh K J Jain.
|
|
|
|
|
Neelesh K J Jain wrote:
I am trying but its always giving me assertion failed and when I debug it its giving the asserting failed in the SetWindowText message.
Is it line 44 of afxwin2.inl ?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hello all,
I've been programming in VB for a few years and I'm trying to learn Visual C++. I'm doing pretty good figuring everything out, in part thanks to this websit, but I'm have a problem using a combobox control. I have a form I created in the resource designer of VC++ 6.0 with two comboboxes. I have entered the data for the list of each box in the properties page but when I run the app and try to display the list all I get is a blank list. Is there something I'm doing/not doing? Do I have to call some sort of load list function even though I created the box in the designer?
Thanks for any help,
JJ
|
|
|
|
|
You need to resize the control itself to be a little bit taller. For more on this, read here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I tried that before I posted my original message. That's how I got the list portion of the box to show up at all. But it's still empty instead of populated with the data I entered.
Thanks,
JJ
|
|
|
|