|
Hi All,
I have requirement by which,:
when i press Ctrl+C on an outlook item, it gets copied to clipboard. I have to use this clipboard content and get MSG file(which is now text-data to clipboard), to C# outlook item and use it (say eg: save on some location as file).
if (Clipboard.ContainsText(System.Windows.Forms.TextDataFormat.Text))
{
IDataObject myData = Clipboard.GetDataObject();
Outlook.MailItem olMsg = (Outlook.MailItem)myData.GetData(DataFormats.Text, true);
}
Above code does not work because outlook is showing copied message as Text and not FileDropList!
Thus above code fails. What is other way to do so or modifications in same.
Your help highly appreciated.
|
|
|
|
|
I am currently working on a project, which will dynamically load in a C++ library and instantiate one of the contained classes through the use of a common interface.
However, one of the methods that I am trying to expose in the C++ library takes the following set of arguments...
C++Library.MethodName(String^ stringVariable, unsigned char sProblemVariable[])
This is where the problem arises.
Now I know the C# equivalent of the unsigned char [] argument is a byte, so I am attempting to use this method in the following manner.
byte[] byteArr = new byte[127];
unsafe
{
fixed (byte *bytePointer = byteArr)
{
int returnValue = Interface.MethodName(aStringVariable, bytePointer);
}
}
So I am attempting to expose the C++Library.MethodName through the Interface, using the following method signature...
unsafe int MethodName(string stringVariable, byte *problemVariable);
When compiling the C++ Library, implementing the interface, it builds successfully so I assume that the C++ method signature satisfies the C# interface signature.
However, when I attempt to load the C++ Library, I get a Reflection Exception telling me there is no implementation for the MethodName method, in the Library.
Any help would be greatly appreciated!!
Thanks..
A girl in Engineering AND IT?!...what is this nonsense?
|
|
|
|
|
Is there a reason you can't refactor the C++ code to .Net/C#?
What is the exact exception message?
Can you show us the interface you're creating (just the method prototypes will be sufficient).
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I was trying to use PInvoke, as it provides another level of abstraction in a system that really doesn't need any more.
A generated C# code block dynamically loads the C++ dll through an interface loaded dynamically...and so on..
Anyway, I have resolved the issue by wrapping the C++ methods which take the unsigned char argument in methods which can be easily exposed through the interface.
Thanks for your input.
A girl in Engineering AND IT?!...what is this nonsense?
|
|
|
|
|
Did you consider wrapping the code in managed C++? I've done that occasionally in the past and had a lot of success with it.
|
|
|
|
|
Is there a reason you can't pinvoke this method? If you intend to write to the unsigned char [], you can pass a StringBuilder in to the method and use the output from that.
|
|
|
|
|
|
I don't think that was needed. Given her activity on the site to date, I was pretty confident that she wouldn't notice that, and now you've put a spotlight on it.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Maybe the spotlight should not have been put on her to begin with.
A little more class and little less lecherism, please.
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
|
|
|
|
|
Hey, I agree.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
My original indent was to inform her.
If you have a look at timings, i informed her just after few posts and later non-sense chat started.
Had she seen my message here, when it was posted, non-sense would have been limited very much.
I had to delete message myself from being further down voted by people, who down vote a already down voted message without thinking about it.
|
|
|
|
|
I'd prefer to wrap it in another method that would then be exposed. That's how I do P/Invoke.
public byte[] Whatever ( ... )
{
/* Maybe convert the parameters as necessary */
return ( C++Library.MethodName ( ... ) ) ;
}
|
|
|
|
|
Errr, I think this is managed C++, isn't it? In this case you don't need pointers at all. Both libraries are running under the CLR, so you can pass the byte array. Have you considered AssemblyResolve[^] event?
|
|
|
|
|
Hi,
Any one guide me about the datagridview
Advance Thanks,
GJ.Balaji
|
|
|
|
|
See here[^].
You can search on the internet and you will find tons of more information.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
|
|
|
|
|
Be warned, you should not edit data in a list control. Pop a dialog with the record information and edit it there, then reload the table/record in the grid after the user has completed editing.
Inline editing generates more problems that it solves.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Agreed - plus it is a lot easier for the user to work out what goes where. 5!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
I got more than 168000 results when I used this keywords "update and delete data in DataGridview in C#" to search on Google. whatever I will suggest you to move there[^] and read the whole thread. and you can also navigate this link[^] to learn how to delete,Insert and Update data with datagridview.
|
|
|
|
|
That's not how this forum works. Somebody posts a vague question that requires some research. It's up to you to go off, read up on the subject, write a lengthy reply detailing exactly how to accomplish the task and the ins and outs of the topic. Expecting somebody to Google a topic first is just crazy talk.
|
|
|
|
|
thanks for your valuable advice.
|
|
|
|
|
I'm not altogether convinced that your irony got through there.
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.”
I wouldn't let CG touch my Abacus!
|
|
|
|
|
Neither am I. I hope that he's being subtle and not taking it to heart.
|
|
|
|
|
Hi friends,
I am developing a Parental Control application. I want that no body could kill this application from Task-Manager. Even administrator should not be allowed to kill this process from Task-Manager.
The only way to close the application should be that user click its CLOSE button, he will be then asked to enter his password, and if he enters correct password, application would get closed.
The behavior should be similar to when user try to kill an anti-virus. For example when I try to kill the anti-virus Kaspersky, I get below error message:
---------------------------
Unable to Terminate Process
---------------------------
The operation could not be completed.
Access is denied.
I also want similar behavior. Please let me know, how to do that.
Thanks in advance
|
|
|
|
|
If a user has full admin rights they can take down/kill any process.
At Karpersky it is a windows service that must be shut down(stoped) before ending the process(es).
[edit to add]
If the computer(s) are on a domain with active directory then it would be really simple to block even the local admins.
All the best,
Dan
modified on Sunday, January 16, 2011 12:55 PM
|
|
|
|
|
By hooking into TerminateProcess or NtTerminateProcess you can achieve what you're looking for. I seriously doubt though that having a .NET C# function as a hook function is a.) advisable and/or b.) a feasable thing.
If you want to invest some time/work to get going in C++ this CP articel might come in handy: Easy way to set up global API hooks[^]
Regards
|
|
|
|