I create a form inside the Dll. But it compile is not successfully.Some Error below.
" Access violation at address 004EB784 in module 'Project1dll.dll'.Read of address 00000048"
Thanks.....
You are dereferencing a nil pointer somehow. Perhaps an object that hasn't been created?
here's something i've found necessary to do this. see my example function below:
procedure DoSomething(hApp:THandle); export;
var
hDllApplication:THandle;
begin
hDllApplication:=Application.Handle;
Application.Handle:=hApp;
try
DoItNow;
finally
Application.Handle:=hDllApplication;
end;
end;
As well you should have a look here, it might help if your trouble is elsewhere ..
Forms in dll
Related
I intend to use the MapWinGis component in Delphi 10.3
There are a number of errors when compiling this component
Has anyone used this component to guide me?
I had the same problem. As fpiette told you, you should change 'result' to 'AResult' in all functions producing this error.
function TShapefile.SelectShapes(const BoundBox: IExtents; Tolerance: Double; SelectMode: SelectMode; var AResult: OleVariant): WordBool;
begin
Result := DefaultInterface.SelectShapes(BoundBox, Tolerance, SelectMode, AResult);
end
You must also change it in the interface section of MapWinGIS_TLB.pas.
Unfortunately that's not all. Compilation and linking is now possible but I got errors to register the classes TImage, TShape, TPoint, TTable, TLabel, TChart, TGrid, TField because Delphi already uses these names for classes.
So, you must rename these classes (TImage to TMWImage, etc.) in MapWinGIS_TLB.pas.
Afterwards registration of these classes is working and the component TMap should be shown in the ActiveX tab or the tab you defined.
Today i opend my Computer and i saw that my all files are converted to KODC extension file .
i think it is a ransomware can any one help me how i do resolve this .
i have attached some screenshots for help .
Please help me guys!!!
Trust me, you don't want to destroy your variable.
When you destroy a variable, you don't access it anymore.
Go ahead, try it, the code is
delete(myVar);
Instead, you should give it a new value, like so
myVar = null;
myVar = '';
setTimeout(() => myVar = ''); // triggers Angular change detection, can be useful for you
I'm not sure I understand the problem. Why don't you simply call the destroy method on your table, and then create it again the way you did it in your NgAfterViewInit method?
https://datatables.net/reference/api/destroy()
I have a List of Strings that I want to set as a parameter in a preparedstatement. This question and answer here, makes it look easy:
How to use an arraylist as a prepared statement parameter
Well, not really easy. There is still the conversion of a List, to an SQL-Array, which I found easiest to do by creating a String[] in between.
Below is my code:
PreparedStatement s = con.prepareStatement("SELECT * FROM Table WHERE Country IN ? ");
String[] countryArray = new String[countryListObject.size()];
countryArray = countryListObject.toArray(countryArray);
Array cArray = con.createArrayOf("VARCHAR", countryArray); //<--- Throws the exception
s.setArray(1, cArray);
This answer Seems to adress a similar problem, but I can't really understand how this helped solve anything. The answer is ambigous at best, stating only that:
Basically what you are wanting to do is not directly possible using a
PreparedStatement.
I've come to learn from the API Documentation that this exception is thrown if the JDBC driver does not support this method. I'm running a com.microsoft.sqlserver sqljdbc4 version 3.0. I am trying to see which versions do and don't support setArray, but I can't find the information. It is probably right in front of me, but I would really appreciate a little help on this.
How can I figure out if my JDBC's do support setArray()?
There is a procedure looking like this:
procedure blabla;
var buffer: array of byte;
begin
Setlength(buffer, 10);
Setlength(buffer, someinteger);
end
after both calls buffer is still nil <- this is my problem
I normally consider myself an experienced programmer and i use this fundamental method on various other occasions. This is driving me nuts.
Did anyone of you have similar issues in the past?
If so, what was the problem?
My code is somewhat spaghetti because i had changed any line that seemed suspicious, but here is the full code:
full procedure
#Edit:
i have this code in another part of the same project:
procedure interleaveVertexes;
var
interleavedArray: array of TVec3Coord2;
begin
SetLength(interleavedArray, vertexcount);
end;
and it works.. like it should
i was using gdb and the lazarus ide to debug and apparently..
Both of them dont like variables called 'buffer' or 'Data'.
I understand the lazarus ide internally is using gdb anyway.
Even a variable is just named 'h' wouldn't let itself be inspected properly.
i just renamed them to 'buffa' and 'howdy' and now it seems to be working.
Got there by doing old-fashioned print-debugging and storing the pointer of my array in a cardinal variable. There they were fine. (Apart from the actual content of the array)
annoingly funny
Ok, here is the piece of code where I found it strange:
printf("di consumerthread : mulai isi data, itmsg = %d\n",itmsg);
msgq->data[itmsg]=rec_data;
printf("di consumerthread : selesai isi data, itmsg = %d\n",itmsg);
What I found strange is the output:
di consumerthread : mulai isi data, itmsg = 42
di consumerthread : selesai isi data, itmsg = 98
How come the itmsg variable suddenly changes from 42 to 98 after this line?
msgq->data[itmsg]=rec_data;
Can anybody please tell me how to solve this problem and the cause of this strange output?
Perhaps msgq->data[itmsg] is an alias for itmsg. It could happen. If you inherited this code run a bounds checker on it.
What is the size of the data array? Are you writing off the bounds of it?
It is possible that itmsg is being overwritten by the assignment of rec_data to msgq->data[itmsg]. If they are declared near to each other, this is very possible.
Without being able to know for sure based only on the information in your question, the problem could be multiple threads accessing the same memory location (msgq->data[itmsg]) at the same time, without any kind of proper synchronization.
Do you have two or more threads that both use the itmsg variable? There's nothing in your code snippet that would change the value of that variable, so it looks like it must be another thread that's changing it.
If you're using threads, you'll need to protect any data that they share with a mutex.
Ok, I finally found what's wrong
Sorry if I dont give you enough info because my head is in a mess to explain it in detail..
So, what I did to solve it is:
changing all type of global variable, including itmsg, to static
and all type of procedure and function which use the global variable to static
and it solved all of my problem!
though I still dont know what's static function..
Thanks for all of your help! :D