|
Hi, I'd like to pass files to the default mail user agent.
What trying to do exactry is to do the same in Windows XP (Open "My Pictures" and select files then click on "E-mail this file" link in the task pane menu on the left).
If you know a good way to solve, please let me know.
Thanks in advance for your kindness.
|
|
|
|
|
P/Invoke
ShellExecute(0,"open","mailto:?file=\"c:\autoexec.bat\"", NULL, NULL, SW_SHOWNORMAL);
|
|
|
|
|
Where can i find the shellexecute function
(which namespace)
Jonathan Slenders
|
|
|
|
|
ShellExecute is one of shell functions so you have to import it via DllImport ,so check for it in MSDN. But I don't know why he didn't recommend you the .NET way: Process.Start()
Mazy
No sig. available now.
|
|
|
|
|
Mazdak,
Does Process.Start() can handle it? If you know how to, please let me know.
What I am trying to is to emulate one of Windows XP function ("e-mail this file").
|
|
|
|
|
Jonathan,
FYI: http://www.codeproject.com/managedcpp/pinvoke.asp
|
|
|
|
|
Thanks > Dmitriy,
However I'm not willing to use P/Invoke. I haven't tested yet but I'd like to use managed code.
I tried with Process.Start() but no luck so far.
Is there any other way?
#BTW: Is following command (with cmd.exe) can be used to test?
cmd> explorer.exe mailto:?file=\"c:\autoexec.bat"
|
|
|
|
|
You can do it either way using the following:
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
public class Send
{
private static void Main(string[] args)
{
if (args.Length != 1) return;
ProcessStartInfo psi = new ProcessStartInfo();
psi.UseShellExecute = true;
psi.FileName = string.Concat("mailto:?file=", Path.Combine(
Environment.CurrentDirectory,
args[0]));
psi.FileName = psi.FileName.Replace(" ", "%20");
Console.WriteLine("Executing '{0}'...", psi.FileName);
Process.Start(psi);
}
} The problem with this method is that not every client (like Outlook) support the file segment in a URL this way.
If you want to do this the right way, you'll have to use MAPI which most major email readers support (in order to be a default mail reader, they have to). There are several articles on this on CodeProject. Just try this search: http://www.codeproject.com/info/search.asp?cats=3&cats=5&searchkw=MAPI[^].
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath,
Thanks a lot.
I'll read the articles of MAPI. I hope I don't have to import MAPI32.DLL.
|
|
|
|
|
I'm just starting to get my teeth in to C# and so far I think its going quite well. I used to do quite a bit of coding in Delphi which brings me on to my current problem.
In Delphi you used to be able to create your own class using a Thread class as its base
example:
<br />
-------------------------------- <br />
TMyClass = Class(TThread) <br />
.... <br />
Public <br />
FVariable : string; <br />
End; <br />
<br />
Var<br />
MyClass : TMyClass; <br />
<br />
MyClass := TMyClass.Create(True); <br />
MyClass.FVariable := 'Test'; <br />
-------------------------------- <br />
MyClass now has all the functions/procedures and variables of a normal thread class. I would like to do the same thing in C# but I can't inherit from system.threading.thread because it's sealed. I suspect there might be another approach to this but I can't find much on google. I guess I am not searching for the right things here. I guess I'm trying to do this the Delphi way when I should be doing them the C# way!!!
Any ideas anyone?
Thanks
|
|
|
|
|
In C# threads are handled differently. You create an instance of System.Threading.Thread and pass ThreadStart delegate to the constructor. ThreadStart delegate represents a method that thread will run.
public static void RunMe()
{
{
}
}
public static Main()
{
Thread myTread = new Thread(new ThreadStart(RunMe));
}
|
|
|
|
|
If you are looking for the syntax of classes for C#, the following is a simple example:
public class TrafficLight
{
TrafficLight(){}
private Color _color;
public Color LightColor
{
get{return _color;}
set{_color = value;}
}
public virtual void ChangeColor(Color newColor)
{
LightColor = newColor;
}
}
public class DeluxeLight : TrafficLight
{
DeluxeLight(){}
public overrides void ChangeColor(Color myColor)
{
}
}
- Nick Parker My Blog
|
|
|
|
|
Hey
Does anyone know how to select a node in a TreeView, inside the application?
Just like a mouse click event on the node.
I have tryed the different combination of
theTreeView.SelectedNode = theTreeView.Nodes[0];
But it does not work
Thanks
Thomas
|
|
|
|
|
It does work (I use it for a few things) but you won't notice unless 1) your TreeView has the focus, or 2) if another control has the focus you must set TreeView.HideSelection to false (default is true ), otherwise it is selected but you just won't see that it is.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
|
I mentioned that in my first reply.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
|
I have this MDI application that has child form, how can I disable one of the menu option in the parent window from the child window.
Thanks
|
|
|
|
|
The easiest way - albeit not a very well-designed way - is to cast the Form.MdiParent property to your MDI parent's Form -derivative class, then access the Form.Menu property and - through the provided properties - disable the MenuItem you want.
A good design would use a modular design pattern in such a way that services are provided to the MDI child forms allowing them easily access the menu, or use the MenuItem.Merge method to merge menus defined on the MSI children with the menu for the parent form. See Form.MergedMenu property for more information.
Using the latter methods allows client forms to provide menus to the parent that they want to use. This is VERY common for most MDI applications. Just open Microsoft Word. Look at the menus available. Now close just the document (leaving the application window open). Your options are greatly decreased (although this process uses the concepts of Active Document containers and servers, but the idea is the same).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi!!!
Maybe somebody use Scintilla and C#...
I need some idea how to do this!
Greetings
S_W
|
|
|
|
|
|
Just wondering did you find any examples? Yet? I'm currently working on this, however having a nightmare trying to interface through C++.
|
|
|
|
|
Also doing a lot of commercial ASP.NET stuff, I never ever found a COMMERCIAL (i.e. no small shareware tool) .NET application for WinForms.
Although there are a lot of commercial .NET WinForm LIBRARIES (e.g. GUI stuff), no APPLICATION appeared to me (even from Microsoft themself).
That could be possible because of:
- I looked at the wrong places
- They are currently being developed and soon be available
- There are in fact no commercial real world WinForm .NET applications, because
- It is still to early (really???)
- No one wants to be the first
- There are still serious bugs in the .NET WinForms implementation
- Developers are afraid of loosing customers with new technologies that could still contain errors
- Developers fear to distribute the .NET runtime or want to wait until it is really really really pre-installed on every client PC
- ???
I do know that (Microsoft-)Navision develops their software from scratch but this will be available 2-3 years in the future (if not still later) as first beta.
So my question: What's your opinion on this topic?
I hope I'm wrong and there are already such applications, because I would like to do some minor tools with .NET but fear to be the first one to try and fail...
--
- Free Windows-based CMS: www.zeta-software.de/enu/producer/freeware/download.html
- See me: www.magerquark.de
- MSN Messenger: uwe_keim@hotmail.com
|
|
|
|
|
I think WinForm applications mostly uses for companies which want their own softwares, not for shareware applications inside internet or other places cause .NET framework still is not part of operating system and should be download seprately. I myself wrote all of win applications for my customers in C# this year(or last year ) and one of them was international oil company of Aaustria in Iran and its a really big company.
Mazy
No sig. available now.
|
|
|
|
|