|
lol...ever heard of trainers? and you don't even have to go that far, just google "TSearch"...a memory searcher used to search a program's memory and change values in it.
|
|
|
|
|
|
It's not excellent...it doesn't help me ><
I still need to know how to do it \=
|
|
|
|
|
A process can only access its own memory, so you need to inject a library into the target process. I don't think you can inject the .NET runtime into a running process (though another injected library may load .NET), so what you're trying to do is probably impossible with C#. There are articles here on CodeProject that show how to do it with C++.
|
|
|
|
|
hi, I am getting this error when generating pdf docs from crystal report app (C# 2.0).
CallbackOnCollectedDelegate was detected
Message: A callback was made on a garbage collected delegate of type 'CrystalDecisions.ReportAppServer.DataSetConversion!CrystalDecisions.ReportAppServer.DataSetConversion.DataSetConverter+CrdbAdoPlusDelegate::Invoke'. This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code, they must be kept alive by the managed application until it is guaranteed that they will never be called.
I am creating pdf docs from crystal report app which is being hosted in console app. I have a report document with 6 sub reports. I am poppulating these sub reports on the report document by pushing a datatable/dataset. In doing that, I am instantiating report document once as a global variable. Then each next pdf doc will be using that same report document object but I am loading a new report doc every time new report(pdf doc) needs to be generated.
After about 20 to 30 docs are generated I get error listed on top "CallbackOnCollectedDelegate was detected" with detail description also provided earlier.
Reading this error made me think that if I put some kind of delay (1000 miliseconds) before loading report, it would help but did not solve my problem. It did went further than 20 to 30 docs to 104 docs but that error did come back.
I would appreciate if some one can shed some light
Thanks
Needy
|
|
|
|
|
Hi,
the message is clear: some code is calling back on an object that no longer
exists. This happens because the PDF reporter is still using some event, while
you are changing the report document.
In simple sequential situations, a useful work-around may be to keep the previous
document alive, so the following pseudo-code may show what I mean:
DOC myDoc;
DOC myPreviousDoc;
void doMyDocuments() {
while(moreDocumentsToDo) {
myPreviousDoc=myDoc;
myDoc=new DOC();
... attach delegates
... process document
}
myPreviousDoc=null;
... maybe more processing
}
|
|
|
|
|
If I do this, do I need to put the 1000 milisecond detail between two report processing? And, would it release the resources or just give it some time to process the events?
The reason why I am questoning this approach is that, i am looping through list of records and checking if data exists. Before doing this, i am setting loading report document in to the variable i have already decalred and using it. So if data doesn't exist for perticular id then I am immediately skipping that perticular record and get the next record from the datatable and try to process that record (and once again, I will load the report document in to the report document object I was using before).
Also, If I recreate the report object by doc = new doc() when I am looping through it takes a lot of time to process the whole list.
Is there another way where I can use the same doc and still not get the error.
Like
declare ReportDocument doc = new ReportDocument() as global variable within class then use this doc in the methods but keep loading different docs in to this same object so we can do away with reinitializing the reportdocument object and processing would be faster.
Also, problem with creating a new report object is that, crystal report has limitation of number of new object set to 75 (named PrintJob limit which is registry entry item). I tried changing the limit to 1000 to 10000 and still didn't help so then I tried instantiating report object only one during whole process and just loading a different document everytime I need a new report to be generated.
Please elaborate.
-- modified at 16:38 Monday 16th April, 2007
Thanks
Needy
|
|
|
|
|
OK, then what about this:
have two documents (instead of one) and use them in ping-pong
so code could be like this:
DOC doc1=new DOC();
DOC doc2=new DOC();
void doAllDocs() {
while (moreDocs) {
DOC temp=doc1;
doc1=doc2;
doc2=temp;
... handle one document, using doc1 (dont touch doc2 at all)
}
The net result is while processing doc1, doc2 is still present to get
finished.
|
|
|
|
|
This did not help, I am still getting the error:
CallbackOnCollectedDelegate was detected
Message: A callback was made on a garbage collected delegate of type 'CrystalDecisions.ReportAppServer.DataSetConversion!CrystalDecisions.ReportAppServer.DataSetConversion.DataSetConverter+CrdbAdoPlusDelegate::Invoke'. This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code, they must be kept alive by the managed application until it is guaranteed that they will never be called.
Thanks
Needy
|
|
|
|
|
OK, first thing to figure out is which delegate is disappearing.
So the main question is, do you ever create a new delegate, without assigning
it to a class member ?
The following shows good and bad situations:
class A {
EventHandler keepAlive;
public void demo() {
EventHandler dying=new EventHandler(something);
callNativeMethod(dying);
keepAlive=new EventHandler(something);
callNativeMethod(keepAlive);
}
}
The dying delegate can be collected at any time demo() has finished.
|
|
|
|
|
Well, I am not manipulating/adding/removing any delegates in my code. It is Crystal Report that is somehow removing (may be) the reference to the delegate.
I have been trying to solve this issue for a couple of days but no luck yet.
I will post my partial code tomorrow morning first thing.
Looks like you are suggesting that I am declaring the event handle in which case I am not and it is CR that is I guess collecting this delegate before execution completes or may be not being properly handled.
Please provide some kind of guidance
Thanks
Needy
|
|
|
|
|
The problem seems to be one (or more) delegate is created, passed to native code,
which preserves it for future reference, and then the gc collects it because
it is not reachable anymore in the managed world. The remedy is to make sure
there is a managed reference (hence my class variable "keepAlive").
As I expect only managed code to create delegates, if it is not your code, it must
be the managed layer inside Crystal Report (assuming they have a native code
product plus a managed layer to make it work under .NET).
But then I expect a lot of people having the same trouble (assuming they have
report jobs of similar complexity); but then it must be among the known bugs,
and maybe a fix already exists...
Having reread your original post, looks to me that post must be sufficient
to trigger the CR people ...
|
|
|
|
|
These are very hard to find, I encountered this in a System.Windows.Forms.NativeWindow class which was used to extend a Win32 app via a C++/CLR, vis afxwinforms CWinFormsControl implementation.
Where due an a coding error; the ReleaseHandle() method was not being called during the Dispose operation of the NativeWindow.
It would manifest it self most often as a crash when changing the focus to another application.
|
|
|
|
|
Hello everyone,
I would like to add few keyboard short cuts to my application and I was wondering if someone could give me some information on how to do this.
What I have done so far "which is not working!" is the following.
private void MainForm_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)<br />
{<br />
if (pendingCmd)<br />
return;<br />
<br />
if (e.KeyCode == Keys.P && e.Control == true)<br />
{<br />
playToolStripMenuItem_Click(null, null);<br />
return;<br />
}<br />
<br />
if (playState == PlayState.Init)<br />
return;<br />
<br />
if (e.Control == true)<br />
{<br />
switch (e.KeyCode)<br />
{<br />
case Keys.A:<br />
{<br />
pauseToolStripMenuItem_Click(null, null);<br />
break;<br />
}<br />
case Keys.S:<br />
{<br />
stopToolStripMenuItem_Click(null, null);<br />
break;<br />
}<br />
.<br />
.<br />
.<br />
.
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
Have you enabled the KeyPreview property of your form? If not, you'll only get events when the form is focused but none of its child controls are.
--
CleaKO The sad part about this instance is that none of the users ever said anything [about the problem].
Pete O`Hanlon Doesn't that just tell you everything you need to know about users?
|
|
|
|
|
Hi,
there basically are two ways to get shortcuts to work:
1. add menus and menu items, and give them the necessary shortcuts.
this is my preferred way, since now the user also has a visual indication as to
which shortcuts exist, and it requires no additional code: whenever the
shortcut is entered, the menu click handler is invoked (assuming the menu item
is still present and enabled in the current main menu).
2. add code to the keyboard handlers, as you are trying to do. If your code
does not work properly, add some logging (e.g. Console.WriteLine) statements
to see which parts get executed and which dont.
|
|
|
|
|
Hello.
How can i get a code of pressed key ?
One nation - underground
|
|
|
|
|
http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.keydown(VS.71).aspx
like that?
Russell
|
|
|
|
|
try this
this is a small key pressed event
private void cbfilmoname_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if(e.KeyChar==0xd)
{
mymethod();
}
}
// "0xd" means that the Key Pressed is "ENTER" key
// you can find the KeyChar of the any key with tracing this code
// or in help documents
|
|
|
|
|
Hi,
there are 3 keyboard events: KeyDown, KeyPress, KeyUp
the documentation states:
The KeyPress event is not raised by noncharacter keys; however, the noncharacter
keys do raise the KeyDown and KeyUp events.
noncharacter keys include shift, alt, control, shift lock, ...
KeyDown and KeyUp offer KeyCode, KeyChar and KeyValue properties;
KeyPress only offers KeyChar.
The rationale seems to be special characters can be recognized during KeyDown/Up,
whereas KeyPress only is fired for normal characters, where KeyCode would not
be relevant. But the KeyPressEventArgs does offer information on the state
of the modifier keys (Control, Alt, Shift).
Note: normal characters have autorepeat, the special ones dont.
Warning: the KeyPress event fires when the key gets released (or the autorepeat
delay is reached). The KeyDown event fires immediately when the key goes down.
Conclusion: if you really need KeyCode, use KeyDown event.
|
|
|
|
|
Thanks to all for their answers !!
One nation - underground
|
|
|
|
|
Hi all,
in C++ handle is created something like this
CLASSNAME::create("abc", handle);
So how to do the same task in C#.NET
thanks
|
|
|
|
|
A handel is just a pointer to something. Usually a void*
Software_Specialist wrote: CLASSNAME::create("abc", handle);
In C# you'd do this as a static method on a class
public static void Create(string someValue, out object handle)
{
}
Now, if you want to know about this for some interop stuff then a handle is usually an IntPtr in C#
However, this is less than best practice for a .NET application. If you are not doing interop, but you want a factory method you are better doing something like this:
public static Classname Create(string someValue)
{
Classname result = new Classname();
return result;
}
|
|
|
|
|
This is probably the simplest question I have ever asked, but is there a way to make all classes derived from a base class with mandatory override? Ex: I have a class called MyClass123 which has a protected virtual void MyFunction(). When I derive a base class from MyClass123 I don't have to override MyFunction(). Is there a way to make the derived class require MyFunction() to be overwritten?
Chris
|
|
|
|
|
Hi Chris
try 'protected abstract void', you don't implement the function body and the whole class must be abstract.
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|