|
Is it possible to embed a .chm file as a resource and display a help window using it? I have a small app and I'd like to have a few windows that display some info using html. I thought .chm would be the easiest way to go. I found another solution on the web which uses an active X control to use IE, but it doesn't seem to work in a multithreaded apartment... which this app is. Any ideas?
|
|
|
|
|
Why not just distribute it like every other program and library without embedding it. Talk about a waste of space and expensive load times. Besides, in order for hh.exe (the HTML Help viewer) to load and display it you'd have to extract it anyway unless you host the ActiveX controls, get an IPersistFile implementation to read your embedded resource stream then go to a lot of work with interop to read it. Talk about a useless mess! Just distribute it as a separate file like every other program.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I just didn't want people to be able to accidentally delete it and cause a problem. But I see now that if the file is missing, nothing happens.
|
|
|
|
|
If people start deleting any of your files, they will invariably break something. Same goes for any program. They shot themselves in the foot - you didn't pull the trigger. Up until Windows XP with system file protection enabled, users could easily hose their systems doing the same thing. There's nothing you can do besides charge them extra for luser support.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello to All!!!
I have a small problem.I need know if the CapsLock( NumLock ) is pressed on the start of my app.I mean that it no if it is pressed actualy but is "turned on".
Thanks...
|
|
|
|
|
You should be able to check that with the System.Windows.Forms.Control.ModifierKeys[^] property.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
That only works for modifier keys, for which Keys.CapsLock does not apply.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
See an old post[^] to a similar question. Keys.CapsLock does not count as a modifier key so you need to get the actual key state. The link above shows you how to P/Invoke GetKeyState and call it (don't worry about calling native functions - many of the classes in the .NET FCL - especially all the Windows Forms controls - already do it...a lot).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Hi,
I'm just starting to learn C#(and I like it) and .NET Framework, and I stared with this: I want to make a chat application. Basically, I have a server and a client, connected via sockets (all works just fine). Now, I would like the client to send some info to the server -> a serialized object (because there are many types of values in this object). The problem is that the server and the client are not the same application, and thus, deserialization doesn't work (or at least, I couldn't make it work...maybe you can help here).
This is the code I use for serialization:
MemoryStream ms = new MemoryStream();
StreamingContext stmCtx = new StreamingContext(StreamingContextStates.CrossMachine | StreamingContextStates.Persistence);
BinaryFormatter bf = new BinaryFormatter(null, stmCtx);
bf.AssemblyFormat = FormatterAssemblyStyle.Simple;
bf.TypeFormat = FormatterTypeStyle.TypesWhenNeeded;
bf.Serialize(ms, negociate_struct);
...and then I send ms over the network. Now, serialization is basicaly ok (because if I deserialize here ms, is works fine), but on the server I got this IOException : "File or assembly name RCClient, or one of its dependencies, was not found." RCClient is my client application name. I also saved my stream to a file, and got something like:
" ˙˙˙˙ RCClient %NegociationStructures.NegociateStruct
SenderTypePacketNo
NPResponse xxx" It's obvious my server application doesn't know who RCClient is.
I figure the problem is either with setting the BinaryFormatter, or I use the wrong tool for the job. Also, I can't use SOAP serialization, because I noticed that the stream is much larger, and I need as much speed as possible (this should eventually develop into a video chat & stuff).
I hope I made my problem clear, and I would appreciate any help or hint.
Thank you in advance,
Doru K.
|
|
|
|
|
dorutzu wrote:
"File or assembly name RCClient, or one of its dependencies, was not found."
That indicates that your server application doesn't know how to find the type information for the object that your client sent over. To fix this, move all shared classes into a "Class Library" (dll) that both the client and the server applications use.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
You should also read How the Runtime Locates Assemblies[^] in the .NET Framework SDK.
Serialization does pack-up your object graph (your RCClient in this case) but it needs to deserialize it back into an instance of that class so it's still required on both ends. As the previous post mentioned, put all shared classes in an assembly that both the server and client can access and make sure it can be found.
Finally, you might want to look at .NET Remoting. It serializes data in an extensible manner (i.e., you can specify whether or not to use the binary, SOAP, or a custom formatter, and whether or not to use the HTTP, TCP, or custom transport channel) and marshals it across the wire. This also opens your application up for a good AOP (aspect-oriented programming) model so that you can intercept methods and log them, encrypt them transparently to the method calls in your program, etc. Basically, you're already doing the very basics of what Remoting is, but you'll find that Remoting is a proven, extensible, and tested implementation. Read Accessing Objects in Other Application Domains using .NET Remoting[^] also in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you very much for your answers. I took the easy way, and just bundeled everything in a .dll for both applications to use it...and it works just great! And it was so easy...
Thanks again!
Keep in touch,
Doru
|
|
|
|
|
Hey!
I have a picture(GIF) with a figure on it, it have a transparent pattern so al around this figure will be transparent.
Now this works fine if i just have this transparent picture in a picturebox right on the form, it will get the foms bakground color as bakground under the transparency.
But if i want to have a a Image as bakground and then have a picture box on top of it that contains the Gif picture(figure) then it will not show the forms bakground image in ti transparent area, instead it shows the color of the form.
Is there any way to have a picture box with a Gif above another picture and then get the bakground bickture to show throw the transparent area of the top picture(gif) ??
//Jimmy
|
|
|
|
|
Why not just draw the image onto the form without the PictureBox, that way you don't have to handle the background color of the PictureBox.
- Nick Parker My Blog
|
|
|
|
|
Yes this will solve the problem with the System Control THANKS ALOT
But
I got a own made balloon tip box in a form, this ballon tip is a picture in a panel, this balloon tip have round cornser and nedd to be transparent in this corners.
But when a choose transparent on the panles bakground it will only show the color of the forms bakground color, just like the other problem.
Do you maby got an sulotion to this to?
This panel haves som labels and so on, so i can´t just load it in to the bakground of the form like the other problem.
Yes i could load it on but then o hade to load in the cordinates for al the labels and so on, this dont sounds lika a good sulotion.
//Jimmy
|
|
|
|
|
Hi dudes,
I need to get the height of the taskbar.. How do one do that?
- Up The Irons, Morten Kristensen
|
|
|
|
|
hi, you can use the SHAppBarMessage API for that, just do a search on codeproject and theres an article on it somewhere. It will let you get the RECT structure of the taskbar.
|
|
|
|
|
Hey dude.
sorry but I can't find anything by that name.. :/
Could you be so kind to fetch it for me ?
- Up The Irons, Morten Kristensen
|
|
|
|
|
Here you go, its mostly about something else, but theres a part about getting the size of the taskbar if i remember correctly.
http://www.codeproject.com/csharp/csdoesshell3.asp
Dan
|
|
|
|
|
Every 30 seconds or so, I need my application to persist state, just in case the power goes off or something like that. What's the best method based upon this time frame? For example:
- Save to an XML configuration file.
- Save to registry.
- Save to binary file (serialize object?)
- Something better?
Thank you.
Sammy
"A good friend, is like a good book: the inside is better than the cover..."
|
|
|
|
|
Don't save to the registry with .NET applications. It's not a good practice for many reasons, especially deployment issues. Other than that, save to whatever file format you want. Binary serialiation is faster than XML, but XML gives you the ability to easily customize the state while the program is not running.
One other way - albeit more difficult - would be to implement a custom BindingManagerBase derivative that uses a file as a backing store and bind the properties of controls you want persisted. When they change, the binding manager is updated and your derivative class could save state immediately. This way, you don't have to poll and don't have to keep a timer, which is relatively inefficient since the state of your application might not have changed. See the documentation for the BindingManagerBase and Control.DataBindings in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Another consideration for your design should be:
What happens if the power goes out WHILE the state is being saved?
If your app is that critical, you might want to consider a UPS and monitor that for a power outage so your app can save it's state one last time before the power REALLY goes out.
RageInTheMachine9532
|
|
|
|
|
Okay, it's not THAT critical
Thanks!
Sammy
"A good friend, is like a good book: the inside is better than the cover..."
|
|
|
|
|
Hello,
As I build MDI App, Form Activated event of each child form fires once at loading but never again. I want to know why this is happening. As earlier when same application was not MDI App Activated event of each form fires every time when form get focus.
Thanks for ur support
Inpreet Singh
|
|
|
|