Thanks for the tip, I'll have a look into the scripts and see if they can do what I need. I've just discovered SCM notifications which look promising although I haven't read enough about them to know if they can do what I want yet.
__DanC__
Posts
-
Running task on shutdown -
Running task on shutdownThanks for the reply, it is a user mode application and I know I can prevent shutdown by returning false for WM_QUERYENDSESSION but that keeps the logged in session alive, what I want to do is to run the code during the logoff, effectively after the user has been logged off. For example, when you a running Windows XP on a domain and you have offline file enabled, you will see the synchronisation window appear during the logoff to sync any remaining files back to the domain controller, I'm trying to achieve something like this. The app does not have to remain a user mode app, it could quite easily become a service if that is required but preventing the logoff is not what I'm trying to achieve. Thanks.
-
Running task on shutdownHi, Apologies if this has been covered somewhere but I've not found anything related. I'm working on an idea which would require a long-running task to complete at the time the user logs off, I know it's possible to delay the logoff but I was hoping to find a way to run the task as part of the logoff, something like when Windows synchronises offline folders (not sure if that's exactly the right term as I am working from memory here). Does anyone have any ideas? Thanks
-
Include order issuesThanks for the link, very interesting but I think I'll stick with pointers for now.
-
Include order issuesThanks, that makes sense. I hadn't looked at it that simply until I saw that. What would be the "standard" way of creating member variables that reference each other, using your example:
// a.h
#include "b.h"
class B;
class A
{
// Stuff
B *b;CString s1;
};// b.h
#include "a.h"
class A;
class B
{
// Stuff
A *a;CString s2;
};That would work now I've used a forward declaration of the class and used a pointer but it seems "messy" to me to have one class as a pointer and the other not. It also seems a waste to have to implement a destructor to clean up the pointers.
-
Include order issuesHi, I'm working with a large project with lots of classes and I have a problem with including the classes. I use include guards at the top of my .h files (I've tried using #pragma once as well) to prevent including more than once. When I include the header of a class I need to use I get an error saying "undefined class", if I was using a pointer I could use a forward declaration but I'm not using a pointer, how do I get around this? Thanks.
-
Socket forcibly closedI'm using a System.Net.Sockets.Socket in a server application to handle a large number of connections which receive a large amount of data. I have in incoming buffer of around 1/2MB to be read at a time using a NetworkStream wrapped around the socket. It is my understanding that a call to NetworkStream.Read will read what is available up to the buffer size and not necessarily wait until it has enough data to fill the buffer, is this correct? The reason I ask is because I am getting connections dropped from the server side and when I dump the TCP stream I see the TCP window size drop until it hits 0 at which point the connection is dropped. The only explanation I can think of for this is that the NetworkStream.Read is waiting too long for data and the buffer is filling up meaning no more data can be received. Does this sound correct or could there be something else causing this problem?
-
Vista thumbnails problemI've tried all of those with no success so far. I'm trying to figure out how Vista decides which thumbnail to use, I think it may be some has or CRC of the file path but that doesn't explain how it picks the same one as the path must be different. This is really bugging me now!
-
Vista thumbnails problemUnfortunately not. Vista doesn't use thumbs.db and I have tried clearing its icon cache with no change.
-
Vista thumbnails problemI am running Vista home premium and I have an external drive containing a lot of image files. When I browse to the drive in Windows explorer, all the images have exactly the same thumbnail even though they are different when opened. Windows seems to pick one of the images from the folder and use that thumbnail for every image. This is quite annoying when it comes to seeing what I have on the drive as they all look the same. I have tried clearing my icon cache using the cleanup in system tools. Is there anything else I can do? Does anyone know what could cause this problem? Thanks!
-
Capturing SessionEnding without Main formI need to capture the SessionEnding event in my C# app, this worked fine by adding a handler to the SystemEvents.SessionEnding event when I had message loop on my main thread. Unfortunately that is now not the case, I no longer have a message loop and now I don't get the notification. I have tried creating a message-only window to capture the WM_ENDSESSION/WM_QUERYENDSESSION messages but these are only sent to top-level windows and not message-only windows. So I tried using SetWindowsHookEx to hook WH_CALLWNDPROC which still does not send the WM_ENDSESSION message, then I tried SetConsoleCtrlHandler which also doesn't seem to work. Does anyone have any ideas on how I can trap this message without a main form? Thanks.
-
intercepting COM method calls ..Did you get anywhere with this problem? I am attempting something similar myself. I believe you need to sink the events from DShellFolderViewEvents which I think requires a IFolderViewOC object but I do not know how to obtain one yet..
-
IFolderViewOC reference from within Windows ExplorerDoes anyone know how to get a reference to the IFolderViewOC interface from within an Explorer extension (sidebar)? I am trying to get a reference from with IObjectWithSite::SetSite(), I have tried using the IServiceProvider which fails and I now think I need to query a service to get the reference but do not know which service to query. Does anyone have any ideas?
-
Unmanaged thread in C#I'm using a DLL written in C++ which creates a processing thread which processes items added to a queue from other threads. This works well from unmanaged code but I am now trying to use the DLL in a managed application. The thread is created and runs as expected processing items passed to it from C#, the problem occurs when I try to call Application.Run(dialog) or dialog.ShowDialog(). The form is destroyed immediately so it simply flashes on the screen and disappears. This does not happen when the unmanaged thread is not running. The loop within the C++ thread is simply:
while( true )
{
WaitForSingleObject(hEvent);
while( !queue.empty() )
{
DoProcess(queue.front());
}
}And the thread is created with:
g_hThread = CreateThread(NULL, NULL, ThumbnailThreadProc, NULL, 0, &g_nThreadId);
Is there a reason for this behaviour?
-
Forms not drawing correctly in VistaI have an application with a form containing 2 textboxes and an animated GIF, this form works fine in all version of Windows that I have tried it on except Vista, for some reason the textboxes show the desktop through them and the GIF does not move. This is designed in VS 2003 using C# .NET 1.1. Has anyone seen this behaviour before or have an idea what might cause it?
-
Using the tab control in VS 2003I am trying to use the tab control in VS2003, I have added the tab to a dialog template in the dialog editor and used the TCM_INSERTIEM message to add my tabs to the tab control. My question is how do I add a child window to a specified tab? (not using MFC BTW).
-
Can a file be opened?Thanks for the link but even the referenced articles state that exception handling should not be used used in normal application flow, they should be as the name says "exceptions" whereas in my application it is perfectly possible that another process or thread may have the file open and so I need to retry until it becomes available. On a side note, when using FileStreams it also seems that the internal file handle is not closed immediately (they are used within a
using
block) as I get a lot of exceptions opening files that were previously open and are no longer open. -
Can a file be opened?That's what I thought, it just seemed slower when catching the exception and retrying.
-
Can a file be opened?I have some code which has to be able to know whether a file can be opened, if so, open it, if not, try again. In C++ I would use
CreateFile()
and test if the returned handle was valid. In C# it looks like I would have to usenew FileStream()
and wait for an exception to be thrown which seems to slow. Is there any way I can instantly tell if a file can be opened? -
Passing string array as pointerI do not have the option of a second argument to the function as it is a callback. All I can pass is the pointer as an LPARAM