|
Hey.....Please do not try to be smart.....
Those who are posting the problem in the forum, first try to get the info using Google..
If you have some suggestion, you are welcome.
Otherwise..please do not kill the thread.
|
|
|
|
|
I posted a link containing all references to articles on codeproject that have to do with XP Visual Styles. I wasn't trying to be a smart ass; I suggest you read some.
Any remotely useful information on my blog will be removed immediately.
Judah Himango
|
|
|
|
|
hi,
i have a big problem concerning reading the Barcode , As after i design it it fails at the test as it dosn't meets the standards so if anyone has any idea about a refrence to that standards plz send it to me
thanx in advance
|
|
|
|
|
|
In my C# code:
public class Win32
{
......
[DllImport("Setupapi.lib", CharSet=CharSet.Auto)]
public static extern IntPtr SetupDiGetClassDevs(
[In]System.Guid ClassGuid,
[In]string Enumerator,
[In]IntPtr hwndParent,
[In]int Flags
);
......
}
public class usbdevice
{
......
hDevInfo = Win32.SetupDiGetClassDevs(Win32.GUID_DEVINTERFACE_USB_DEVICE, //usb class GUID
null, // Enumerator
Win32.DIGCF_PRESENT | Win32.DIGCF_DEVICEINTERFACE); //flags
......
}
when invoke the SetupDiGetClassDevs(),a error occurs,it says:
"An unhandled exception of type 'System.DllNotFoundException' occured in usbdevice.exe"
"Additionas information:Unable to loas DLL (Setupapi.lib)".
what's the problem?
Thanks!
new IntPtr(null),
|
|
|
|
|
.NET wants you to import the DLL, not the LIB:
[DllImport("Setupapi.dll", CharSet=CharSet.Auto)]
|
|
|
|
|
Good day to all!
My boss wants my windows form NOT to be shutdown by users using the End Task in the task manager. Is there a way to solve this problem? If none, is there a way that if my Windows App is terminated using task manager's End Process, Windows will automatically open again the application or worst shutdown windows perhaps. In-short, the application must always run on the users computer, after logging-in, and theres no way for the users to turn-off the application.
Thanks and sorry for my bad english.
|
|
|
|
|
There's no way that I know of to do what you want. You can write another app that checks every now and then if your app is running, and if not, it restarts it. But the user can kill that app.
I would recommend you to write a service. They run in a system account (not just for the logged user) and to manipulate them (start, stop and so on) the user requires administrative privileges.
Search CP for some examples of writing services.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
|
I'm not entirely sure, if this would help against "End Task", but try canceling the closing event:
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
}
www.troschuetz.de
|
|
|
|
|
I don't know if it will work or not but you can try overriding the wndProc and intercepting the shutdown message that windows sends to your app.
There is a message called WM_QUERYENDSESSION
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x0011)
{
}
base.WndProc (ref m);
}
I don't know how you can stop it closing from there but you could
always re-open your app.
You will have to check that WM_QUERYENDSESION is the message that is called though. If it's not then try searching through the windows header files, one of them has a list of different messages.
Hope this helps.
Kev
|
|
|
|
|
Technically, no there is no way to that. End Task goes to great lengths to see if your app will shutdown on it's own first, and when all else fails, it will force your app closed and release your processes memory. Note, I didn't say open resources and handles!
There is an exception to this. If your app was being debugged at the time, it usually can't force your app closed.
I don't know of any examples of this technique being used, or any other to stop this from happening. It just seems like a BAD idea. Probably why you don't see the technique laying around all over the 'Net.
The workaround is a monitoring app like the others have posted. But, there is nothing stopping the user from terminating that either.
As for everything else you posted... These sound like the requirements for a Service app.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have some crystal reports that are shown in pdf format to allow for printing. My problem is that I am not sure how to change the default location that they are generated in. Eg, in WinXP the location is in the iusr temp folder, and Win 2003 its in c:\windows\temp
I want to specify a folder in which the temporary files can be created, instead of allowing it to do as it pleases. The code I am using is:
DataSet ds = rt.transListingGetByMeterNo(MeterNumber);
ReportDocument rep = new ReportDocument();
rep.Load(Server.MapPath("Crystal\\transactionListingRpt.rpt"));
rep.SetDataSource(ds.Tables[0]);
MemoryStream oStream;
oStream = (MemoryStream)rep.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(oStream.ToArray());
Response.End();
|
|
|
|
|
Hi,
I have developed a chat application (Chat client and Server both) in c-sharp. I have used Sockets to communicate between client and Server.
Now I want to give functionlity in my chat client to connect via proxy server. I have to support the following proxy types i.e.
- HTTP 1.1 proxy
- Socks ver 4
- Socks ver 5
I want to get an idea that in order to support for proxy (specially for HTTP 1.1), will it affect the the way I am reading and writing to/from client-Server applications. Or I only need to write routine to connect via proxy and rest of the code will be same.
Please let me also know if anybody has any sample regarding this.
Regards,
Kamran
|
|
|
|
|
|
is there anybody out there, who knows how to use a variable in HTML which was defined in c#.
in c# i use the variable EmbedText.Text=this.openFileDialog();
i want to use that same variable in HTML e.g. <html><value=mms://StreamServer/EmbedText.Text></html>
Jug-Head
|
|
|
|
|
public virtual void Sort(
IComparer comparer
}
public virtual void Sort(
int index,
int count,
IComparer comparer
)
My arrayList contain some objects. Why the first method cannot sort the entine list but the second one can? (calling the second one by input 0, myList.Count, myComparer).
|
|
|
|
|
Assuming you are using an adequate comparer, the first one sorts the entire ArrayList whereas the second one sorts the specified portion of it.
If you specify a null comparer, both the methods use the IComparable implementation of each element.
If the results you are getting differ, please post your code.
Salil Khedkar [^]
|
|
|
|
|
Hello,
I'm having trouble with an exception I get from nowhere in my code.
My application is a Point-of-Sale for a car wash. I have the carwash packages in comboboxes, and a DataGrid for any additional products the customer may want (for example bottles of water o phone cards or whatever.) When the cashier enters a product code in one of the columns of the datagrid, the program automatically fills the description and price columns. Then I register the sale, and clear the data grid with
if(ds.Tables[0].Rows.Count > 0)
ds.Tables[0].Rows.Clear(); and everything goes fine.
If I don't enter any additional products (the DataGrid is empty, and the DataTable may contain rows, but in detached (or deleted) state), when I try to clear the sale, I get an ArgumentException. The strange thing is that it doesn't come from my code.
The text of the exception is as follows:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.ArgumentException: DataGridRow cannot have a negative row number.
Parameter name: rowNumber
at System.Windows.Forms.DataGridRow..ctor(DataGrid dataGrid, DataGridTableStyle dgTable, Int32 rowNumber)
at System.Windows.Forms.DataGridAddNewRow..ctor(DataGrid dGrid, DataGridTableStyle gridTable, Int32 rowNum)
at System.Windows.Forms.DataGrid.OnLeave_Grid()
at System.Windows.Forms.DataGrid.OnLeave(EventArgs e)
at System.Windows.Forms.Control.NotifyLeave()
at System.Windows.Forms.ContainerControl.UpdateFocusedControl() It's driving me crazy. Does anyone have any ideas?
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Why do you clear the table in the first place? I take it you're updating your containing DataSet using a DataAdapter derivative? If so, the table gets is not referenced when you 'new-up' another DataSet . You could just set DataGrid.DataSource to null .
Debug your code and see on what line (or after what line, since you're clearly not in the stack trace) or with what action this exception actually happens. This is common, for example, when you insert a new row into the DataGrid then update your data source using DataAdapter.Update . Your SQL INSERT statement (the DataAdapter.InsertCommand ) should be a compound statement with a SELECT after it to re-select the data you just inserted (using the wizard, VS.NET will do this for you) so that you get the right keys (important with identity columns and incremental columns - your basic PK fields). But you don't seem to be doing that so I'm a little confused. The other information I requested above may help.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Heath Stewart wrote:
I take it you're updating your containing DataSet using a DataAdapter derivative?
No. I'm enumerating the rows in the DataTable and updating the database manually because the data presented to the user is not exactly the same as in the database (not a perfect design, I know, but no time to change it now.)
When a sale is registered, all the controls are set to disabled state, and the DataGrid to read only, which allows the cashier to review the sale, and either cancel it or start a new one.
I have a button labeled Clear Sale that when clicked should clear the table (and the other controls, as well as enabling them) Setting a breakpoint at the very first line of the handler for that button's Click event is worthless, since the exception is thrown before, as the DataGrid is losing focus (clicking on another control proves this.)
After I click Continue on the exception dialog, nothing happens. And when I click that Clear Sale button again, everything works as expected.
The only difference I can see between the first and second clicks on the Clear Sale button is that the empty row (for add new record) isn't displayed the second time.
First time (before the exception):
http://www.luisalonsoramos.com/ww1.jpg[^]
Second time (after the exception):
http://www.luisalonsoramos.com/ww2.jpg[^]
What do you think?
Thanks in advance!!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Luis Alonso Ramos wrote:
No. I'm enumerating the rows in the DataTable and updating the database manually because the data presented to the user is not exactly the same as in the database (not a perfect design, I know, but no time to change it now.)
That's what views and stored procedures are for.
Luis Alonso Ramos wrote:
What do you think?
There's a lot of things this could be. One thing you could do is create a strongly typed DataSet in the designer and set the PK DataColumn to auto-increment or something. You can also do this programmatically yourself if you don't want to define a new type (that's much easier, IMO). That way when a new row is created it will have a unique PK. If - while enumerating the rows and updating the database yourself - you don't want to use that PK (and you probably won't) then fine. But it's existence is there for when the DataGrid validates the data (which happens when the row is committed, which is, eseentially, when it loses focus - which of course happens when the DataGrid loses focus).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks for your quick reply (as always!).
I'm going to add that PK you mention, but in the meantime, I'll give you some more facts:
* I can trap the exception if I derive my own DataGrid and override the OnLeave handler. When I get the exception, the Click event for the Button never arrives. If I give the focus again (after the exception) to the DataGrid (by clicking on it) and click again the Clear Sale button, the Click event for the Button doesn't arrive either, but this time I get no exception.
* If, before calling the base class, I remove set ReadOnly to false , I get no exception, but still the Click event for the Button is swallowed.
* When the user adds a record to the table, and then deletes it (or if he types an erroneous product code, the row is deleted programatically), the record is still somehow in the table with the status set to Deleted (or Detached, would you explain me the difference?). This was giving me trouble until I found that out, and when enumerating the records, I skip Deleted and Detached records.
* I still get the exception if there are Deleted or Detached rows only (if I type a wrong product code, and then leave the table empty.)
Heath Stewart wrote:
That's what views and stored procedures are for.
I know. I've learnt a lot about SQL Server and ADO.NET recently, but when I started this project, I hadn't read as many books!
Thanks again,
-- LuisR
EDIT: I added the primary key to my DataTable , I still get the exception.
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Luis Alonso Ramos wrote:
the record is still somehow in the table with the status set to Deleted (or Detached, would you explain me the difference?).
As I always say, read the documentation: http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDataDataRowStateClassTopic.asp[^]. It's these sort of simple questions ("What does X do?") that are easily answered by the documentation.
If you want to get the changes that have been made to the underlying DataSet , use DataSet.GetChanges (optionally specifying the types of changes you want to get).
Luis Alonso Ramos wrote:
I know. I've learnt a lot about SQL Server and ADO.NET recently, but when I started this project, I hadn't read as many books!
I've read almost no books (and I usually skim the once I do evaluate or read). Reading the documentation is essential. Digging into the implementation (since managed languages compile to Intermediate Language (IL), you can easily read them using ildasm.exe (from the .NET Framework SDK) or .NET Reflector (a decompiler and disassembler). Digging into the DataGrid and its related classes (like how it uses DataGridTableStyle s and DataGridColumnStyle s can really help understand how it works.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Heath Stewart wrote:
I've read almost no books
I find books useful, not to teach how to do something, but to tell me that something exists in the first place. Most times I read books and learn about something and then forget, and whenever there's a need for that feature, I remember and then go search in the docs (or in the book.) It's just not good when you face a problem, and solve it somehow with a thousand lines of code, when there was this class that you could have used and achieved the same result with just fifty lines.
This app I'm fixing right now was my first Windows Forms application, so there are a lot of things I would do different if I were to rewrite it.
Heath Stewart wrote:
.NET Reflector (a decompiler and disassembler)
Great tool!! Finding it was worth the day!!
At least I found exactly where my exception is coming from. Tomorrow I'll try to find a workaround!
Once again, thank you very much for your time,
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|