|
Thankyou Bill, I get clear...very nice reply...
|
|
|
|
|
Hello,
I want to create a remote support application which will aneble user to connect to a remote pc and take control of it (just like logmein), I need it in vc# .net or vb .Net. I am searching articles or web articles to guide me. Also for multiple desktop sharing (be able to connect to multiple pcs).
Thank you
Kyriakos
Kyriakos
|
|
|
|
|
|
|
Hi, I'm making a C# program that will need to load a .DDS image file ('direct draw surface'), the ones I'm using will only ever have a simple header and uncompressed image data.
There are ways to handle .DDS's using XNA and a few other free to use libraries, but since the files I'm using are so simple and the structure so well documented I thought I would make my own 'reader' so as to be as lightweight as possible.
I have made a method that reads the file header simply enough, giving me the height and width of the image, amongst other things. The image data itself follows the header as simple uncompressed Uint32's (sets of 4 bytes) giving the R,G,B and A of each pixel. What would be the most efficient/effective way to get this information into an Image/Bitmap object so I can display it on screen, and overlay it over other images using its Alpha values.
Although the Image class has a 'FromStream' method, I'm pretty sure it needs to read in a known header as well as the image data or it would not know how to deal with it. It certainly seems to fail if i try reading in pure data from my files.
Any thoughts or help would be greatfully recieved.
|
|
|
|
|
This MSDN page[^] is what you want; make sure to read the Remarks section too.
|
|
|
|
|
That remark makes it more than a little annoying, wouldn't it be better to create a new Bitmap(width, height), lock the bits, write data, unlock bits, as usual?
|
|
|
|
|
what it means is nothing gets stored twice, so if the source data disappears so does the image.
If you are willing to temporarily have the data twice in memory, use that constructor, then copy the bitmap with Bitmap bm2=new Bitmap(bm1); and now bm1 (and its data) is no longer needed, so Dispose of it and forget the remark.
|
|
|
|
|
IMO it means trouble. Suddenly the lifetime of one thing affects the validity of an other. Very .. manual memory management-like. Completely contrary to the entire idea of garbage collection.
I suppose you could do that too yes, but what's the advantage of that over writing it into an actual bitmap manually?
|
|
|
|
|
Nothing special here, you're passing a pointer into that constructor, hence the data isn't managed by .NET; it is inherently unsafe, just like passing pointers to native code is.
And it is somewhat related to Image.FromFile locking the file for as long as the image lives, which is troublesome as it isn't documented well and the code itself does not provide a clue. The same copy-to-a-second-bitmap trick solves that one too of course.
|
|
|
|
|
Yes I thought of that one.. very annoying. And Image.FromStream wants the stream to be kept open, and on top of that resets the Position to zero. It's actually in the documentation (at least it is now, was it always there?) but I discovered it the hard way, when the first image kept loading over and over and then all bitmaps mysteriously died..
|
|
|
|
|
I agree, I'd do that. Holding the file open for the lifetime of the image definitely seems like the wrong answer and, if you have to load it into memory anyway, I think it's better to very temporarily have two copies and then let the Bitmap own the data.
Also, depending on the order of the data in the file, you may have to reorder it so that it's in a valid 32 bit pixel format for dropping into a bitmap. I think you need ARGB but it might be BGRA in terms of the byte order in the stream.
|
|
|
|
|
Hi Amit,
I tried to run your code but i am not getting any output.
Can you please tell me if i have to do any settings for running the project?My friend told me that project runs in Windows 7 and doesnt require any settings.
I am using Windows XP and Visual Studio 2005.
Thanks in advance.
|
|
|
|
|
Which project and who is Amit? This site has millions of members so it could be anyone. If you are referring to some article then you should use the forum below the article to contact the author.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi,
Sorry for posting the query at wrong place.
I was referring to the article "Search Engine for LAN".
|
|
|
|
|
Post this question against the article / tip so that the author can take a look at it.
You mighe be able to get an answer.
|
|
|
|
|
Hello,
I want to search text in a WPF richTextBox. My problem is the text is formatted...
For a normal text I use this:
string wordToSearch = "word";
TextRange tr = new TextRange(this.rtb.Document.ContentStart,
int startPos = tr.Text.IndexOf(wordToSearch);
this.rtb.Document.ContentEnd);
if (startPos > -1)
{
int l = this.GetLinesCount(tr.Text, startPosition);
TextPointer startRtb = this.rtb.Document.ContentStart;
TextPointer start = startRtb.GetPositionAtOffset(startPos + l);
TextPointer end = start.GetPositionAtOffset(wordToSearch.Length);
this.rtb.Selection.Select(start, end);
this.rtb.Selection.ApplyPropertyValue(
TextElement.BackgroundProperty,
this.rtb.SelectionBrush);
}
public int GetLinesCount(string str, int startPosition)
{
int lines = str.Take(startPosition).Count(k =>
k.Equals((char)13) || k.Equals((char)10));
return lines + 2;
}
But, for a formatted text (other color for example), I see a difference between my "word" and my "selection" of X characters.
If somebody has an idea?!?
Thank you for help me...
Bye.
|
|
|
|
|
|
|
i want to built a remote desktop tools or software that can connect and share the desktop.. the graphics quality should be good..
can anyone help me... providing the details of the project .
|
|
|
|
|
Sure I can. In the search box at the top, type in remote desktop c# and make sure the search in articles radiobutton is selected, and Bob's your transgender auntie.
|
|
|
|
|
Palantir - Remote Desktop Manager[^] is always a good article to consult when looking at writing your own desktop program.
Too much of heaven can bring you underground
Heaven can always turn around
Too much of heaven, our life is all hell bound
Heaven, the kill that makes no sound
|
|
|
|
|
I got a question about TDD and unit test using Visual Studio 2008 Pro. One of the TDD requirements reads something like "All tests should fail initially when there is no coding yet!" However, when I generate a test project from VS 2008 Pro, all tests can pass before any coding. Do I have to add code to the test project, in order to make the test fail initially? Or am I missing something here?
Best,
Jun
|
|
|
|
|
Of course you need to write code. The unit test is created with defaults; its up to you, the developer, to actually make it relevant.
No comment
|
|
|
|
|
*bang* *bang* *bang*
The thing I love about banging my head on the desk, is the wonderful feeling you get when you stop...
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|