|
I need to create a activex or control to get web page snapshot and save it as an image (gif or jpeg).
I don't know if its possible with c#.
Could you please help me by sending any example or link?
Thanks a lot.
|
|
|
|
|
*Apology in Advance*
ALT+PRTSCRN ?
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
..
I know that one but my problem is that I need only the content area and that too programatically. Something like this site is doing:
http://www.tonec.com/download5.html
but its doing so many things and I just need to create a snapshot of web page content area as jpeg file.
The project I have needs to add a button in IE toolbar and when clicked, create a snapshot of web page content area into image file jpeg/gif.
Any ideas??
|
|
|
|
|
Sorry, I just couldn't resist; personally, I'd pay the $75, since I'd spend about that much of my time trying to figure out a way to do what they've already done.
What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
|
|
|
|
|
So i think it would be handy if I could write a function that does this:
If \\server\share\binary.exe is managed code
Do this
Otherwise it is not managed code
Do that
Is such a thing possible?
Thanks,
Ian
|
|
|
|
|
I know this function works with managed and unmanaged dlls. You could try it with executables though:
public bool IsManaged(string filePath)
{
byte[] Data = new byte[4096];
FileInfo file = new FileInfo(filePath);
FileStream fin = file.OpenRead();
int read = fin.Read(Data,0,Data.Length);
fin.Close();
if ((Data[1] << 8 | Data[0]) != 0x5a4d)
return false;
Int32 iWinNTHdr = Data[63]<<24 | Data[62]<<16 | Data[61] << 8 | Data[60];
if ((Data[iWinNTHdr+3] << 24 | Data[iWinNTHdr+2] << 16
| Data[iWinNTHdr+1] << 8
| Data[iWinNTHdr]) != 0x00004550)
return false;
Int32 iLightningAddr = iWinNTHdr + 24 + 208;
Int32 iSum=0;
Int32 iTop = iLightningAddr + 8;
for (int i = iLightningAddr; i < iTop; i++)
iSum|=Data[i];
if (iSum == 0)
return false;
else
return true;
}
Got this from a blog entry here:
http://blogs.msdn.com/adam_nathan/archive/2003/10/26/56786.aspx[^]
Hope this helps,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Hello,
Is there a file properties dialog control in C# (similar to the OpenFile dialog)? Something similar to what you see when you check a files properties using Windows.
Right now I am using FileInfo and FileAttributes to get the necessary info but if there is a ready made dialog that would be great (though I can't seem to find one).
Thanx a lot,
-Flack
|
|
|
|
|
No, there is no FileProperties Dialog native to C# or the .NET Framework. The easiest solution is to build your own dialog.
RageInTheMachine9532
|
|
|
|
|
If you know the path to the existing file, you could P/Invoke SHObjectProperties :[DllImport("shell32.dll", CharSet=CharSet.Unicode)]
private static extern bool SHObjectProperties(
IntPtr handle,
[MarshalAs(UnmanagedType.U4)] SHOP type,
[MarshalAs(UnmanagedType.LPWStr)] string path,
[MarshalAs(UnmanagedType.LPWStr)] string initialPage);
[Flags]
private enum SHOP
{
PRINTERNAME = 1,
FILEPATH = 2,
VOLUMEGID = 4
}See http://msdn.microsoft.com[^] for more information about this API.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi All,
I have a problem that is driving me mad. I have checked the weba and there is a number of results explaining the problem but no real solution. I am putting together a GUI. I have put a lot of work into it and just when I am finished I jump from code view to design view and BANG get the following message:
"an error occurred while loading the document. fix the error, and then try loading the document again"
I wasnt editing any of the control properties. This has happened already this week but as I didnt have that much work done on it I started again (gave me a chance to tidy up) but I would really like not to have to redo he work for the third time and then it happen again. Is there any fix for this? Is it and IDE problem? Any comments/suggestions would be brilliant,
Regards,
John
|
|
|
|
|
There's many problems that can cause this - such as editing the code in the "don't edit this code" region (the designer-generated stuff). I commonly have to do this to enable localization in our application without the overhead of localizing EVERYTHING that can be localized (makes the app bigger and much slower), but I don't really need the designer after initial layout.
If you're using the designer to support derived controls and forms, you have to make sure that everything you access is either public, protected, internal, or protected internal.
Either way - or anything else that may choke the designer - should show up as errors in your task list. These will commonly reference a file and a line number that you can jump to (just double-click it) and see exactly what the problem is.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for your reply. But none of the suggestions applies to what I was doing. I didnt edit the designer code. All I have added to the code is a few functions at the end to shut down the app etc. I have gone thru each control and its properties and the problem is with the Location & Size properties. On commenting these out I can view it in the form designer. Uncommenting one line gives me the duplicate error even though ALL other controls have had there Size & Location properties commented out. It compiles and runs perfectly. No errors. No warnings. Its just when I view the design view. I have spent a good number of hours putting together the complicated interface and if I have to start again I'll need to be committed!!! Any help please?!?
|
|
|
|
|
First, make sure the Point and Size are fully-qualified. The designer expects this.
Second, you've made your UI. Just because it won't show in the designer doesn't mean it won't display correctly. I'd say don't worry about the designer if you don't want to redo the interface (and that doesn't insure that this won't happen again) and just hand-code it. It isn't difficult, especially once you got the gist of everything laid out the way you want it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Heath,
thanks for that. I think that is the best route. Below is an example of the code:
this.pctBtnCOCViewOrders.Location = new System.Drawing.Point(8, 135);
this.pctBtnCOCViewOrders.Name = "pctBtnCOCViewOrders";
this.pctBtnCOCViewOrders.Size = new System.Drawing.Size(86, 22);
As I said, nothing has been changed in here. But when I run the code it builds and displays the UI fine so I will hand-code it. Thanks again.
|
|
|
|
|
I get this problem sometimes.
Sometimes it's due to me doing a debug build and there's an error in my code that throws the designer for a loop. In those cases, fixing the error and re-building fixes my problem.
Sometimes though for whatever reason I get errors about DLL files from a related project (I'm working on a multi-project solution), in which case I go through each project's obj/debug/release folders and delete all the dll's and exe's and then do a solution rebuild.
That problem annoys me to no end.
|
|
|
|
|
How can i build a form for an application which can contain the functionality of login ID and password .. ?
Winfomrs using C#
e-Wire Technologies
|
|
|
|
|
Are you looking for Windows Authentication? Or hwere the user nae and password stored in a database server? A little more detail on what your tring to do, or having a problem with.
-------------------------------
Joan
MomComputerGeek.com
|
|
|
|
|
Is it possible to use Remoting to marshal a delegate across an AppDomain?
I've successfully setup my app to marshal several objects using RemotingServices.Marshal(someMarshallByRefObj) . However, I cannot use that method on a System.Delegate type since it does not inherit from System.MarshalByRefObject .
So my next thought was to create a simple class that inherits from MarshalByRefObject and has a System.Delegate class variable. This allows me to call .Marshal on that simple class, however, on the client side after I retrieve the simple class proxy, I get a nasty serialization exception when trying to access that System.Delegate class variable. Ack!
So is there something special that prevents me from marshaling a System.Delegate type? I guess my real question is, how can I remotely invoke a method on the server from the client?
---------------------------
He who knows that enough is enough will always
have enough.
-Lao Tsu
|
|
|
|
|
I suggest you visit Ingo Rammer's Remoting FAQ[^]
Also browse around his site. Ingo basically suggests you do not marshal events across app domains. But I also know that in certain cases (internal client talking to a limited-use server) you have more options than his recommendations.
Hope this site helps.
_____________________________________________
Of all the senses I could possibly lose, It is most often the one called 'common' that gets lost.
|
|
|
|
|
You're the 2nd person to recommend something from Ingo Rammer. Fortunately my boss decided to buy his remoting book.
Yeah his FAQ helped,
If you use client activated objects, events or delegates you will quite likely encounter one of the following exceptions when running on the .NET Framework 1.1:
System.Security.SecurityException.
*Type System.DelegateSerializationHolder and the types derived from it (such as System.DelegateSerializationHolder) are not permitted to be deserialized at this security level.
*System.Runtime.Serialization.SerializationException
Because of security restrictions, the type System.Runtime.Remoting.ObjRef cannot be accessed.
Well that explains the exception I'm getting. Thanks for the pointer.
---------------------------
He who knows that enough is enough will always
have enough.
-Lao Tsu
|
|
|
|
|
Doing Deligates across application domains is difficult. Doing Deligates across Remoted app domains is nearly impossible.
Consider the basic network setup: a firewall on your end (if you don't have a firewall, why not?!) and a firewall on the Server end. Your machine passes through your firewall and hits the Server firewall on port 80 (using Http for an easy example, but it is a problem on any port) and forwards the traffic to the real machine "Server". The Client signs up for an event on the server through an exposed deligate/event. The event happens but how does the Server cross the firewall on your end to contact your machine? Sure you can forward ports but that only works for you machine. If you have many machines behind your firewall all trying to access the Server all wanting to use the deligate, then you are sunk because the Server has no idea how to initiate a connection to your machine.
If you are on an open network (say an intranet) and all computers are peer-to-peer you might have a chance. You have to shift your strategy from a client-to-server to a double client-to-server. Your client contacts the server. The server in turn becomes a "client" broadcasting the event to your client's "server".
I personally would avoid using deligates/events across remoted application domains. It generates overhead an complicates transations (what happens if your client crashes but the server fires an event?). I would try to isolate all deligates/events on one side or the other of the remoted application domains. The key here is to make a design that is clean. When your application straddles application domains you need to keep the application domains "clean" or you introduce instability in one side or the other.
|
|
|
|
|
Background of my goal:
I've been asked to simulate a mdi in a mdi to do this i'm trying to limit a user from moving a form beyond the bounds of what will be considered the a main form (keep in mind the parent is not mdi just and owner and it has to be that way)
My desire:
I want limit a windows movement to an area i set in code. I been able to do this by set the location property when it hits a boundary but this causes a lot of flicking. I tried setting the capture property to false but that then the form snaps back to its orginal position before the move. So thats where i am. I either want to be able to stop the form from flicking or stop it from snapping back the orginal position. any help is greatly appreciated.
|
|
|
|
|
I've never tried to keep a window position from going too far to the top or the left, but the WM_GETMINMAXINFO message and the related MINMAXINFO structure were designed to limit sizing and maximized window positioning. Check that out. It may be the solution you need.
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.
|
|
|
|
|
How do I get started in writing an application that monitors a POP3 email server. Which simple windows POP3 server can I download for free.
This Email monitor is TCP/IP (usually tray) applications that notify the user if there is an email waiting on the mail server. The application uses POP3 protocol to check email in a specified time intervals. User is able to setup multiple accounts and view sender names, subjects, dates and message sizes. Program should have a spam control, and option to delete selected messages without downloading them from the server.
Software Tools:
Any windows POP3 Email server,Microsoft Visual Studio,C#
OS:windows 2000
Help:What books & tutorials recommended
Shaaba Shaaba
|
|
|
|
|
There's a lot of articles here on CodeProject that discuss this already. Try a search[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|