|
Hi Luca,
GCHandle provides direct conversion to IntPtr (use: GCHandle.ToIntPtr() )
God bless,
Ernest Laurentin
|
|
|
|
|
I am having a problem with with printing from .Net 2.0 on HP LaserJet 1010 printers.
Occasionally (sometimes once a month, sometimes once a day) printer gets 'blocked' in such a manner that it can not print anything from .net 2.0.
When printDocument.print method is invoked, it throws InvalidPrinterException, even if printer has just been selected from printDialog. Printer is online and working (everything else can be printed on it), only printing that goes through .net is blocked. The problem seems that printer name is not recognised even if it is returned by PrintDialog, and printDocument.PrinterSettings.IsValid is false.
Even a simple example like this doesn't work:
printDialog1.Document = printDocument1;
printDialog1.ShowDialog();
// after printer gets blocked, isValid is allways 'false'
if (printDocument1.PrinterSettings.IsValid)
printDocument1.Print();
else
MessageBox.Show("Error!");
The way to 'unblock' the printer is to simply change its name (printers and faxes / right click on printer / rename) or reinstall the printer. After that printer gets unblocked and works for some time until it gets blocked again (while it is 'blocked', it can still print from other programs, only .net programs are blocked). This only happens with HP LaserJet 1010 and 1018 printers. All the other printers work perfectly. On some computers these printers get occasionally blocked, while on some computers printers work perfectly. Printers are installed with newest drivers, .net is 2.0 with service pack and computer operator works as an administrator for a local machine.
Any idea why this blocking is occuring?
Tnx in advance
Dragan Matic
|
|
|
|
|
Hey peeps
I need a tutorial for crystal reports, i found a few here but they either don't compile or they use generated code(which i intend to avoid)
Can anyone recommend a GOOD article for a reporting noob?
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
|
If you're expecting someone to provide you with a complete solution, you've come to the wrong place. No one is going to just do your work for you. Hopefully as a developer you realize this.
You can use the System.IO.Directory.GetFiles method to get a list of files at/below a particular path. Use File.Copy to copy a file. File.Exists can be used to check for the presence of a particular file.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanks for your GREAT ADVICE and answer.
|
|
|
|
|
That better not be sarcasm.
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
Krishnaraj Barvathaya B wrote: Thanks for your GREAT ADVICE and answer.
I like to give people the advice they deserve. In this case, I believe you got what was coming to you.
If you're not happy with my answer, maybe you should consider whether you asked the right question.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Recurse through the directories and look for files in them. It's pretty simple to do.
|
|
|
|
|
i have successfully deployed Sql Reports in server.I am able to view those reports with browsers but not from my c#.net windows application.If i access reports with browsers for first time then only i am able to access those reports in my c#.net windows application. plz help me on this issue.
let me know if u have any questions on this issue
Thanks&Regards
Vinay
|
|
|
|
|
How are we supposed to help you if you don't provide details of what the problem is?
Or are we supposed to guess?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
How about more elaborate details as to what your problem is?
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Hello everyone,
I'm making a program, but I'm (obviously) stuck with a problem.
I want to write a message to the current topscreen through a C# application.
For instance: when you open Microsoft Word and you type 'hello' it will double the word like this 'hheelllloo'.
The application allready knows when a key is pushed, now the only thing that will have to be done is write a message to the current top window (like word or notepad or whatever window is open and where you are typing in).
I guess that this is possible with something like PostMessage and GetTopWindow. But it won't work. Can anybody tell me what I'm doing wrong? Or can someone tell me what will work?
Thank you allready.
This is what I have:
[DllImport("user32.dll")]
public static extern int GetTopWindow(int hwnd);
[DllImport("user32.dll")]
public static extern int PostMessage(int hWnd, uint Msg, int wParam, uint lParam);
const int VK_KEY = 0x41;
const int WM_CHAR = 0x0102;
int WindowToFind = GetTopWindow(0);
Console.WriteLine(WindowToFind);
int result = PostMessage(WindowToFind, WM_CHAR, VK_KEY, 0);
Console.WriteLine(result);
The output for result is always 1.
The output for WindowToFind is different, sometimes it gives the same value at different windows. Sometimes a different value. One of the outcome of WindowToFind is 131138
edit:
Allright... finaly I found out the anwser to my problem (after hours of searching :P).
I just had to use the SendKeys class.
SendKeys.SendWait("<value>");
</value>
modified on Wednesday, March 5, 2008 5:42 AM
|
|
|
|
|
maybe GetDlgItem and GetWindowText or SetWindowText can help ?
just an idea.
|
|
|
|
|
Hi,
Am trying to implement a progress bar in an application to copy files/folders. This progress bar is meant to sho the staus of copy.
Can anyone clarify:
1. What's the appropriate method for this to implement an actual status update using progress bar?
2. Whenever I put those two threads running (Main thread and progress bar) it seems the main thread is hanged until files are copied and the progress bar is updated once the copy process is over.
I came to know that, this can be sorted out in .NET2.0 using BackgroundWorker class but what can I do for this in .NET 1.1?
Regards,
Panicker.
modified on Wednesday, March 5, 2008 5:13 AM
|
|
|
|
|
SPanicker* wrote: 1. What's the appropriate method for this to implement an actual status update using progress bar?
Run the file copying in a separate thread. This will make your GUI responsive. When the file copy progresses, you need to update progress bar value. Check this[^] to learn how you can update your controls from a separate thread.
|
|
|
|
|
Thanks navaneeth.
Regards,
Lenus.
|
|
|
|
|
Hi all, I'm currently drawing a label on the top of my controls (combos, datetimepickers and so on) to simulate a readonly state. What I want to ask is if there is a way to know wich exactly is the 'client area' of the control (that is, without the right button and the borders) either with a ClientRectangle like method (since it seems that the provided one returns the whole size) or by checking if available somewhere the sizes of the single elements (width of the border, size of the button and so on)... Someone can help me?
|
|
|
|
|
hi,
I want to add contacts in active directory.I'm able to do so.
But the problem is that they r not reflected in Address book of Microsoft outlook.
When i investigated why this is so, i found it was because of some policy.
after discussing with support guys about what they do to manually add contacts, they suggested me to use MS exchange console instead to add the contact so that it will get reflected in few minutes into address book after adding.So how do i add a contact thru this exchange server console?
I tried to search on the net but i didn't find any help.May be any of u people could help me out.
|
|
|
|
|
I need to check status of serial port that using by some application
interface with some hardware.
Becuase I need to monitor satus of this comport by create my applition by using C#.
I want to check status of that serail port about "Now still tranfer data"
or "Stop to transfer data".
Because the application that opened this port can't tell me status of it
so I need to know status of this application by check serial port.
So colud please advise me about code on C# platform
|
|
|
|
|
Hi,
AFAIK you can't tell anything about a serial port unless you (try and) open it.
Which means, if some application has opened the port in order to use it, you can't open it
in a monitoring app since the port is "in use" or "allocated", and you can't get any
information whatsoever.
Of course, if the one app closes the serial port as soon as it is done receiving/transmitting,
then the monitoring app could try an open, and report success/failure. Mind you, if it tries
periodically, it may cause the main app to fail when that wants to use the port!
Also I am afraid the above is how serial ports work on Windows, no matter what language
and framework you intend to use.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
There is an activex.exe which is written in vc++ and now i have to call some method of it through C# class library to use in asp.net 2.0
This method accepts some variant type parameters in actual and after taking reference in c#, it's show's to pass parameters as an objects with ref and also returning an object. but everytime i call this function it gives an error -i am using reflection, InvokeMember - : the exception are : Exception has been thrown by the target of an invocation and The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)) , i am not able to figure it out what's wrong with it while i am able to call the all those functions which does not required any parameters successfully .
Stack Trace:
COMException (0x80010105): The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))]
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) +2453568
System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args) +29
WebApplication1.CreateObj.mXML_Response(String xmlString) in F:\Parvesh\Projects\componenttest\WebApplication1\WebApplication1\CreateObj.aspx.cs:116
WebApplication1.CreateObj.Button1_Click(Object sender, EventArgs e) in F:\Parvesh\Projects\componenttest\WebApplication1\WebApplication1\CreateObj.aspx.cs:68
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
I also made a object array through which i am passing my values like
object myobj = new object[5]
myobj[0] = "mystring";
myobj[1] = "";
........
and passing like in : new object[] {myobj[0], myobj[1]....}
Any Help?
|
|
|
|
|
Hello everybody
My project is a C# project on VS2005.
My application communicate with external device through Serial Port.I'm using USB to RS converter whitch add another COM Port in my computer.When I connect with device through this COM Port(transmit and receive data) everythink is OK.When unplug the USB cable from PC COM Port is still open and I try to transmit data the program is generate exception(Access to the Port is denied).How can I detect when the COM Port is disappear?
Thanks in advance
|
|
|
|
|
Reposting is considered rude - please don't do it, it was only 17 hours ago you asked the same question which I have just responded to.
(Maybe you should add no-reposting to the guidelines Chris?)
Here[^]
Dave
|
|
|
|
|
It's a bit of an odd scenario since real serial ports don't tend to disappear, and it doesn't seem this possibility was taken into account when Microsoft wrote the SerialPort class: There's no event that indicates Com-port "disappearance" in it.
I guess your best option would be to start a separate thread that polls SerialPort.IsOpen every now and then: Most likely this will throw the error you got earlier when you disconnect the USB adapter, so you can catch that to see if the port's still there... Of course, you'll need to catch it at any other reference to SerialPort as well, that's just decent programming.
Alternatively, there might be a class somewhere in the .Net framework that monitors USB devices, don't have any experience with that. Could very well be a p/invoke kind of thing.
Standards are great! Everybody should have one!
|
|
|
|