|
I am also trying to do something similiar, where did OleLoadPictureFile(...) come from. Did you add a referenceto the project to make it available. I can't find any documentation on that method. If you could let me know I will dig into this further.
|
|
|
|
|
im happy to hear that u r also trying to do same thing what im trying,so i'll be getting some help regarding this.
this how u have to declare an API
[DllImport("oleaut32.dll", CharSet = CharSet.Unicode, PreserveSig = true, EntryPoint = "OleLoadPictureFile")] static extern void OleLoadPictureFile(Object varObj,[ MarshalAs(UnmanagedType.IDispatch )] out Object oOut);
so when u r referring this automatically u can call the method, in query itself i have specified how to call, u can refer the same. regarding help even i was not able to locate the same, no documentation, the thing is if it is VB so many documents available, but for C# no help.
for stdole u have to add a reference to stdole. try this. in case any pbm reply to me.
Thanks.
regards,
sns
|
|
|
|
|
I think I found what you are looking for. This was posted at devcity.com under CommandBarButton Picture thread. I don't want to take credit for the solution. Here is what was posted. I was attempting to change the icon displayed on a tool window using the ToolWindow.SetTabPicture(), which needed a IPicture object. Make sure your bitmap is the correct size. I was getting a parameter incorrect exception until I corrected the size of my bitmap. Hope this helps.
_commandBarButton.Style = MsoButtonStyle.msoButtonIconAndCaption;
//put an icon ont he button
Image _icon = System.Drawing.Image.FromFile("c:\\cloud.ico");
_commandBarButton.Picture = WService.ImageConverter.ImageToIpicture(_icon);
using System;
namespace WService
{
///
/// Summary description for ImageConverter.
///
public class ImageConverter : System.Windows.Forms.AxHost
{
public ImageConverter():base("59EE46BA-677D-4d20-BF10-8D8067CB8B33")
{
}
public static stdole.IPictureDisp ImageToIpicture(System.Drawing.Image image)
{
return (stdole.IPictureDisp)ImageConverter.GetIPictureDispFromPicture(image);
}
public static System.Drawing.Image IPictureToImage(stdole.StdPicture picture)
{
return ImageConverter.GetPictureFromIPicture(picture);
}
}
}
|
|
|
|
|
Hi,
Thanx for the help given. i implemented the same method earlier, but im getting the same error. still im not getting the reason for that error, bcoz both methods OleloadPictureFile as well as GetIPictureDispFromPicture gives the proper image, the only thing is im not able to assign this to a commandbarbutton. im using shared addins through which im communicating to Microsoft Office 2000, in that im adding an customized commandbarbutton. I have referred Microsoft Office 9.0 object Library and stdole for picture.
To the commandbarbutton im able to add events, text and other so many properties except Picture and Mask...
Can u tell the reason why this error is coming, is any reference missing?.
regards,
sns
|
|
|
|
|
I will attempt to look at this again. The example code you initialy listed includes 'omissing' as the parameter to various methods. Where is this defined?
|
|
|
|
|
i have a fairly broad question here. What im intrested in doing is adding a extension to the standard windows context menu (i.e when you click on the bar desktop). i want to add exstentions too my encryption/decryption program. how can i do this ? if its easy... please reply with a good Code exsample.. if its a apsolute pain could you point me in the right direction to teach myself? (or both). thanks alot
Jesse M.
|
|
|
|
|
You will have to learn COM first to achieve this.
To do this from .net you need to know about COM interop from .net
Have you a look at the following article
http://www.codeproject.com/shell/shellextguide1.asp[^]
There is a sample that comes along with framework sdk, search for Shellcmd in the samples folder, this tells you how to add a menu item to explorer's context menu.
Cheers
Kannan
|
|
|
|
|
I am designing and coding a C# application. It is intended to be a visual display of the navigations between the various files we have. Example:
A page file defines a page to display.
It contains a collection of events to be managed.
The eventmanager file tells me who handles each event.
The event file tells me when the event is handled, the next page to display and the rules to execute to determine if it's valid.
So each event represents a branch in my nav model.
I thought of doing this display like Frontpage navigation or Visio. I thought of doing a custom button with a simple square as its' graphics. Each page name would populate the button.text property and I would programmatically draw a line between each control. I was also going to do this as a fat client app.
What I want (the hard part) is since these navigations can be very shallow or they can be very wide that as I populate the form with these controls that it pops up the scroll bars as needed so that the client can scroll to the parts of the navigation model that they want to view. I should mention I was hoping to do this without having to move the entire model down as I hit the 'upper edge' of the form with a wide navigation, but doing a global move is fine if I have to.
For our first version we are only displaying the navigation model given a starting page. So there you have it. Has anyone built something like this? Am I going to be feeling lots of pain for the next month coding this? Any time bombs waiting to derail me as I execute it? Any advanced assistance would be greatly appreciated.
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
Before I ask my question, let me give some quick background. My current employer has recently decided that downloading certain files (.zip, .exe, etc) slows down the internet performance for the rest of the internet users. So, as a result, they have modified the proxy server to no longer allow such downloads during peak internet hours (8:00 - 3:00 PST). Because of this, I am no longer allowed to download files I need for work without writing a 3 page justification and getting it signed off by 3 levels of managers and then waiting for the right department to give me access and hope the access they give me has a long enough window to get what I need.
That's the background, now here's my question. Is it possible, and if so any ideas on how to go about it, to create a web service which I could give a URL (presumably to a .zip or .exe file) and it would get the file and then stream it to my client? I am still able to consume web services through our proxy, so this would solve my dilemma.
Thanks in advance for any ideas, suggestions, help, pointers, etc.
Larry
|
|
|
|
|
Its definately possible (I wrote something similar in Perl with SOAP::Lite). In fact, it won't even be that hard.
In C#, create a Web service, and then just use a WebRequest/WebResponse object to get the file (I hope you don't need to use HTTP POST to get your files!) and then serialize it and return it.
-Adrian
|
|
|
|
|
You can also try using some proxy tunelling software like Multiproxy or some https free anonymity proxy service.
I see dumb people
|
|
|
|
|
You could give a string as parameter to the path of the file when calling a webservice method (eg. DownloadFile("C:\\blah.exe") ).. That method just reads the file you specified into a byte[] and returns that. Then it would be the best to write a client which you run, and which allows you to specify the path and write the byte[] to a file so you actually saved the file.
Ofcourse, if you do it exactly like this, you can download like everything, but I think thats another question .
|
|
|
|
|
How can take the text from the textBox and save it as a Binary data in the registry?
Many Thanks,
Jassim Rahma
|
|
|
|
|
Hey Jassim,
The Text is stored within textbox.Text property. Look in the C# articles for "QuickRegistry" and use that for storage.
-Adrian
|
|
|
|
|
but this will just create a plain text and not binary one? how to convert it to binary?
Jassim
|
|
|
|
|
In order to store something as a REG_BINARY type using .Net, it needs to be passed as a byte array.
Getting a byte array from a string is as simple as:
byte[] bytArray = System.Text.Encoding.Unicode.GetBytes(textBox.Text);
Then pass bytArray into a RegistryKey's SetValue() function:
MyRegKey.SetValue("MyBinaryEntry", bytArray);
The CLR will automatically detect that the type is a byte array, and set the type accordingly. Retrieving that value will return a byte array also, not a string.
Cheers
|
|
|
|
|
But this will not encode it and it will be easy for anyone to read it? how can have it encoded in the same code?
|
|
|
|
|
If you feel it's too easy for someone to read the binary data, there are any number of encryption algorithms out there. You can apply one before placing the data into the registry.
|
|
|
|
|
But will it be easy for someelse to decrypt it? I need to save a system pssword, what do you recommend?
Jassim
|
|
|
|
|
How can I place the minimized MDI child windows on the MDI container statusBar just like the windows task bar?
|
|
|
|
|
I have now completed my first real C# program - its a nice system tray thing with a notifier that goes and notifies me when I have new web mail by doing HTTP Post/Gets (these response with an XML reply which I then parse). It also uses the TaskbarNotifier class and the QuickRegistry class that I found in the CodeProject articles (many thanks to the respective authors for these).
My only problem is that the release version of the build consumes 14MB of RAM. I compare this with msnim (which Im sure is written with .NET) and other "long running" processes of the same caliber, and I can only come to the conclusion that I need to reduce the running footprint of my program.
Next Q: What can I do to reduce the running footprint?
I have:
* Changed the build type to "Release"
* Removed TRACE from the build parameters (under Conditional Compilation Constants)
Is there anything else in general I can do, or do I start attempting to rework code at this point to make it lighter weight? (e.g. constant sized strings rather than dynamic strings)
-Adrian
|
|
|
|
|
Hmmm.. The size of your application looks ok for a .NET Windows Forms application. Unfortunately, this is the price you pay for all those neat features.
You can try calling GC.Collect() at strategic points to reduce the memory footprint.
Changing your strings won't help. You can try this[^] and try to locate some points for improvement, but don't expect to go lower than 9~10Mb.
I see dumb people
|
|
|
|
|
How are you checking memory usage? I tried Process.WorkingSet and it seemed to keep eating memory. I'm after a more "lite weight" way to check memory usage in my apps
|
|
|
|
|
If the WorkingSet directly refers to what you have through the task manager, then don't waste your time with it. You've got to check out the "virtual memory" indicator, which is much more trustable.
|
|
|
|
|
Unfortunately, task manager does not report true memory usage, it reports what it "thinks" an app needs - try it out for yourself
load up word or something similar
open task manager and find the instance of the program you have just started
While task manager is open, minimize the app
watch the memory usage drop.
I did this with Word and the memory usage in task manager dropped from 14 meg to 500k - somehow I don't think that it's reporting correct memory here.
Process.WorkingSet is supposed to report the memory usage used by the enitre app (and any component dll's?) but the last time I used it, my memory usage blew out to 110 meg after 6 - 7 hours, and I think this is what caused the high memory usage - this is why I'm after a more "liteweight" of checking memory usage.
|
|
|
|