|
OK, well, this looks like code I wrote with then Canon camera, is that what you're using ? I seem to recall having an issue like this, once. I wonder if you can put this code in a try/catch, if that would stop an exception that is currently killing the thread ?
You can also then write logging code, to see when the error occurs, or to log what's going on, in release mode.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Hello,
Yes I am using parts of the code from the Cannon SDK Wrapper class that I found here on code project because my application also has to receive input from a Cannon G9 camera.
No try-catch doesn't stop anything
How can I write logging code to see when the error occurs?
hello
|
|
|
|
|
hi i am working on an application and very much able to do work like click a button, enter text in text boxes etc. my application works only for the single page(first page). i want to click the link label on the second page after login.
|
|
|
|
|
I'm needing to have a textbox to be on top of all other controls on the form. What would be the proper technique.
This particular textbox is for emergency messages, so has to be attention getting.
I can get it to resize, enable, and disappear. But can't get it to be seen over the form controls
I've been having problems messagebox in a loop.
I'm using VS2005, C#.
Thanks
|
|
|
|
|
use the BringToFront method - does what it says on the tin!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hello Forum
I need to make a call the GetPrinterData
the parameters are
DWORD GetPrinterData(
__in HANDLE hPrinter,
__in LPTSTR pValueName,
__out LPDWORD pType,
__out LPBYTE pData,
__in DWORD nSize,
__out LPDWORD pcbNeeded
);
I have difficulties How to implement the LPBYTE in C#?
Please help
Thank you very much
|
|
|
|
|
Hey belzer,
[DllImport("winspool.drv", SetLastError=true)]<br />
static extern uint GetPrinterData(IntPtr hPrinter, string pValueName, out uint pType, <br />
out byte[] pData, uint nSize, out uint pcbNeeded);
Hope this will help.
|
|
|
|
|
|
It seems sometimes the byte[] declaration doesn't work well so if that is the case you can try changing the import declaration to:
[DllImport("winspool.drv",
SetLastError = true,
CharSet = CharSet.Ansi,
CallingConvention = CallingConvention.StdCall)]
static extern uint GetPrinterData(
IntPtr hPrinter,
string pValueName,
out uint pType,
out UInt32 pData,
uint nSize,
out uint pcbNeeded);
using UInt32 instead of the suggested byte[] seems to return "Error" status values as from the C++ application,
|
|
|
|
|
For translating C/C++ function calls, and in particular, API calls, you should always check out pinvoke.net. You will save yourself an awful lot of time.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
|
Hi,
I would like to turn one of the projects on this site into a service application - (the project "Capturing Minimized Window's: A Kid's Trick). I have followed a tutorial on how to build a service application and have inserted the classes into my application. However, it does not seem to execute these classes.
I do know that the application works because I have used the same code in an application I have built, so I do not understand why it will not work when I put it into a service application. Maybe I need to do something special with the classes?
private void OnElapsedTime(object source, ElapsedEventArgs e)
{
AddToFile(DateTime.Now + " Another entry");
this.listBoxSnap.Items.Clear();
this.pictureBoxSnap.Image = null;
this.pictureBoxSnap2.Image = null;
this.listBoxSnap.Items.AddRange(MinimizeCapture.WindowSnap.GetAllWindows(false, false).ToArray());
AddToFile(listBoxSnap.Items.Count.ToString());
}
My text files shows how the service starts/stops, shows the "Add to File" line and also shows a count of "0" for the listbox count.
I have researched Service Applications and have come across "Installer Classes" but I do not understand how to use them after having read up on them, nor do I understand if that is the problem? Do I need to call the class a certain way, can I not just simply "Insert a class" into this application like I would any other project?
Any help would be greatly appreciated.
Thank you.
|
|
|
|
|
I guess you will be getting an exception as windows service will not have an user interface (listbox and picturebox). delete below part
this.listBoxSnap.Items.Clear(); // Clears the list box
this.pictureBoxSnap.Image = null;
this.pictureBoxSnap2.Image = null;
//name space MinimizeCapture, class is WindowSnap
//In my normal application this line works great, adds the names of all the windows on my screen to a listbox
this.listBoxSnap.Items.AddRange(MinimizeCapture.WindowSnap.GetAllWindows(false, false).ToArray());
|
|
|
|
|
I have a solution working with serial port ( COM1 ) . I added a serial port module from toolbox to a form and it worked properly , but then I was asked to use this in a windows service . I added a serial port to my service and then installed the service correctly ( I am sure ) and in the event log I could see the message I wrote in OnStart() method , but I don't know why the program doesn't go to the Data_Received event of the serial port ! Can any one help me! Her's the code:
protected override void OnStart(string[] args)
{
LogEvent("TestService started !", EventLogEntryType.Warning);
}
protected override void OnStop()
{
LogEvent("TestService stopped !", EventLogEntryType.Warning);
}
-------MY PROBLEM is that this block of code doesn't run------------------
private void sp_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
LogEvent("DataReceived !", EventLogEntryType.Warning);
}
--------------------------------------------------------------------------
static void LogEvent(String Message, EventLogEntryType type)
{
String source = "TestService";
String log = "Application";
if (!EventLog.SourceExists(source))
{
EventLog.CreateEventSource(source, log);
}
EventLog eLog = new EventLog();
eLog.Source = source;
eLog.WriteEntry(Message, type);
}
|
|
|
|
|
Hi,
I don't know for sure, I suspect a service without a GUI may fail to display any problem it may have, all catch blocks that use MessageBox may become useless. Make sure there are no exceptions going unnoticed, so log them to a file or to EventLog, and make sure this works. Then go after the SerialPort problem.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
one program with "advanced regedit" (regedit33)name, can change value's type.
exe : http://garr.dl.sourceforge.net/sourceforge/regedt33/regedt33.exe
source and exe : http://garr.dl.sourceforge.net/sourceforge/regedt33/regedt33.rar
registrykey.getvalue() method does not supprt REG_NONE values
and I have an REG_NONE value and I can change this value type to REG_DWORD
in this program .
I'm looking for a way to read REG_NONE types or read them as REG_DWORD
or change type of REG_NONE to REG_DWORD and read value in C#.
some body says perform with API or P/invoke
but HOW?
Please, Somebody help me!
modified on Monday, June 29, 2009 2:25 PM
|
|
|
|
|
|
jamesband007 wrote: some body says perform with API or P/invoke
That someone was Luc[^]. Have you made any progress since your last answer?
Look here[^] for the information on the API itself. Search Google for P/Invoke example's to import the function.
In theory, an empty key would simply result in a null-value. Is there any special requirement to distinguish between empty keys and a key with no datatype?
I are troll
|
|
|
|
|
I approve. Sorry for being late to the party.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
I are almost learnin'
|
|
|
|
|
Hello,
I'm having an Outlook 2007 addin, which opens an existing word 2007 document and fills in some userdata, which I receive from Outlook.
The next step is an actionpane, which should be opened in this worddocument.
I wrote some worddocumenttemplate in VS 2008 and got everything working:
...
namespace WordDocumentTaskpane
{
public partial class ThisDocument
{
private HelloControl hello = new HelloControl();
private void ThisDocument_Startup(object sender, System.EventArgs e)
{
this.ActionsPane.Controls.Add(hello);
}
...
This HelloControl is just a userconstrol to display some items from a database.
By working hard on the Outlook addin, I can't get the taskpane / actionspane created in the opend worddocument, because I can't call the according methods.
Are there any basic ideas?
Grettings 
|
|
|
|
|
Hello,
I've finished my application in C#,
can i install it on IIS server and the users (in my company) will connect to the server through http access and will be able to user the application (i don't want the to connect to the server with remote controll).
Thanks (:
|
|
|
|
|
Is it a web or windows app? I'm assuming it is Windows so if you want it to be available for all users on the intranet you could use a click once installation, the app won't run from the server but it'll be available there for users to install.
|
|
|
|
|
You're rigth,
this is a windows application.
I'am trying to find a way that the users won't be needed to install the app on their computer because they'll have to install also the ODBC.
Isn't there any option that the users will be able to use it throught the server?
|
|
|
|
|