|
It is possible to "hook" into the event if Alt-F4 is called. Do you got a Forms-application? If yes you can register an event handler for FormClosing. Within this handler you can call the close-method for your COM.
|
|
|
|
|
If have tried Form_Closed and/or Form_Closing event to call Marshal.ReleaseCOMObject(). But it doesn't help,
|
|
|
|
|
Hmmmm... Other way could be to go into the Dispose()-method of the form and to call the release-method there.
|
|
|
|
|
Thanks for the tip.
In the ...Designer.cs i modified Dispose
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
if (m_Session != null)
{
while (true)
{
if (Marshal.ReleaseComObject(m_Session) <= 0)
{
m_Session = null;
break;
}
}
}
if (m_System != null)
{
while (true)
{
if (Marshal.ReleaseComObject(m_System) <= 0)
{
m_System = null;
break;
}
}
}
}
base.Dispose(disposing);
}
but it doesnt't help, because the code isn't called at all, have i misunderstood you ?
|
|
|
|
|
No, you didn't misunderstood me
Hmm... now i'm just at a loss. Normally, if you press Alt-F4 the FormClosing-event should be called. At least Dispose...
|
|
|
|
|
Hi,
I have customized my openfiledilaog. & i would like to replace it with windows OS standard openfiledialog.
|
|
|
|
|
Namaste (or Vannacum) Satish,
I think you can get helpful responses to this question if you first describe what you are doing in more detail.
Since using the standard .NET WinForms OpenFileDialog is so well documented, and easy to do, what's stopping you at this point from using the same way you use a Button or anything else on the ToolBox.
Is the problem that you have some custom features in your customized OpenFileDialog that you don't know how to "move over" when you change to the standard OpenFileDialog ?
best, Bill
"Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and it fact it might bring out its results in algebraical notation, were provisions made accordingly." Ada, Countess Lovelace, 1844
|
|
|
|
|
Namaste Bill Ji,
My problem is, i have customized open file dialag by adding some picture box & it works fine in my application.Now i would like to implement it in my Operating System. that is
if i open notepad Or Mspaint when i click on File->open menu then it should show my open file dialog .
Thanks
|
|
|
|
|
Namaste Satish Ji,
Here I am afraid I cannot help you : extending a .NET modified OpenFileDialog control so it replaces the default operating system OpenFileDialog which is integrated at so many levels deep into the OS, is outside my technical abilities.
Which doesn't mean it can't be done. But I think you'll need a "guru" who really knows a lot about COM and the internals of the OS to know if it's possible.
I do think the only helpful thing I can say is that you might re-frame your question like this :
"How can I take my .NET created/modified OpenFileDialog control, and EXTEND the OS so when I context click on a file or folder I now have an optional menu item that launches my custom OpenFileDialog ?"
Since many applications I use every day add something custom to the default OS context-menu, I would start by looking at how they do that, and how, when the menu item is invoked, it is passed, somehow, a reference to what it was invoked (i.e., what was "selected," for example.
I would start by searching CodeProject on terms like "Extending," and try and then narrow the search terms down from there; I'd also check out StackOverFlow.com and search there, and, of course, Google on "windows adding a custom menu item" and things like that.
good luck, Bill
"Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and it fact it might bring out its results in algebraical notation, were provisions made accordingly." Ada, Countess Lovelace, 1844
|
|
|
|
|
Hello Im new to C# and I am trying to search an algorithm using a Sequential Search but I keep receiving the following error:
The name 'SequentialSearch' does not exist in the current context.
Can someone please tell me what exactly this error message means. Thank you
|
|
|
|
|
The error means exactly what it's telling you; the name you're trying to use doesn't exist. Are you sure you're calling the correct function on the correct object?
|
|
|
|
|
|
lol
ok well it would help if i could spell ....
Direct Link[^]
Next time just try google, if your comming from a C/C+ background always throw "equivalent" in the search terms
|
|
|
|
|
|
How can I know the coordinates of the image within the picturebox when clicked?
Subject to:
1. The picturebox mode is Zoom
2. The picturebox can have any size (but the image inside is uniformely scaled because of Zoom mode)
I would appreciate ideas for solving this,
Thanks
|
|
|
|
|
|
Did you find an answer to this? If so, can you please share? I need to do exactly the same.
Thanks.
|
|
|
|
|
Whats wrong with the one I posted?
|
|
|
|
|
The thing is that the PictureBoxExtended brings only one event (MouseMoveOverImage), and I needed to create another (MouseClickedImage), but its really easy:
This is what it brings:
public delegate void MouseMoveOverImageHandler(object sender, MouseEventArgs e);
public event MouseMoveOverImageHandler MouseMoveOverImage;
And I added the following
public delegate void MouseClickedImageHandler(object sender, MouseEventArgs e);
public event MouseMoveOverImageHandler MouseClickedImage;
And then go down to the protected methods part and create a method that overrides the OnMouseClick method of the base class PictureBox,
so:
protected override void OnMouseClick(MouseEventArgs e)
{
base.OnMouseClick(e);
if (Image != null)
{
if (MouseClickedImage != null)
{
Point p = TranslatePointToImageCoordinates(e.Location);
if (p.X >= 0 && p.X < Image.Width && p.Y >= 0 && p.Y < Image.Height)
{
MouseEventArgs ne = new MouseEventArgs(e.Button, e.Clicks, p.X, p.Y, e.Delta);
MouseClickedImage(this, ne);
}
}
}
}
And what I wrote here is just like the code within the OnMouseMove method... so I didn't had to think anything... Look that i'm calling to the base method also, so you can still use the MouseClick event normally
Cya!
|
|
|
|
|
Thanks for your help!
Appreciate it.
|
|
|
|
|
Hi All,
If you have a ListBox that is populated with many items, the listbox will display a small portion of the list and provide a scroll bar to roll the list Up/Down to view the remainder of the list.
What I would like to do is:
1. Return a collection/Reference to the items that are within the visible part of the list.
2. Return an index to the item that is at the top of the visible part of the list.
3. Trap an event when the list scroll Up/Down and the visible items changes.
The ListBox control doesn't appear to have any properties or events to deal with anay of the above conditions. Does anyone have any suggestions/thoughts/ideas on how I do these things? -Thanks
Regards,
Gavin...
|
|
|
|
|
Take a look at this[^] as a possible solution to the OnScroll problem.
For something with a little more explanation try Getting Scroll Events for a Listbox[^] from here on CodeProject.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
modified on Tuesday, July 14, 2009 7:19 PM
|
|
|
|
|
Thanks for that Henry, That was exactly what I was looking for. It hasn't solve all my problems, but it did steer me in the right direction and I now know how to proceed. -Cheers
|
|
|
|
|
Hi ,
I've created an 8bpp grayscale bitmap file using Bitmap.Save().
The dimensions are 504 x 480 pixels.
504 x 480 = 241920 , so I'd expect the file on the system to be at least 241920 bytes ( 8bpp )
but it's less than 1/3 that size (80,045 bytes).
Can anyone explain this to me please, it's twisting my melon man.
|
|
|
|
|
You've saved it as a bitmap, not a jpg ? I would wonder if, even though you called it a .bmp, the system has defaulted to some other format.
Because, a bitmap would be three times the size you're calculating. There's no 8 bit BMP format that I know of, I thought it still stores as raw RGB data.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|