|
Luc 648011 wrote: I'm afraid you proved it true once more.
Haha, yeah I was afraid of that!
I like your idea of associating the ResetEvent with the caller - as you say, it's a lot simpler than a pooling scheme and much safer than risking the handle limit.
I think I've been looking at the forest for so long that I couldn't see the trees!
Thanks for the help.
|
|
|
|
|
There is a registry key for this, you could check it.
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\USERProcessHandleQuota
It is set to 10k on my machine, which runs XP x64 pro.
|
|
|
|
|
Hi,
I am about to start a visual studio 2005 project to create a C# class library, however, I have seen that some people uses the COM/COM+ components and they develop their libraries under COM/COM+ architecture ... they see the COM component in "Component Services" and the process as well when it is running.
I am wondering ...
What are the "pros and cons" of using COM/COM+ ? (over the standard default class library dll)
Thanks,
|
|
|
|
|
Hi,
COM offers component architecture inside and outside .NET (you can use COM from VB6 ).
COM needs extra code and care, installation, registration, has appartment issues, ...
as I always use .NET on PC, I avoid COM.
|
|
|
|
|
Thanks for the reply, I guess the only usage of COM/COM+ nowdays is to use managed code .NET from unmanaged code (VB6 for example)
Would microsoft leave this architecture in the future?
Regards,
|
|
|
|
|
IMO they seldom leave something, they may shift their focus...
|
|
|
|
|
Hi
I'm just wondering could anyone give me some pointers on where I could find how to share data between two different processes in c# at first but I might make a c++ version after when I get more experience in it. I have found two articles here on codeproject but I'm finding them a little hard to understand
article 1
article 2
If you could help it would be great
|
|
|
|
|
Hi ppl
Pls help me with a cell change problem.
I have a sourcegrid with 4 column ans 4 rows.
I can Insert data to every cell but the problem is I dont wanna use mouse or Tab to change cell. I want to use Enter key to change cell.
That mease I will insert data to a cell and press Enter key and coursor will go to next cell.
Can anyone have face this problem....
please help me
Thanks
|
|
|
|
|
SourceGrid - Open Source C# Grid Control[^]
I presume that^ is the source grid you're on about.
Something like this should work
void grid1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (grid1.FocusCell.Row == grid1.RowsCount-1)
{
if (grid1.FocusCell.Column == grid1.Columns.Count - 1)
{
grid1[1,0].Focus(); selects the first cell
}
else grid1[1, grid1.FocusCell.Column + 1].Focus();selects the first cell in the next
}
else grid1[grid1.FocusCell.Row + 1, grid1.FocusCell.Column].Focus();
}
}
|
|
|
|
|
many many thanks.
I have tried it but some error I cant understand...
void grid1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (grid1.FocusCell.Row == grid1.RowsCount-1)
//to check if you have reached the last cell in the column
{
if (grid1.FocusCell.Column == grid1.Columns.Count - 1)//checks if you have reached the
//last row in the last column
{
grid1[1,0].Focus(); //selects the first cell
}
else grid1[1, grid1.FocusCell.Column + 1].Focus();//selects the first cell in the next
//column
}
else grid1[grid1.FocusCell.Row + 1, grid1.FocusCell.Column].Focus();//selects the next cell
}
}
The Bold text "grid1.focuscell.row and grid1.focuscell.colume does not have any defination."
Cant you fix it pls
Thanks
modified on Tuesday, April 14, 2009 10:18 PM
|
|
|
|
|
put your source grid name ("grid1" change it to your grid name") there my friend.
I think you better use the key up event, that can easly handle enter or arrow keys.
|
|
|
|
|
Sorry that was my fault
You must be using version 4;
try this way:
void grid1_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
int row = grid1.Selection.ActivePosition.Row;
textBox1.Text = row.ToString();
int column = grid1.Selection.ActivePosition.Column;
if (grid1.Selection.ActivePosition.Row == grid1.RowsCount - 1)
{
if (column == grid1.Columns.Count - 1)
{
grid1.Selection.Focus(new SourceGrid.Position(1, 0), true);
}
else grid1.Selection.Focus(new SourceGrid.Position(1, grid1.Selection.ActivePosition.Column + 1), true);
}
else
grid1.Selection.MoveActiveCell(1, 0);
}
}
|
|
|
|
|
Sorry I was out of town.I have tried it but
It didnt work. Dont know why.
Do I need to use any event handler code to the .Designer.CS page?
Like this.grid1.keypress += new .....
pls make it clear.
Thanks again
modified on Saturday, April 18, 2009 11:24 AM
|
|
|
|
|
Hi
I have 2 Windows Service Question
1.Is WS can work in background ? Is it posible to do some job evry 2 minutes ? (if yes, can I get some help ?)
2.How can I install WS in simple way ? (not with Installutil.exe .......)
3.How to run .exe file through WS
i'll do this:
System.Diagnostics.Process G = new Process();
G.StartInfo.FileName = @"d:\demo.exe";
G.Start();
thank's in advance
|
|
|
|
|
1. Yes, absolutely. Use the System.Threading.Timer class. Read the documentation for the choices that are offered to you.
2. Installutil.exe is the best way. You may try to use a setup project instead, but I never tried it.
3. This seems to be correct to me.
E_Gold wrote: I have 2 Windows Service Question
You should learn how to count, that was 3 questions.
|
|
|
|
|
1) Yes. Avoid the Timer class and write a threaded timer.
2) You can't not use installutil.exe...
3) Use the Process 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 use a System.Timers.Timer
|
|
|
|
|
You get more control with a thread, and the timer events are the lowest priority events in Windows. This means that on a busy system, your app might not even *see* the event. Personally, I take no chances with that kind of stuff.
"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
|
|
|
|
|
Well then it depends on usage; the Timer does what I need it to.
|
|
|
|
|
This[^] article looks like a viable alternative
I are troll
|
|
|
|
|
1) Yes, but are you sure you don't want a Windows Scheduled Task?
2) Kinda sorta, as the article pointed out by Eddy suggests. That's how I do it.
3) Yes, but are you sure you don't want a Windows Scheduled Task?
|
|
|
|
|
Hi all,
I'm having a problem using DllImport in C# to call a C++ function.
C++ Header File:
DLLEXPORT int drawMarkupOnLine (int jobId, int lineNumber, short* line, int drawMode);
C++ Source File:
DLLEXPORT int drawMarkupOnLine (int jobId, int lineNumber, short* line, int drawMode)
{
...
}
==========================================
C# Source File:
[DllImport("vdrdll.dll", EntryPoint = @"?drawMarkupOnLine@@YAHHHPAFH@Z")]
unsafe static extern int drawMarkupOnLine(int jobId, int lineNumber, short* line, int drawMode);
...
short* scan0 = (short*)bmd.Scan0;
short* nextScanLine = scan0;
drawMarkupOnLine (0, i, nextScanLine, lca[i]);
==========================================
When I try to call the function, I get an EntryPointNotFoundException, with message, "Unable to find an entry point named '?drawMarkupOnLine@@YAHHHPAFH@Z' in DLL 'vdrdll.dll'."
I've tried various permutations of IntPtr, string pointers, and void pointers for the third parameter (which I'm assuming is causing the problem), but nothing seems to work. (Other functions with only int parameters work just fine.) Can someone suggest a reliable way to get this to link?
Thanks,
Alan
|
|
|
|
|
Hi Alan,
in C# one does not need unsafe nor short*, instead ref short would do.
since native C++ is mangling names, I suggest you try DllImport("vdrdll.dll", EntryPoint="...", ExactSpelling=true) , since maybe the marshaling is adding an A or W because of the pointer.
|
|
|
|
|
Thanks for the suggestion Luc, but I'm still getting the same result. It even happens when I use a simple local variable for the 3rd parameter.
|
|
|
|
|
It gets stranger: The problem still shows up even with all int parameters.
|
|
|
|