|
Mycroft Holmes wrote: Copy - paste code is not confined to VB.
That doesn't makes VB any better. It still sucks.
|
|
|
|
|
Hello people!
I am getting a buffer (allocated with CoTaskMemAlloc) from an unmanaged DLL call along with the buffer's size. I would like to feed this buffer (or a copy of this buffer) to DataObject (and drag-drop it...). Is it possible and if yes, how?
I've been coding in C++ for many years now (so i am not new to the concept of the whole programming business), but i'm relatively new to C#, so please keep it simple for me.
Thanks in advance for any answers.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
The details depend on the kind of information you want to represent (string, image, simple binary, ...).
Think of it as a two-step prrocess: first make a managed object that actually holds your data (string, image, etc); then use this[^] DataObject constructor.
|
|
|
|
|
Thanks for the answer. The data is actually a shell item ID list, i supose i should add this as "pure" binary data, it can't be converted into a string (as far as i know), so basicly i guess my quesiton is: what do i "wrap" this into? This might be a basic question but as said, i don't yet have a well enough oversight with C#. I was looking at the *Ptr* methods in the Marshal class but i don't see which i could use, i tried reading the binary data byte-by-byte (Using Marshal.ReadByte) and add them to a list<byte> (yeah, it's a stupid idea but hell, i had to try), i could add this then to the data object with DataObject.SetData, but of course in the end i didn't get what i was looking for. Now i wonder if i could use one of the Copy methods to copy data from the unmanaged buffer to a managed byte[] array and then add that to the DataObject...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
What you're after is probably burried in here[^], it may be steep but I expect it is the best article on the subject and it has a code download.
|
|
|
|
|
Thanks, i'll try to dig into it, but it looks "scary" at first.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
If you feel new and uncomfortable about .NET and C#, maybe you should attempt something easier and less scary first?
|
|
|
|
|
I already did a few basic things to get aquainted with C#, it looks more friendly and welcoming as i originally expected it to be. I'm now experimenting with mixing managed and unmanaged code and drag and drop. What i did was to create a temporary jpeg image and try to drag-drop it. However, most of the time, the drag-drop of the image to applications results in no visible effect. I used ClipSpy to compare a dragdrop from the app and a dragdrop from the shell (expolorer), my guess is that most programs use the "Item IDList Array" in the data to open the dragged file, however, the dragged data from C# does not contain this. I googled around but didn't find anything satisfying, or i just googled for the wrong terms, so i wrote unmanaged code that generates the IDList array from a path into an array allocated with CoTaskMemAlloc and then i hit the problem of not knowing what to do with this buffer once i got it in C#. I might be trying to re-invent the wheel here but at least i am learning.
Am not yet sure if the article about writing a shell extension and avoiding the ItemIDList can help me or not.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
|
I want to make my forms in my software beautiful.I search but I realy dont know how to search. I find nothing. how could I make them beautiful?
|
|
|
|
|
Train the forms by taking them to beauty contests. In time they'll learn how to be beautifull all by
them selfs.
Joke aside, hire a designer or take yourself some design classes.
Even with the fanciest customs controls in order to be beautifull as a whole one must
follow some rules.
I too kind of suck at design but here are some ideads:
- whatever theme(color scheme) you choose, make it consistent across the app;
- make it user friendly(intuitive and easy to use)
- try to keep it simple. In other words avoid making your forms look bussy/agglomerated.
- try to stick as close as possible to the defactolook and feel with some custom pinches.
Sure, the defacto depends on the technologies used to create the apps/forms
(WinForms, WebForms, WPF/SilverLight etc...)
Oh and one more thing: make sure they are appealing/beautifull to the end user and not to you.
I once thought I had a "iRevolutionary" UI in place. Turns out the end users hated it.
I bug
|
|
|
|
|
Computer programs aren't meant to be attractive. They should all be grey with nice sharp pointy corners.
|
|
|
|
|
Some basic information on form appearance here[^].
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
Visit the Hindi forum here.
|
|
|
|
|
If you want to make your forms beautiful then you need to work with a designer. Chances are that you don't have the necessary artistic flair to create something aesthetically appealing to all users - don't be upset about this; most developers don't (I know I don't), which is why a good designer is worth her weight in gold.
|
|
|
|
|
|
hi all,
How can I load html print template in web browser control in C#?
Thank you.
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
what is html print template?
|
|
|
|
|
This[^]?
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
Visit the Hindi forum here.
|
|
|
|
|
Hello,
As said in the title, Visual Studio 2010 crashed when the designer finishes loading. I use the DevExpress components, and I can't remember when it started doing this.
I can't upload the project, since it is too big, and most of you probably wouldn't be able to open the designer anyways, since the DevExpress components aren't free to download.
Here's a video of it: http://www.sendspace.com/file/7zu3o6
Any suggestions are welcome.
Thanks,
Theo
|
|
|
|
|
Well, at least with Visual Studio 2008, the trick was to close all opened editors and saved the workspace and then restart Visual Studio. There is some timing issue when doing that as some operation must be done at the appropriate moment (before it is too late).
Another trick that might works, is to temporarily move some project and/or files before opening the solution so these won't get loaded and won't crash the IDE. Then you could save that workspace, and then try to reload project and files (possibly after a restart and also possibly rebuild everything before opening designer)
Philippe Mori
|
|
|
|
|
Hello,
Neither of those solutions worked for me. I even tried deleting the .suo file, but it still crashes.
Should I upload my project?
Theo
|
|
|
|
|
OK, I fixed it. The problem was that I had a timer starting in a component's constructor that somehow crashed the Visual Studio designer. Adding a if (!DesignMode) { ... } fixed it.
|
|
|
|
|
how to run a method on other executing application?
(invoke the method and send Parameters)
|
|
|
|
|
solomon85 wrote: how to run a method on other executing application?(invoke the method and send Parameters)
You'd need to be more specific than that. Let's name the first application making the call AppA, and the other executing application AppB.
You can load AppB as if it were a library. In that case, the method would be called by AppA, regardless whether AppB is running.
If you want AppB to execute a function on the request of AppA, then you'd best modify AppB to a client/server structure.
I are Troll
|
|
|
|
|
I am not sure if I have understood you, do you want to call some method from an already running application? I mean call the method on the instance that is running. If yes, then you will need to look into inter-process communication. You can set up a NamedPipe and then use it to communicate.
If you need to call some method of another exe/dll, just add it as a reference if it is a .Net exe/dll or a COM component. If it is not a .Net exe/dll, you can make use of P/Invoke.
|
|
|
|