|
Yeah, i am doing that.
Thanks.
|
|
|
|
|
Hi
I know...
...How to read the data of an image from a disk file and store it to an XML file after the data is encoded to base64.
The Problem is...
...To read an Image/picture object from a PowerPoint presentation and store the data (base64 encoded) in an XML file.
Thanks in advance
Mohammed Ali
2nd Flr, Gopur Apts,
Ghole Rd, Shivaji nagar,
Pune - 5. (MH) India.
|
|
|
|
|
Look over the PowerPoint and Office APIs. You could use VBA in PowerPoint to write a macro that does something like this. If you want to read-in the PPT from your program, you'll have to interop the PowerPoint and Office assemblies (there are PIAs - primary interop assemblies - for Office apps on Microsoft's site). You should then read the Office Programming documentation. If I remember right, you can also use the Microsoft.VisualBasic.Compatibility assembly (even from C# - it's just IL after all) to use the IPicture (or is it IStdPicture ? ...don't remember) if PowerPoint still uses that.
-----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 all the Office and other PowerPoint Interops added to my C# Library.
And I am able to read all the other shapes of PowerPoint and save to XML except the Images/Pictures.
I wanted to read the contents of the Images/Pictures that are available in the presentations and store the Base64 encoded data in XML.
Hope I made the issue a little clear now. Sorry for ambiguity.
Project Manager
INTRINSIC - An IMC Company
2nd Flr, Gopur Apts,
Ghole Rd, Shivaji nagar,
Pune - 5. (MH) India.
|
|
|
|
|
There was no ambiquity, I knew exactly what you were talking about. What I'm saying is that you should read the documentation for the property type that the image/picture properties return. That may have a Save method or something. Keep in mind, however, that you can't just serialize the type returned - you have to serialize the image represented by the property type, which is implementation specific. For example, I'm pretty sure you can save an image to a file but you might have to read that in and then base64-encode it. It probably supports writing to a stream, but this is a COM IStream , not a .NET Stream which works differently (so you'd have to define a COM-like IStream and implement that, perhaps wrapping the .NET Stream object).
What I can't figure out is how the Shape ties into this. Just looking at the interop assembly, it would seem that a picture is translated to a Shape, which might not preserve the actual image format (so, if you try to create an Image from a stream, it wouldn't work because it's no longer a JPG, BMP, GIF, etc.).
All I can say is read the PowerPoint and Office object model documentation. I couldn't find much, but I'm not sure I have the PowerPoint programming documentation installed (although I thought I specified a Complete install).
-----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 all the Office and other PowerPoint Interops added to my C# Library.
And I am able to read all the other shapes of PowerPoint and save to XML except the Images/Pictures.
I wanted to read the contents of the Images/Pictures that are available in the presentations and store the Base64 encoded data in XML.
Hope I made the issue a little clear now. Sorry for ambiguity.
Mohammed Ali
|
|
|
|
|
Hi
This is seema..I am intended to design user interface in C#.net for some hardware.For that I have to draw 24 filled rectangles on the form.I can do it simply using FillRectangle().But my aim is to draw one rectangle using some user defined function then when it will appear on the form then i want to copy it and past it on the form itself to creat more 23 rectangles and set there properties according to my wish(like length width and ID).Again I have to do specific event like mouse click event on those rectangles....So can anyone please suggest me how to do it?...I went through many site but not getting exactly what I want.PLZ PLZ tell me if anyone knows....
Regards.
Seema
seema kumari
|
|
|
|
|
Your question is not clear for me,You want those Rectangles for some copy/pasting,width prperties.... why don't you simply use TextBox. But what ever your task is,youcan create a Windows Control and derive it from Control or TextBox class,and add properties in that or customize their existing properties,then it is easy to have 24 of it and set properties for each of them.
Mazy
No sig. available now.
|
|
|
|
|
|
Hello buddies,
I have some important questions and will be thankful if you help me get answers soon and accurate:
If I develop a commercial control for .NET platform,
1. How can I protect my code inside the .dll assembly (MSIL) from being decompiled and visible? there are some softwares out there that can reverse engineer a compiled .dll into a good source code.
2. How they give license and perform protective actions for such controls while if anyone purchase it can give the .dll to friends and they use it wihout any payment.
(If somebuddy can give a good source on web about these sort of commercial related knowledge I really appreciate)
3. Is it possible to make a control not to obey its container transparency? I mean a control that can have any opaque value independent of it's container's opaque value.
---
"Art happens when you least expect it."
|
|
|
|
|
Den2Fly wrote:
2. How they give license and perform protective actions for such controls while if anyone purchase it can give the .dll to friends and they use it wihout any payment.
Search for LicFileLicenseProvider class.
Den2Fly wrote:
3. Is it possible to make a control not to obey its container transparency? I mean a control that can have any opaque value independent of it's container's opaque value.
Look for ControlStyles Enumeration.
Mazy
No sig. available now.
|
|
|
|
|
Den2Fly wrote:
1. How can I protect my code inside the .dll assembly (MSIL) from being decompiled and visible? there are some softwares out there that can reverse engineer a compiled .dll into a good source code.
Compilers that target the CLR ALL produce Intermediate Language, or IL. This - like Java bytecode - allows the system to JIT the IL to native code and execute it, so that it can be run on any OS (Microsoft's problem with .NET is that it relies too much on native OS resources, but it does provide a consistent UI). The Microsoft .NET Framework SDK even comes with a disassembler, ildasm.exe. For those of us who can read IL, we don't even need decompilers like .NET Reflector[^] (though it is nice at times!). There are just as many problems that can output this source code as well, although I have yet to see one that does an impeckable job with more advanced source code (using all the tricks of the languages).
All you can do - which is true of any program in any language - is make it hard and, therefore, costly to do so. I remember the words of Bruce Schneier with questions like these, who basically says that anything is crackable - it's just a question about the cost of resources to do so.
Make your program work well and hide your important code in complexity, or write native DLLs and P/Invoke or interop (use COM to make this easy) the functions and components in those native DLLs. Keep in mind, though, that they too can be decompiled (though decompiling C/C++ libs is more difficult, more expensive, and less correct than with IL and bytecode).
You can get obfuscators to obfuscate private members, but for every obfuscator there is a de-obfuscator (and they've really never stopped me - and I'm sure others - anyway, from seeing how something is done for academic reasons).
-----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-----
|
|
|
|
|
Maybe this is a dumb question Heath:
With ildasm.exe I can see functions and variables that are used in my assembly for each lines of codes,but not the VALUE of them. Does decomling with other tools are the same or they can show the value of them too?,for example Can I store a password in my codes in a varibale?
Mazy
No sig. available now.
|
|
|
|
|
It does show the value, either in the static constructor (.cctor ) or in an instance constructor (.ctor ), depending on where you initialize the fields. So no, you shouldn't store a password in your code if it protected anything important. Same goes for private keys you use to decrypt values. If you store the private key, someone need only extract it and decrypt your values, whether they are in IL or your app.config (or proprietary) file.
-----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 Stewart wrote:
So no, you shouldn't store a password in your code if it protected anything important. Same goes for private keys you use to decrypt values
Thats the the thing I was thinking about. So where is good place to keep it? Unmanaged DLL? Or Databse? (but not all application need databse)Or...? This could means Unmanaged World won't end soon.
Mazy
No sig. available now.
|
|
|
|
|
Even a password stored in a native library isn't safe. First ask yourself why you need to store a password. Second, ask yourself what conditions are required of your application, like being Internet-aware. If it MUST be, you could always pull an encrypted password (say, through HTTPS - HTTP over SSL - using a Web Service or .NET Remoting, or even a simple GET or POST HTTP request) from the 'net.
If not, you should look into more advanced cryptography (like using the System.Security.Cryptography namespace elements). There are a couple tutorials here on CP, but you should try googling for some examples and discussions.
-----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 Stewart wrote:
First ask yourself why you need to store a password. Second, ask yourself what conditions are required of your application, like being Internet-aware.
Yes,but where ever password is and where it goes through,the KEY for encryption MUST store somewhere. You say native dll is not safe too,so where is safe?(Or safest place other than programmer mind) Of course maybe some other encryption method which do not hash with given key and methods that are one way.
Mazy
No sig. available now.
|
|
|
|
|
ANYTHING you put in your assembly is visible to other people. If you use a password, they can see that. If you use a private key to decrypt information, they can see that. If you use a custom hash algorithm to hash your password so that only you can retrieve it (so you think), they can see that and run the same thing. Heck, even using the HTTPS mechanism I talked about can be replicated, but if your application accesses secure resources over the Internet, you at least have control over who/what you allow to access your service.
This is a big topic of software security and there are a lot of books and what-not out there.
If you're doing this for licensing reasons, there are more options available. Check out my article for instance, Using XML Digital Signatures for Application Licensing[^]. This is only conceptual, I remind you, and - being that it uses IL - it can be cracked (like I said before, anything can - it's just a question of the cost of resources compared to the cost of the information). You can bury the implementation in complexity, though.
There are many other solutions out there, too, such as XHEO[^] that use the same idea but gives you lots of default implementations (since mine is merely a discussion into the concept, not a full-blown solution) like communicating with a server. Some will even use a MAC address of a NIC or the ID on a CPU (for those that support it, although this can be very difficult and not reliable since not all CPUs have it (or enable it)).
.NET is hard to protect because of the ease of seeing information, which is why you might consider doing licensing in a native DLL - and there are many solutions and articles about this on the 'net.
Why am I mentioning licensing? Because you should allow your application to access protected resources with its own credentials because, as I said, those credentials can be hacked. Many applications will make use of Windows credentials, which are harder to hack and are provided by the Windows clients and servers. If you use licensing in your application, you (mostly) ensure that undesirable users aren't using your program, and that they use their credentials to access resources. There's also some lessons to be learned in these different approaches.
For instance, our application uses SQL Server over the LAN or through .NET Remoting on the Internet. We ask the user for credentials that are passed to SQL Server and validated. The program doesn't do this themselves - the person is required to provide credentials to protected resources. If we just let the application do it, we would have to store the same credentials for everyone (or encrypt them to an individual file for each person) which means that anyone can see them - even users that aren't paying for our system!
-----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-----
|
|
|
|
|
Well,Thank you Heat. I should read your articles very soon and my .NET Framwork Security book. Thanks for the information
Mazy
No sig. available now.
|
|
|
|
|
Hi all
Ok I know this is not entirely related to C#, but it is related to any message board on CODE PROJECT
Do the messageboards on C/P have RSS links
thnx
Mohsen
|
|
|
|
|
|
Colin's right - you should post this in the Suggestions forum. I will tell you, though, that this has been requested many times and I believe it will be a feature of the new CodeProject to be written in ASP.NET (whenever that gets finished). I guess asking again won't hurt, though, just don't be surprised if you get a barrage of insults for re-posting!
-----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-----
|
|
|
|
|
Well i don't really know whether i should be here, but i'm just after some advice really. I'm 18yrs old, and am studying C at the moment, which i'm finding challenging to say the least. I'm probably going to Leeds University to study Computer Science later on this year, and am just wondering if C and VB are the best languages to start off on? - This is what i've heard. I'm interested in gaining a grasp of object orientated stuff, as well as a more general purpose code, like C.
If anyone can shed any light on this, or just offer me some friendly advice to a beginner-programmer, then please please get in touch.
llitanzios85@hotmail.com
Thanks so much.
Lewis.
|
|
|
|
|
Probably the work issues / résumés / certification[^] forum is better... But I'll give you my opinion here anyway.
I'd say that if you want to do hardware control systems then C is the language of choice. If you want to do business oriented software then C# or VB.NET are better [if you are staying in the Microsoft world]. C++, in my opinion, is at a juncture. I've written windows applications with it and it is still used to create them, but C# is now better in that respect unless you need to coax the last clock-cycle out of the processor. C++ will be staying for a long time but as more enterprise systems get written in languages like C# then C++ will be relegated to legacy systems, OSes, hardware control systems and anything that requires very tight optimisation (in comparison to C#)
Perhaps if you let everyone know what area(s) you wish to go into on leaving university it might help guide a better answer. However, while at university you may find a preference for a particular language. (Some people even like COBOL )
--Colin Mackay--
|
|
|
|
|
I use the following constructors:
FileStream str = new sio.FileStream
(filename,
FileMode.Open,
FileAccess.Read,
FileShare.Read);
m_Stream = new StreamReader (str, true);
But when I'm reading a byte at a time (polling in another thread), I can't write to the file I am reading.
I am simply opening the file in Notepad - but I get prompted each time I try to save in Notepad and it won't let me save the file my program is reading from.
Is this possible? I am implementing unix "tail" and I thought I could just open any file and read from it - without implicitly locking other software from writing to the file.
Any suggestions?
Thanks,
-Luther
|
|
|
|
|