|
You could also create a MTA COM component that spawns a native thread and the COM object. You could then add a method to that object to abort the native thread when you choose.
Jared Parsons
jaredp@beanseed.org
http://jaredparsons.blogspot.com/[^]
|
|
|
|
|
How about the following (similar to Jared idea above): create an out-of-proc COM server that will start the dll. When you need to stop the dll execution just kill the out-of-proc server by killing its process. It should work, IMO.
|
|
|
|
|
If it is running in it's own process as COM+, you could kill the dllhost.exe process. Very un-slick, but an option if you need it.
|
|
|
|
|
Interesting idea but how do you determine the dllhost process that needed to be killed? The system creates it so you would have no way of knowing the process id. Or is there something that I do not know?
|
|
|
|
|
You compare a before and after of the process list when you create the COM object. Again, this obviously has some reliability problems. I think there's also a way of talking to the COM+ server and shutting it down there.
|
|
|
|
|
AndrewPeters wrote: reliability problems
I wonder what would happen if the wrong process would get killed?
|
|
|
|
|
I am invoking multiple COM objects with a thread assigned to each COM object initiated.If i kill the out-of-proc server, wouldnt that stop all DLLs from executing not only the one instance i need killed?
But again i am trying trying to wrap the COM invocation in an exe application and assign the exe launch to a thread.Hence every COM instance is invoked by a thread through the exe application.When i need to abort the thread i kill the exe process assined to the thread.Do you think that will work i.e killing the exe will it stop the DLL execution?Lets say it works , is there performance issues related?How can i solve this?
|
|
|
|
|
Hi All,
Windows Explorer generally remembers the setting of each folder viewed.There is one entry in the HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\Bags for each folder.how I can know which entry corresponds to which folder, programmatically.Thanks in advance.
Rakesh
-- modified at 2:03 Saturday 31st December, 2005
|
|
|
|
|
There is no documented relationship between which bag under ShellNoRoam belongs to which folder. You actually have to go through the Shell's Namespace interface on the ShellFolder you want to get this information.
I hope you're familiar with the Win32 Shell API's. If not, Shell Basics[^].
From the MSDN Gospel:
Objects that support IShellFolder are usually created by other Shell folder objects. To retrieve a folder's IShellFolder interface, you normally start by calling SHGetDesktopFolder. This function returns a pointer to the desktop's IShellFolder interface. You can then use its methods to retrieve an IShellFolder interface for a particular namespace folder.
Note: IShellFolder methods only accept PIDLs that are relative to the folder. Some IShellFolder methods, such as IShellFolder::GetAttributesOf, only accept single-level PIDLs. In other words, the PIDL must contain only a single SHITEMID structure, plus the terminating NULL. When you enumerate the contents of a folder with IEnumIDList, you will receive PIDLs of this form. Other methods, such as IShellFolder::CompareIDs, accept multi-level PIDLs. These PIDLs can have multiple SHITEMID structures and identify objects one or more levels below the parent folder. Check the reference to be sure what type of PIDL can be accepted by a particular method.
You can make a quick check to see if what you want to do can be done using the desktop.ini file in each folder by checking out this[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave,
Thanks for your reply.Actually using the IShellFolder and IShellFolder2 interface was the first thing which i had tried.but i didn't have any success with them then i tried to get it through registry.Basically i want to know the sort order for a particular folder view if there is any.Hopefully by using IShellView or IShellFolder2 i can get some useful information.This is the code which i had tried.
IntPtr newPidl = IntPtr.Zero ;
IShellFolder ishFolder = null;
IntPtr ppvOut = IntPtr.Zero;
string path = @"C:\Documents and Settings\Administrator\Desktop\A";
if(Interop.SHGetDesktopFolder(ref ishFolder)==0)
{
// we have it:
int cParsed = 0;
int afItem = 0;
ishFolder.ParseDisplayName(
IntPtr.Zero,
IntPtr.Zero,
path,
out cParsed,
out newPidl,
out afItem);
IntPtr handle = IntPtr.Zero;
WIN32_FIND_DATA data = new WIN32_FIND_DATA();
handle = Class2.FindFirstFile(path,out data);
//here i am getting the error
ishFolder.CreateViewObject(handle,ref IID_IShellFolder2,out ppvOut);
******************************************************
but i was not able to get any folder even IShellFolder interface itself from the CreateViewObject
function.This is The error i got::
System.InvalidCastException: No such interface supported
at TestApplication.IShellFolder.CreateViewObject(IntPtr hwndOwner, Guid& riid, IntPtr& ppvOut)
How can i get IshellFolder2 or IShellView interface for any folder.what i am doing wrong here?
Also thanks for the .ini link but i don't think it is going to solve my problem.Any ideas will be greatly appreciated.Thanks in Advance.
Rakesh
|
|
|
|
|
I planed to start learning C#. Which is the best book to learn C# as beginner and also programmable.
N.Rajakumar B.E.,
Application Developer,
|
|
|
|
|
Professional C# by Wrox Publishers
Akif
|
|
|
|
|
please ,send me the C#.NET step by step programming.
signature:
chandrasekhar
|
|
|
|
|
You may wish to consider purchasing it yourself. That way the author will be compensated for the considerable time and effort put in to writing the book in the first place.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
Hi.
There are a variety of good books to learn C# besides the one just mentioned to you. Programming C# by Jesse Liberty is good, the same goes for C# Unleashed by Joe Mayo and the same goes for C# The complete reference by Herbert Schildt.
If you look them up on amazon you might be able to see their content there.
Good luck,
FJ
|
|
|
|
|
|
Hi,
My add-in will debug for a distribute program, so I need to set different break points to diff "Node"s. I insert new ones and remove old break points at runtime when node switchs, this is done successfully, but my program still stop at the old break points, and the break point's BreakPointLastHit property is null (because I remove old ones already).
what shall I do to stop my program at the new ones.
|
|
|
|
|
Hi
I have a simple WinForm I've created. With the following code:
//////////////////////////////////////////////////////////////
public void DrawXYAxes(Graphics g)
{
g.DrawLine(axisPen, xIndent, yIndent + 200, xIndent + 400, yIndent + 200);
g.DrawLine(axisPen, xIndent + 200, yIndent, xIndent + 200, yIndent + 400);
}
This will then draw X Y Axes on the form.
Let's say the screen coordinates at the drawn origin are "200, 200".
What's the most efficient way to get "200, 200" to display "0, 0"?
So now when I move the cursor around the Form it will have both positive and
negative axis coortinates?
ps--I know how to display the screen coordinates as text on the screen, I just can't seem to get the system to be correct....
Thanks very much......
|
|
|
|
|
I think that you may want to investigate Graphics.TranslateTransform() . If you translate the Graphics object by 200 left and 200 down, you'll have what you need, methinks. To see this in action, you can check out my recently published article Y(et)A(nother)TabControl in which I perform these kinds of transformations to translate the origin all over my control.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Curtis,
Thanks a lot for your help. I'm now at least able to draw a 'translated coordinate' Rect on my form inside the Paint Handler.
Now I just need to figure out how to tie this in to OnMouseMove event.
|
|
|
|
|
i want to set my own images for the scrollbar object to the up and down arrow button, for the bar, and the base.
How?
|
|
|
|
|
Best to create this control from scratch. I've tried in the past to OwnerDraw with the .NET scrollbar, but you end up recreating the entire control. You can construct one quick easily with a few buttons and a little GDI+ magic.
|
|
|
|
|
Hallo,
I'm not sure if here is the right place to post this question...
I'm using D3D 9.0c with C# and I have a little problem with Texture. Can anyone help me?
The strange things happens is the follow:
When I use PositionNormalColored and lighting=true it is all ok, all lights and shadows,
When I use PositionNormalTextured and light=true I see all black. When I set lighting=false the objects are correctly rendered, clearly without lights and shadows. Does anyon know why I'm having this problem? Maybe I'm doing something wrong?
Thank you very much...
_Comet_Keeper_ (from Italy)
|
|
|
|
|
Have you applied an actual texture? PositionNormalTextured won't have colored vertices. If you've assigned a texture, you may need to set the texture mappings. I'm not an expert myself in Managed DirectX 9 (or DirectX for that matter), so you may have better luck in a MDX forum (such as the GameDev.net Managed game programming forum[^])
|
|
|
|
|
i wanted to create an program to show an image as a crosshair in the center of the screen for some games. ive created the crosshair with a transparent form, the image background is transparent also, it works when im running a normal program like a web browser, but when i run a game such as Wolfenstein or Counter Strikc Source (running some resolution as windows) the form loses its always-on-top property. it is moved to the background. is there a way i can make the form ALWAYS stay on top?
thanks in advance,
sam kline
|
|
|
|