|
The Catalyst wrote:
So basicaly, I'd like to find the translation guide.
There is no "translation guide". Translation is done by knowing the Win32 APIs and the .NET SDK well. For example, why are the HRESULT s translated to void when interoping? Because most COM error codes are thrown using a COMException in .NET, specifying the result code (these can even be used for success codes, like S_FALSE ). If you need that HRESULT , you have to attribute your method with the PreserveSigAttribute(true) , or specify PreserveSig=true in any DllImportAttribute attributed methods.
I'm talking about knowing what marshaling means and what it does, I'm talking about knowing how to use the MarshalAsAttribute , the DllImportAttribute , the StructLayoutAttribute , the PreserveSigAttribute , and the various COM-related attributes (where appropriate) effectively. You must read about these and understand them well.
Knowing which managed type to use for a native type is simply understanding the bit-length and matter of the two types. A native char is 8 bits and and unsigned char is 8 bits unsigned, just like a System.Byte .
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I use net send to send messages around a LAN. The message content i pull from the TextBox. But when the textBox contains two lines more. The net send only send the first line.
I know the net send end when it see the "\n".
But don't know how to solve. Is there anyone can help?
Thanks
|
|
|
|
|
what about trying \r, seeing windows is dumb!
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
I tried to change "\n" and "\r" but it not work.
Here my code
string txtToSend = txtBox.Text.Replace("\n", "\r")
I tested with the message:
aaaaaaa
bbbbbbb
I returned aaaaaaaabbbbbbb.
C# is a gun, Windows is a hole.
Without gun. How can you make love?
|
|
|
|
|
I dunno dude, the answer will be somewhere in the Win2k resource kit docs, but I dont have that installed. Try searching MSDN if you are brave.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
I dont have it, either. Anyway Thank for your help leppie
|
|
|
|
|
bookwormXP wrote:
I tried to change "\n" and "\r" but it not work.
Here my code
string txtToSend = txtBox.Text.Replace("\n", "\r")
I tested with the message:
aaaaaaa
bbbbbbb
I returned aaaaaaaabbbbbbb.
Try using Sytem.Environment.NewLine for your CRLF.
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
This has been answered before. Search the comments (using the link above the messages box).
Also, if you create a multi-line text box and send the content as a single string, you may, in fact, be able to do this. I answered a previous question witha programmatic way that worked similar to this but I don't remember it.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Try "\n\r" or "\r\n". As much as I remember "\n\r" is correct.
Mazy
No sig. available now.
|
|
|
|
|
I tried to create a method to open a document, but I got "The file isn't specified" error message. I debugged and saw the FileName contained like "C:\MyProject\Documents\my.doc", and it seems to be ok. Here is the code:
public void OpenDoc(string myDocumentsPath,
string fileName)
{
Process myProcess = new Process();
try
{
myProcess.StartInfo.FileName = myDocumentsPath + fileName;
myProcess.StartInfo.Verb = "Open";
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.RedirectStandardOutput = false;
myProcess.Start();
}
catch (Win32Exception e)
{
if(e.NativeErrorCode == ERROR_FILE_NOT_FOUND)
{
Console.WriteLine(e.Message + ". Check the path.");
}
else if (e.NativeErrorCode == ERROR_ACCESS_DENIED)
{
Console.WriteLine(e.Message +
". You do not have permission to open this file.");
}
}
If you find something is wrong, please let me know.
Thank you for your help,
|
|
|
|
|
um... I might be able to help...
What exactly are you sending as the arguments?
(string myDocumentsPath, string fileName)
/\ |_ E X E GG
|
|
|
|
|
For example, the arguments are:
string myDocumentsPath = "C:\MyProject\Documents\"
strin fileName = "My.doc"
I hope this helps. Thanks,
|
|
|
|
|
Um... If it still dosn't work after what Heath Stewart said....
Add a @ to myDocumentsPath ... like this...
string myDocumentsPath = @"C:\MyProject\Documents\";
does it work?
|
|
|
|
|
You create the ProcessStartInfo object, but you're not passing it to Process.Start ! Therefore, no executable name or document name is being specified in order to start it. You're just trying to start an unknown process.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I changed it as you recommend me, but I have still had the same problem, "the system can't find the file specified." If you have some ideas to fix it, please let me know. Here is the code. The string myDocumentsPath is "C:\MyProject\Documents\" and the string fileName is "myword.doc".
public void OpenDoc(string myDocumentsPath,
string fileName)
{
try
{
string tempFileName = myDocumentsPath + fileName;
Process.Start(tempFileName);
}
catch (Win32Exception e)
{
if(e.NativeErrorCode == ERROR_FILE_NOT_FOUND)
{
Console.WriteLine(e.Message + ". Check the path.");
}
else if (e.NativeErrorCode == ERROR_ACCESS_DENIED)
{
Console.WriteLine(e.Message + ". You do not have permission to open this file.");
}
}
|
|
|
|
|
Why don't you do what I said, along with what you already got from Heath Stawart. Then it will work...
/\ |_ E X E GG
|
|
|
|
|
I have a file of MIME type "application/vnd.adobe.xfdf". I need the WebBrowser to load this file from a string (without using the Navigate method).
Part of an application I'm developing has to do with reports. To reduce security problems I don't save any of the reports to disk. In the past I just loaded HTML into the WebBrowser by using the IHTMLDocument2 interface of WebBrowser.Document. I then did write() and close(). However this doesn't work anymore since I'm not loading HTML. I need to load a XFDF (PDF) document.
|
|
|
|
|
I don't know why it didn't hit me earlier. Maybe I've been working for too long and should take a break.
I'm just going to use the Arobat Reader ActiveX control
Still would be nice if you could update MIME type
|
|
|
|
|
You can use <meta http-equiv="Content-Type" content="application/vnd.adobe.xfdf"> as the first META tag (to be safe). If doing this from ASP.NET, you'd simply set this MIME type in the HttpResponse.ContentType property before writing to the response stream itself.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks Heath. I understand that part clearly. However, the WebBrowser is not navigating, therefore it is not reading any response stream. The way I was trying to do (navigate to about:blank and set the htmldoc) it just doesn't work.
I just switched to using the PDF ax ctrl. Besides its silly to have the PDF control hosted inside a webbrowser control when you don't need to navigate to anything. Just setting the src of the pdf control would work fine. (Originally I wanted to make the data more secure by not writing it to disk. I found another workaround for that)
|
|
|
|
|
Does anyone know how to drag/drop files from a C# application into Windows Explorer?
I've been trying to find an example on the web for hours - no luck
Elena
|
|
|
|
|
DataObject data=new DataObject();
data.SetData(DataFormats.FileDrop,new string[]{filename});
control.DoDragDrop(data,DragDropEffects.All);
|
|
|
|
|
Thak you!!! It works! I can finally go home
Elena
|
|
|
|
|
I need a small pdf component that does nothing more than fill a feild.
I've found nice components but the prices are through the roof. PDFKit has the functionality I need, however the pricing is just outrageous. I don't mind if the price < 100
|
|
|
|
|
Has anyone heard of Adobe XML/PDF format? XDP and XFDF. This stuff is awesome.
Take a look at these links :
http://www.adobe.com/enterprise/xml.html
http://www.planetpdf.com/planetpdf/pdfs/pdf2k/03w/defurio_pdfxmlforms1103.pdf
http://www.adobe.com/enterprise/pdfs/xml_whitepaper.pdf
This is going to be the best solution to my problem if I figure out how it works. Stilling looking for that PDF component.
|
|
|
|