|
Hi guys, you are my last hope.
read carefully to the end of my problem: i'd like to drag&drop attachments from outlook to explorer; depending on the pressed key (eg. shift) the email should be edited with the file name (like "Attached file shifted to C://test/file.pdf") or the full path and filename where the file have been pasted (->left mouse, no key: standard copy&paste; left mouse + shift: cut&paste - editing email with filename; left mouse + ctrl: cut & paste - editing email with full path)
there are several programms which remove attachments from email and saving them in defined folders; but this is not the solution; i want to remove the files with my mouse to individual folders (eg. proper project folders...) and have the attachments removed from the email (you know outlook folder size)
most of the features are standard for programming or a little bit of google. the crunchpoint what i couldn't find after days of googling:
i need an event FIRED IN OUTLOOK (eg. within an add-on) when an attachment is pasted to explorer from an email including file name and paste folder;
idea 1)
WM_DROPFIlE and similar: this message is only sent to the application where the file is pasted; does not work
idea 2)
register as listener in explorer: i didn't find a proper interface in explorer
idea 3)
register as listener in outlook: i didn't find a proper interface in outlook; an additional problem would be gathering the information from explorer of the filename and paste-folder
guys, does any one of you has an idea?
why in the C# forum? i'd like to implement in C#
THANKS FOR YOUR HELP
werner
|
|
|
|
|
I was considering making a usercontrol for a WinForms app that was simply a combo style control that displayed a list of hyperlinks when it was dropped down.
Ideally I'd like to have an option to data bind it, but I'm not sure how to do it? Is it simply a matter of coding a DataSource and DataMember property so that when they're set, it loads the control? Or is their more to it?
Thanks
Everything makes sense in someone's mind
|
|
|
|
|
You might want to read the article on MSDN[^]
--edit--
The previous link points to the 'simple databinding walkthrough', but you'd need the complex one[^].
I are Troll
modified on Wednesday, October 21, 2009 5:32 PM
|
|
|
|
|
Excellent, thank you!
Everything makes sense in someone's mind
|
|
|
|
|
Hi All,
It is not possible to scroll and to get ScrollInfo using Win32 scroll bar APIs such as GetScrollInfo with a handle to Microsoft Word, Excel, DirectUIHWND, ect.. It does not respond to WM_VSCROLL and WM_HSCROLL Windows messages.
I am able to get scrollinfo for windows controls, but unable to scroll MS Office Word, Excel.
is it possible to scroll Microsoft Word, Excel, DirectUIHWND, ect..?
Can anyone help me? please
Thanks,
Venkat
|
|
|
|
|
Hi All,
It is not possible to use Win32 scroll bar APIs such as GetScrollInfo with a handle to an Internet Explorer's browser window. Additionally, Internet Explorer's browser window does not respond to WM_VSCROLL and WM_HSCROLL Windows messages.
I am able to get scrollinfo for windows controls, but unable to get scrollinf for browser and MS Office Word, Excel.
is it possible to get the scoll bar position of a browser controls?
and
is it possible to scroll Microsoft Word, Excel, DirectUIHWND, ect..?
Can anyone help me? please
Thanks,
Venkat
|
|
|
|
|
I am having a little trouble converting files to WMF.
This code actually does change the extension, but I am having trouble believing it creates a true WMF.
Bitmap b = new Bitmap(@"Test.tif");
b.Save(@"Result.wmf", ImageFormat.Wmf);
I know there is probably a lot more to it, and I really don't know where to get started.
|
|
|
|
|
mypicturefaded wrote: I am having trouble believing it creates a true WMF.
According to the documentation for Bitmap.Save() you are doing this correctly. What is it that makes you think it is not working?
|
|
|
|
|
Well, these WMF are stored in a database, and when needed they are called from some code and displayed. If I use a batch converter that I downloaded, convert the file, and store it in the database, the program displays the image correctly, but if I use my converter, nothing happens.
That makes me believe something is wrong with my converter.
|
|
|
|
|
Oh...From MSDN
"If no encoder exists for the file format of the image, the Portable Network Graphics (PNG) encoder is used. When you use the Save method to save a graphic image as a Windows Metafile Format (WMF) or Enhanced Metafile Format (EMF) file, the resulting file is saved as a Portable Network Graphics (PNG) file. This behavior occurs because the GDI+ component of the .NET Framework does not have an encoder that you can use to save files as .wmf or .emf files.
Saving the image to the same file it was constructed from is not allowed and throws an exception."
|
|
|
|
|
mypicturefaded wrote: but if I use my converter, nothing happens.
Well I think you need to track through the code with the debugger in order to find which part of your converter is not working, and why. There is nothing here that would give any clue to what is wrong.
|
|
|
|
|
I have also tried this, it doesn't work, it seems to be a little closer though.
Read my post right above your last one, it states .Net doesn't have an encoder for saving as .wmf so it just makes it a .png file.
Here is my new code:
int width, height;
string filename = "testresult.wmf";
try
{
Bitmap Sig = new Bitmap("test.bmp");
width = Sig.Width;
height = Sig.Height;
Graphics sigGraphics = Graphics.FromImage(new Bitmap(width, height));
IntPtr SigHDC = sigGraphics.GetHdc();
Rectangle Bounds = new Rectangle(0, 0, width, height);
Metafile sigMetaFile = new Metafile(filename, SigHDC, Bounds, MetafileFrameUnit.Pixel);
sigGraphics.ReleaseHdc(SigHDC);
sigGraphics = Graphics.FromImage(sigMetaFile);
sigGraphics.PageUnit = GraphicsUnit.Pixel;
sigGraphics.Clear(Color.White);
sigGraphics.DrawImage(Sig, Bounds);
sigGraphics.Save();
sigGraphics.Dispose();
sigMetaFile.Dispose();
Image SigN = Image.FromFile("testresult.wmf");
MessageBox.Show(SigN.RawFormat.Guid.Equals(ImageFormat.Wmf.Guid).ToString());
}
catch (Exception Meta)
{
MessageBox.Show(Meta.ToString());
}
The last two lines of the try statement check to see if it is truly a .WMF. On my other files, it returns true. When I run them through this though, it returns false.
|
|
|
|
|
mypicturefaded wrote: When I run them through this though, it returns false.
I'm afraid I'm as stumped as you on this. If the framework cannot save in wmf format then the only option would seem to be to find some external agent that will do it for you.
|
|
|
|
|
While WMF can deal with bitmaps, it is "generally used to store line-art, illustrations and content created in drawing or presentation applications" (Wikipedia). Now how would you convert an arbitrary bitmap (i.e. an image, not a drawing) to that, other than saying it is all one bitmap. But then why use WMF in the first place?
FYI: the inverse is also true; if you have a WMF drawing, you can't load it into a Bitmap; you can get Image.FromFile() to work on it, however you can't cast it to a Bitmap.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
I want to create an UtilLib class to contain commonly used methods (business logic, etc...) that are called from different modules inside the application.
So far, I know of 2 ways of doing it and would like to find out which one is better, or the advantages of each one.
1. Create an instance of the class (Inside the method that calls it) then call the desired method. I know the instance will be disposed once the calling method ends, or goes out of scope and the GC quicks in.
2. Make the class and all the methods static and call the method directly.
(Less code to write)
NOTE: The UtilLib will contain mostly simple methods. nothing too complex.
|
|
|
|
|
IMO as long as such methods don't have a state that needs to persist from one invocation to the next, go for statics. And when state is required, they belong in an object (a real object, not an instance of a MethodCollection class).
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Thanks for the reply. It appears that the thread went totaly out of the subject.
I'll try to explain in another way: Using a classic example, let's say there is a Calculator class with 4 methods that perform the basic 4 aritmetic operations, and these 4 methods are called several times from several different classes spread throught several modules in the application (Thread is not an issue here,please)
The question is: What approach is better?
1. Always create an instance of the class inside every methods that uses it then wait for the GC to dispose of it.
2. Create 4 static methods inside the Calculator class and access then directly.
3. Is there any other way?
|
|
|
|
|
CBenac wrote: It appears that the thread went totaly out of the subject.
I don't feel responsible for that, and I think I already answered your question.
Now if you want a calculator (real ones have state), then create a Calculator class as I said before. Make it static, a singleton, or a normal class, that's up to you. The really reusable one is the normal one.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Luc,
Yes, you already answered the question. Thanks. I'm going with static.
I only used the calculator class as an example, I'm not the type to reinvent the wheel.
|
|
|
|
|
How about inheriting from it? Just a thought.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
And what will this do for them?
only two letters away from being an asset
|
|
|
|
|
May be I misunderstood the thing. If the OP has a class say BaseClass which contains common methods that will be used throughout the application AND if there is a feasibility of using inheritance(since we do not have multiple inheritance) then maybe he can inherit the base class. That way, he would be able to access the common methods without creating objects for the base class. Does that sounds OK or has flaws in it?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
and if there is a need later to add more methods to support additional functionality every derived class will need to be updated, regardless of whether they need the functionality or not. Do you see any flaws here?
Remember the "is a" relationship with inheritance. I can't think how that would apply to the OP's situation. If you want to use String.Format in your class do you derive from String?
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: if there is a need later to add more methods to support additional functionality every derived class will need to be updated, regardless of whether they need the functionality or not.
Not sure about this thing. If I inherit from a class, and later sometime I change the base class, how would that affect child classes which do not need the newly added methods?
I just created a sample solution. There, class X (not an abstract class) had a protected method Test1. I inherited that in class Y. I had called Test1 in the constructor of Y. Then, I added another method in class X. I ran the application again. Worked fine. Are we at the same page?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Sorry, yes I was think abstract classes or methods. However; I still don't view it as applicable or a good design for this situation.
only two letters away from being an asset
|
|
|
|