|
Hi Mika
Well thanks a alot for the fast reply. But its not that which is causing the problem that im sure, coz if i have the printer installed its working fine.
|
|
|
|
|
if I'm correctly understanding this snippet of code as using shell commands to do the printing, what happens when you enter the commands on the command line (or the start-run box). Also, assuming my assumption is correct, and it fails on the command line; a shell programming forum would be morel likely to be able to help.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Hi dan
Well ya maybe you are right with the forum, but i just tried it..
Back to my problem, i tried the code on my work laptop which is in the correct domain. And there it was working perfect. So my assumption is that i have to be in the correct domain for this code to work, i have tested the code in my IMAGE and there im not in the domain, so when i open word manually and want to print some word document to that partically printer which was also given in my codesnippet it wont work coz i cant find the printer. And like i said if its running on the laptop its working perfect. Could it be a domain problem? Im just a bit insecure coz the notepad file could be printed with no problems that why im struggling.
Ok well i hope i can solve this problem soon. Would like to hear some feedback abt the domain solution.
Thanks again for your fast reply
|
|
|
|
|
Good People,
I have a quick question.
I need some activities performed by a separate thread in my application. However, I need the main thread or another thread to be updated on progress and changes since that will affect the information they display and how they process some additional tasks. I need to know the best way to accomplish this task.
Any help or information you can provide would be greatly appreciated. I am a noob to threading and while I did get another thread to work, I couldn't get any updates in the main thread. So any help would be great.
Thanks in advance.
BP
|
|
|
|
|
Have alook at Manual Reset Event[^]
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Did you check the BackgoundWorker class? It does all the dirty work for you. There are a number of nice&simple articles here on CP.
|
|
|
|
|
Obviously, he hasn't checked anything. If he had, he wouldn't be here asking that question. He would be thrashing google to within an inch of its life looking for examples of using the BackgroundWorker class.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I like using events and event listeners for this purpose.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
i am not able to find the lotus mail to field??
Can ne1 plz help me??
|
|
|
|
|
Sorry Lotus disabled that for C#, try somewhere else.
|
|
|
|
|
Hi all,
I have a class
public class Abc
{
private UInt32 x;
private UInt32 y;
private Int32 z;
};
I need to get the size of the class.
Please help!
Thanks in Advance.
San
|
|
|
|
|
Why, what possible relevance is the size of the file. Once it is compiled it is part of an assembly and does not have a "size".
If you want the number of characters in the file open it in word or open it using a streamreader and read in tha lines,counting the characters, file size use io.fileinfo
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You cannot get unmanaged size of a class.
See this example :
Abc abc = new Abc();
int size = System.Runtime.InteropServices.Marshal.SizeOf(abc);
Console.WriteLine(size);
If Abc is a class, then you get an exception.
If you change Abc to a struct, then you get a size (12).
|
|
|
|
|
Yes I got an exception since Abc is a class.
So how is to calculate the size?
|
|
|
|
|
Using some memory profiling tools. BTW, could you tell why you are worried with the size?
|
|
|
|
|
stancrm wrote: You cannot get unmanaged size of a class.
You can if you specify the class' layout (explicit or sequential).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hi
you can use the Marshal.SizeOf(typeof(MyClass)) method in the
System.Runtime.InteropServices namespace.
regards
|
|
|
|
|
When I given as per your suggestion I got an exception as follows.
An unhandled exception of type 'System.ArgumentException' occurred in exe
Additional information: Type 'class' cannot be marshaled as an unmanaged structure; no meaningful size or offset can be computed.
|
|
|
|
|
San wrote: no meaningful size or offset can be computed.
I think you now have the answer to your question.
|
|
|
|
|
San wrote: I need to get the size of the class.
Why?
IIRC, a class like that would use 20 bytes on a 32 bit system and 28 bytes on a 64 bit system. Each object consists of two pointers plus the instance data.
As you see, the size differs depending on the version of the CLR (which determines the memory layout). Also, you have a pretty simple example. If you have members of different data types, they may be aligned on an even word boundary which may add to the size, and they might get rearranged to make best use of memory when aligned. So, it might not be possible to predict exactly how large the object can be.
Despite everything, the person most likely to be fooling you next is yourself.
modified on Monday, September 8, 2008 9:31 AM
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
public class Abc
{
private UInt32 x;
private UInt32 y;
private Int32 z;
};
int size = Marshal.SizeOf(typeof(Abc));
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
HI!! i've a problem: i have a listview, and i wont that when i click in a line, the program should show me the printpreview of that object. in the listview there are only the file path to the file(ex: C:\filename.doc) ...how can i do??
sorry for my english, i'm not very good...(i'm italian)
thank you!!
|
|
|
|
|
If I understand correctly, your listview contains a list of documents. If they are all word documents, you will possibly need to use the Office Interop and open up the documents using Word (don't use Process.Start to open the docs). Then, your application will call the Print Preview command.
|
|
|
|
|
how can i use the Office Interop??
for exemple:
private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
//what can I write here?
}
|
|
|
|
|
You'd have to import the Word automation library through the COM portion of the Add References dialog. Once that's in place, you've got the Word Interop library. If you have a google for word interop, there should be plenty of examples of the exact code you'll need for your application.
|
|
|
|