|
Something like that, but the threads have no GUI.
How can I achive a message pump ??
codito ergo sum
|
|
|
|
|
hi
i need to convert the poiners in c++ to C#
how can i do it ?
for example i have this code in c++
and the main problem is with the *Word
i need to use the same funtions (i have dll for the them)
but i have problems with the variables or parameters
void *StopMemory;
int ErrorCode;
int LanguageID = 1;
int CharCodeID = 1;
char *Word = "the";
ErrorCode = ExtrCreateStopMemory(&StopMemory);
ErrorCode = ExtrAddStopWord(StopMemory,LanguageID,CharCodeID,(void *) Word);
hope somebody will help me
thanks
eyalso
|
|
|
|
|
To use pointers in C# you have to put them within a class defined as "unsafe" through the unsafe keyword.
|
|
|
|
|
the unsafe keyword can also be used inside a function
unsafe
{
//code with unsafe pointers
}
be sure to use the -unsafe compile option when building!
|
|
|
|
|
Marshal, Marshal, Marshal
You can use Managed C++ or C++/CLI to wrap the native code or use P/Invoke from C#.
|
|
|
|
|
Hi, to make my code readable I'd like to write a reference to a variable that is embedded in a structure. For instance,
double Xmax = Xset.Xmax.X
double Xmin = Xset.Xmin.X
where Xset.X{}.X is a double itself. The code I just write above returns a copy. In c++ I'd just assign a pointer to .X and use Xmax or Xmin thruout the code. Changes to Xmax / Xmin in that case change Xset.Xmax.X etc.
Is there a way in C# to set Xmax / Xmin as a reference to the .X values?
Thx.
|
|
|
|
|
You're asking for reference semantics on value types. You can do this between methods using the ref keyword:
int i = 5;
MyFunc(ref i);
void MyFunc(ref int someInteger)
{
someInteger = 10;
}
But in order to get reference semantics throughout any piece of code, not just between methods, you have 2 options.
1. Use unsafe code. Just as it is in C, you can use pointers the same as you would in C. Only caveat is that you need to compile with the /unsafe switch, and also mark code that uses pointers with the unsafe keyword. For example, the following is perfectly legal C# code:
unsafe
{
double someVal = 200;
double *c = &someVal;
}
2. Use a wrapper class to wrap your value, thus automatically giving it reference semantics:
public class Wrapper<T>
where T : struct
{
public T Value;
}
Wrapper<double> Xman = Xset.Xmax.X;
Wrapper<double> Xmin = Xset.Xmin.X/
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Connor's Christmas Spectacular!
Judah Himango
|
|
|
|
|
No, you can't reference a value type.
You can get a pointer to the values, but that would cause two nasty things:
1. You would have to use the fixed keyword to fix the object in memory. The garbage collector doesn't really like if you fix objects for a long time, as it wants to move stuff around sometimes.
2. You would have to use the unsafe keyword whenever you would access the values, or make the entire code unsafe (which is an extremely bad idea).
If it's only the simplicity in the code you are after, just declare properties to access the values:
private double Xmax { get { return Xset.Xmax.X; } set { Xset.Xmax.X = value; } }<br />
private double Xmin { get { return Xset.Xmin.X; } set { Xset.Xmin.X = value; } }
---
b { font-weight: normal; }
|
|
|
|
|
To both of you,
Thanks for your clear responses. I particularly like making Xmax and Xmin local properties... didn't think of that.
I think I'm good to go now.
|
|
|
|
|
How do I send Arguments to an executeable?
Any help is appreciated.
<marquee bgcolor="#000000" loop="-1" scrollamount="6" width="100%">
Wacky waving inflateable arm flailing tube man!
|
|
|
|
|
It depends, do you want to send an argument during debug, or for a 'released' exe?
If you are debugging you want to go to your projects properties (not the solutions) and under the 'debug' tab there's a textbox for 'Command Line Arguments'.
For use with an actual exe, create a shortcut to the exe, open the shortcuts properties. There will be a textbox titled target (in winxp). put the path that's in the in quotes ("path\to\exe") and then you can put any arguments behind that.
|
|
|
|
|
|
|
Hi All!
I have a problem on my PC, when i am trying to send email i get an error, a very large one, what the hell is the problem( i dont use outlook on my PC, is it relevant?)
use: System.Web.Mail.SmtpMail.Send("y@hotmial.com","y@hotmail.com","Test","Test");
error: System.Web.HttpException: Could not access 'CDO.Message' object.
Thanks
and another small thing, i wrote a function in my html page, i did:
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
now i got the page that i wanted, how can i use this object in my C# code page?with document?how?
Thanks again
|
|
|
|
|
Just guessing here, but did you set the SmtpMail.SmtpServer property correctly?
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
what do you mean?
i do not know what it this? and where i cahnge it?
|
|
|
|
|
yes i did!!
sorry, did not know that you mean about the function.
my Bad.
|
|
|
|
|
|
I can see that you are new to the SMTP protocol. To send an email, you need a SMTP server, which is a machine specialized in routing the email to its recipient.
SmtpMail.SmtpServer = "smtp.mydomain.com";
Do you try to do this from home or at work? If it is at home, you probably have, in the documentation from your ISP, the name of this server. If at work, ask the system admin.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
can i download it?
how do i install it?
And yes i am very new with this, i only know that at work i tried it and it went smooth as baby's BBBBB.
|
|
|
|
|
I have had the same issue before.
I would send an email message to my own account and it would work fine,
then I would open my email application and check that I got it. Which I
did. I would then close my email app and all of a sudden my application would stop working. (got the same error you're getting).
I tried everything until I finally figured out that if I re-opened my email
app it would mysteriously start working again.
It seemed to be that my email app (outlook) was taking over from cdonts
once it was opened and only a reboot would fix the problem.
Hope this helps.
|
|
|
|
|
Go to IIS
Default SMTP Virtual Server
Right click on that ...>Properties...>
Assign the IPAddress in general properties
check whether anonymous access is checked or not
Nothing is Impossible Even Impossible says I'MPOSSSIBLE
|
|
|
|
|
Hi !
I've a table with the following fields :
ID,field1,field2,field3,... and also in Form 1 , I have 2 buttons(Next,Prior) for going to the next Record or before record .
for taking a report , i have to add another form(Form2) and put a CrystalReportViewer control in it .
I want to take a report , for example when my Record number is :4 , how can i do it ?
please help me !
Thanks,
s_mostafa_h
|
|
|
|
|
I would like to increase the height of the rows in the datagrid whenever data is binded to the grid.
So, How do I get the notification whenever the datagrid is binded to a Datasource.
The DataSourceChanged event occurs only when there is a change in the DataSources value. When I bind the same datasource to the datagrid, the DataSourceChanged event won't fire.
How can this be handled.
Thanks in advance.
Subrahmanyam K
|
|
|
|
|
hi Subrahmanyam K!
try to shadow the DataSource property, like this:
public new object DataSource
{
get {return base.DataSource;}
set
{
base.DataSource = value;
}
}
hope that helps!
microsoc
|
|
|
|