|
Thanks so much Guffa
But how to allocate the size of memory on the heap and return the address of memory cell(memalloc(size)) and return memory block (memfree(addr))?
I'm not good at these stuff
Pls help me to solve out.
Thanks
eric
|
|
|
|
|
As I said, the .NET heap doesn't work that way. There are no methods to allocate memory on the heap.
You can create an object that contains the amount of data you need, but you can't safely access it using pointers without using the fixed keywork to pin the object in memory.
Freeing objects in the heap is handled by the garbage collector. When you don't have any references to the object any more, it's up for garbage collection, and will eventually be collected.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks so much
I'll try now
eric
|
|
|
|
|
|
AllocHGlobal allocates unmanaged memory, not memory from the heap as the OP requested.
But then again, not all posters know what they are asking for...
---
b { font-weight: normal; }
|
|
|
|
|
Nitpicking, but the OP did not mention anywhere that he wanted memory from the managed heap
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
its me again.
im still trying to send two commands to command prompt from c#. no luck yet.
the first command needs to change the current directory path to: c:\Program files\progressive projects\progress\reporttemplates
the second command needs to run a batch file inside this directory called fop.bat
my most recent attempt is....
string command=@"\\fop.bat -xml " + "\\ClientReportCard.xml " + "-xsl " + "\\" + Convert.ToString(TempName) + ".xsl " + "-pdf " + Convert.ToString(Salon.Library.GlobalVariables.Reports_Path) + "\\ClientRecordCard.pdf";
ProcessStartInfo startInfo = new ProcessStartInfo("cmd.exe");
// /c switch sends a command
startInfo.Arguments = "/C " + @"cd" + Convert.ToString(TempPath);
// redirect messages to this program
startInfo.RedirectStandardError = true;
startInfo.RedirectStandardOutput = true;
//don't execute using shellexecute API
startInfo.UseShellExecute = false;
//Don't open command prompt window
startInfo.CreateNoWindow = false;
System.Diagnostics.Process p = System.Diagnostics.Process.Start(startInfo);
startInfo.Arguments = "/C " + command;
startInfo.RedirectStandardError = true;
startInfo.RedirectStandardOutput = true;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = false;
System.Diagnostics.Process pp = System.Diagnostics.Process.Start(startInfo);
string output = p.StandardOutput.ReadToEnd();
string error = p.StandardError.ReadToEnd();
string output2 = pp.StandardOutput.ReadToEnd();
string error2 = pp.StandardError.ReadToEnd();
p.WaitForExit();
if (output.Length != 0)
shellControl1.WriteText(output);
else if (error.Length != 0)
shellControl1.WriteText(error);
BUT with this it executes the one command and forgets the directory path and then executes the second command. In this way it can't find the batch file. please help. iv been stugling with this on for days now.
He who laughs last...
-- modified at 7:23 Monday 29th May, 2006
|
|
|
|
|
O ja,
Do any of you know how to execute a batch file directly from that file path.
I type (in command prompt)
c:\program files\progressive projects\progress\reporttemplates\fop.bat
I get an error saying:
'c:\program' is not recognized as an internal or external command, operable program or batch file.
if i can find a way to run that command with one shot i'll be fine
Please help.
He who laughs last...
|
|
|
|
|
Put it in double quotes. To see how, simply drag the bat file from Windows Explorer into a command prompt.
|
|
|
|
|
Thank you thank you thank you.
I can't believe i've been strugling with this one for little less than a week.
THANK YOU.......
He who laughs last...
|
|
|
|
|
this code:
Convert.ToDateTime(DateTime.Now.Date.ToString()).ToString("MM/dd/yyyy"+" "+Convert.ToDateTime(DateTime.Now.TimeOfDay.ToString()).ToLongTimeString());
gives this : 05/29/2006 1:39:04 P5 (what is this p5 ???)
i want PM (or AM) at the end not P5 (A5)
how should i edit my code to get PM (or AM) at the end ?
help please.
thanks.
|
|
|
|
|
try following code
Convert.ToDateTime(DateTime.Now.Date.ToString()).ToString("MM/dd/yyyy")+" "+Convert.ToDateTime(DateTime.Now.TimeOfDay.ToString()).ToLongTimeString();
rahul
-- modified at 6:53 Monday 29th May, 2006
|
|
|
|
|
Hi,
i have working with the DirectX live video capturing,
I got DirectX.Capture class from code project its working fine and it give good preview(after when i add legacyAM filter to the graph) but in the Full screen display it will get very poor how can i solve this, if any filters to be add with existing graph to get a good preview.Is here any one faced like this plz help me.
thanks & regards
ranandbe
|
|
|
|
|
hi
I want to be able to do the following:
Type mytype = MethodInfoArray[i].GetParameters()[0].GetType();<br />
mytype[] p = new mytype[5];
Is that possible?
cheers
|
|
|
|
|
You are looking for Array.CreateInstance[^]. You can use it like
Type mytype = MethodInfoArray[i].GetParameters()[0].GetType();
Array a = Array.CreateInstance(myType, 5);
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thank you ... that worked great ... but I should hae explained
The bacis problem I have is this:
Type requiredtype = getType();<br />
Object[] datafrominputs = getData();<br />
MethodInfoArray.Invoke(new Object(),new Object[]{datafrominputs});
Basically the method will take a single array as its parameter, but I need to be able to convert may Object array to the right type. What should I do?
cheers
-- modified at 7:30 Monday 29th May, 2006
|
|
|
|
|
|
Yeah I have but I get:
InvalidCastException: "Object must implement IConvertable"
I was trying to convert from an Object[] to an int[].
cheers
|
|
|
|
|
Did you call Convert.ChangeType on the array itself or did you loop through the array and call it for each element in the array? I think the first approach won't work.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
y that's an idea... when looping through I would have to store the array in type determined at runtime (using the array class, I think). How could I then pass that as a parameter?
thanks for all the help
|
|
|
|
|
Try this piece of code
static Array ConvertArray(object[] arr, Type type)
{
Array a = Array.CreateInstance(type, arr.Length);
for (int i = 0; i<arr.Length; ++i)
{
a.SetValue(Convert.ChangeType(arr[i], type), i);
}
return a;
}
Regards
Senthil
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
|
i want to develop a menu and form based Add-in for MS outlook. i have found some material but was unable to get the real way for visual studio.net can anyone please help me actually i want the complete process from developing to deploying.
Tahnks and regards
|
|
|
|
|
hello,
i have opened the txt file in the rich text box but i could not opened the doc file or pdf extension file in rich text box.
please help me to sort this out by writing some code or giving me the links of the site.
a .net programmer
|
|
|
|
|
Performacne(Speed) wise which one is best among For loop and foreach
Jey
|
|
|
|