|
1- Change the declaration of the import to:
public static extern uint bbox_table_get(uint parent_id, uint struct_size, [MarshalAs(UnmanagedType.SafeArray)] bb.DATA[] data, ref StringBuilder data_name);
2- If it didn't work try to put some data in your array's first element before sending it, and see if the data is the same or was it changed.
Regards
|
|
|
|
|
My colleague said:
I can’t send data_name as ref StringBuilder because I get some error when function is called and it works fine if I use char []data_name so please don’t focuse on that.
[MarshalAs(UnmanagedType.SafeArray)] did not help
When I said that data is sent as const I meant that data is sent from application to dll like it’s a const and because of it, data is not returned from dll.
Because I don’t speak English very good I’ll give you an example:
DATA []data = new DATA[count];
data[0].id = 20;
char []data_name = new char[data_size];
data_name[0] = ‘t’;
data_name[1] = ‘e’;
data_name[2] = ‘s’;
data_name[3] = ‘t’;
bbox_table_get(id, (uint)Marshal.SizeOf(typeof(DATA)), data, data_name);
data[0].id = 5;
data_name[0] = ‘b’;
data_name[1] = ‘r’;
data_name[2] = ‘e’;
data_name[3] = ‘s’;
data_name[4] = ‘t’;
Now when function returns back from dll:
-- modified at 9:48 Monday 18th September, 2006
|
|
|
|
|
Hi All,
I have a web application and I would like to download video files i.e. .flv or .wmv files from a web site, for example, youtube or google programmatically in my c# code. If you know how to do this please respond to this message. I appreciate your help. Thanks.
-- modified at 19:23 Thursday 14th September, 2006
|
|
|
|
|
Are you saying you want to offer video files to be viewed on your website, direct from your web servers hard drive? Or a way to retrieve video files from google video and YouTube to be used in your application some how?
Sunday Ironfoot
www.dominicpettifer.co.uk (work in progress)
|
|
|
|
|
Similar to something I posted a few messages up... you'll want to modify this to be a bit more asynchronous, especially if you're downloading large files like videos. This function downloads the contents of the web file and stores it in a temp file and returns the temp file name.
public string GetWebFile(string url)
{
HttpWebRequest webRequest = null;
HttpWebResponse webResponse = null;
Stream responseStream = null;
FileStream fileStream = null;
string filename = "";
try
{
webRequest = (HttpWebRequest)HttpWebRequest.Create(url);
webResponse = (HttpWebResponse)webRequest.GetResponse();
responseStream = webResponse.GetResponseStream();
filename = Path.GetTempFileName();
fileStream = new FileStream(filename, FileMode.Append);
int bytesRead = 0;
byte[] data = new byte[1000];
do
{
bytesRead = responseStream.Read(data, 0, 1000);
fileStream.Write(data, 0, bytesRead);
}
while (bytesRead > 0);
}
catch (Exception e)
{
MessageBox.Show("Error : " + e.Message);
}
finally
{
if (fileStream != null)
{
fileStream.Close();
fileStream.Dispose();
}
if (responseStream != null)
{
responseStream.Close();
responseStream.Dispose();
}
if (webResponse != null)
{
webResponse.Close();
}
}
return filename;
}
|
|
|
|
|
Hey
I have created a StreamWriter and an excel object and as far as I sew after creating the excel object part of the StreamWriter changed to null.
Did anyone had a similar issue ?
Clint
|
|
|
|
|
If memory is being stomped, it's being stomped by Excel in C++ and not by C#, per se. How does part of the object turn to null ? Which part ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
The leak was in the object StreamWriter, BaseStream and Encoding became NULL.
Thanks,
Clint
|
|
|
|
|
|
How do I return Key-Value collection from a web service..
Is there any object I can make use of directly
Thanks
Jo
JO
|
|
|
|
|
Hi All,
I have a XML string with me in the format
<row xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SEQNO>6</SEQNO>
<B_CO_CD>H</B_CO_CD>
<B_AREA_CD>K</B_AREA_CD>
</row>
the XML tags are taken in an actual string variable and then I need to find a particular tag and get its value to actually set that value in a dataset column that corresponds to this tag.
How can I do this ??
Pls guide me.. I need to give demo on this..Pls Pls
Omkar
|
|
|
|
|
If I understood you correctly and you have a string variable that contains the given Xml, you could create a XmlDocument object and populate it with the Xml contained in the string using its Loadxml method. Afterwards use e.g. SelectSingleNode method to access the wanted data.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Is there a way that a method can get access to the name of the class that called the method?
Say I have a 'CoolConsoleApp' class that calls the 'DoStuff()' static method inside the 'MyUtils' class (MyUtils.DoStuff()), how could DoStuff() retrieve the class name 'CoolConsoleApp' at runtime? Cheers!
Sunday Ironfoot
www.dominicpettifer.co.uk (work in progress)
|
|
|
|
|
Take a look at the StackTrace class. It'll give you access to the StackFrame s your method was called by.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Sweet! That seems to have done the trick, for those interested I came up with the following code from mav's suggestions...
public static void StackFrameTest()
{
StackTrace trace = new StackTrace(true);
StackFrame frame = trace.GetFrame(1);
string x = frame.GetMethod().DeclaringType.Name;
}
Use a break point on string x and you'll see that x holds the class name of the method that called the StackFrameTest() method.
Sunday Ironfoot
www.dominicpettifer.co.uk (work in progress)
|
|
|
|
|
Hi All,
I have a problem with saving encrypted data into SQL 2000 server.
The user suppose to register with new password and the password
encrypted and save into DB. However, it "CONVERT" some chars into
"?" or "empty square ". Any idea?
Thanks
|
|
|
|
|
Those are characters whose values (unicode) are not mapped in your current display font. The actual binary data is unchanged, its just that the binary value doen't correspond to a legal character in the font set.
|
|
|
|
|
Buy why it gave me error if I used the same password to login into the form.
sql server somehow change the char to "?" or "empty square" char?
|
|
|
|
|
Are you making sure to encrypt what the user types in to log into the system (with the same key) and comparing the two encrypted values? What type of encryption are you using, Semetric (Blowfish, 3DES) or One-way Hashing (MD5, SHA1)?
Sunday Ironfoot
www.dominicpettifer.co.uk (work in progress)
|
|
|
|
|
How are you storing that data? Assuming your character is unicode, you'll need to store your data as type NVarChar or NText.
|
|
|
|
|
i have listview with multi colum
when i add item i see it at the botton
now
1- how make the scrol of the the listview always at the botton
or
2- how can add item to the top at all item in the listView
Palestine
|
|
|
|
|
TAREQ F ABUZUHRI wrote: 1- how make the scrol of the the listview always at the botton
myListView.EnsureVisible(myListView.Items.Count - 1);
TAREQ F ABUZUHRI wrote: how can add item to the top at all item in the listView
myListView.Items.Insert(0, theItem);
|
|
|
|
|
I just picked up this client who wants me to design and build a data base application for them and i have no problem with that. I was just wondering what is a good gird control to use with C# and SQL
Thanks in advance
|
|
|
|
|
Have you looked at the built-in System.Windows.Forms.DataGridView ?
|
|
|
|
|
Yes I have looked at it a little bit but i could not figure out how to resize the coulms
thanks
ryan
|
|
|
|