|
Tnx a lot man, I owe you one
|
|
|
|
|
Hello,
Is there a way to create native exe from VS.NET? I have an application that would be used by a client who I don't think would have .NET framework.
- A programmer's national anthem; "AAAAAHHHHH!!!!"
|
|
|
|
|
You can't create a native exe from a .net language (without spending some money at least). If you want a native exe you'll have to write it in C++.
|
|
|
|
|
There's Bartok by Microsoft Research, but it's not available to public.
Best bet would probably be to tell them that the framework is part of Windows Update
|
|
|
|
|
I haven't seen non-commercial product but there are commercial products (like this one) that can produce native executable from .NET code.
|
|
|
|
|
i have a problem in writing a c# code for steganography detection and estimating the hidden message length for color palette images using Ezstego algorith written by J.fredrick or any other algorith if this is not availabe i need clues to begin writing the code please as soon as possible
na
|
|
|
|
|
Have you searched this site for information? Steganography on Code Project[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
I am having a couple of issues with threading. I have a button that starts a thread (dosync).
private void syncbut_Click(object sender, EventArgs e)
{
Thread syncThread = new Thread(new ThreadStart(dosync));
syncThread.Start();
}
when i add this to the method i get an error: Paramater 0 is not valid for 'index'.
private void dosync()
{
int filePathList = listView1.Items[0].Index;
}
however if i use the function inside the button (and not use a thread) i don't get an error and the function works fine. Could someone help me with this?
thanx in advance!
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
There must be something important that your didn't showed in this code (like loading items in that listView1 asynchroniously). However try to change your dosycn proc (you are accessing listView1 from worker thread which isn't good thing):
<br />
private void dosync()<br />
{<br />
if (InvokeRequired)<br />
{<br />
BeginInvoke(new MethodInvoker(dosync));<br />
return;<br />
}<br />
<br />
int filePathList = listView1.Items[0].Index;<br />
}<br />
If it doesn't help, please submit more info and I'll gladly help if I can.
c-ya
|
|
|
|
|
Hey, guys.
I'm looking for a lib, preferably something I can use via C#, that will do the text to speech thing & allow me to save it to an audio file. Anyone know what the latest, groovy (and free) tools are for such a thing?
Christopher Duncan
Practical Strategy Consulting
Author of
The Career Programmer
Unite the Tribes
-- modified at 13:22 Sunday 14th May, 2006
|
|
|
|
|
|
|
Hello,
I have a problem with this code. Signature error, but why?
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using System.Runtime.InteropServices;<br />
using System.Windows.Forms;<br />
<br />
namespace EnumerateSingle<br />
{<br />
public struct EditStream<br />
{<br />
public long dwCookie;<br />
public long dwError;<br />
public Delegate pfnCallback;<br />
}<br />
<br />
class RichEditC<br />
{<br />
public const long WM_USER = 0x400; <br />
public const long EM_STREAMIN = (WM_USER + 73); <br />
public const long EM_STREAMOUT = (WM_USER + 74);<br />
public const long SF_TEXT = 0x1 ;<br />
public const long SF_RTF = 0x2;<br />
public const long SF_RTFNOOBJS = 0x3; <br />
public const long SF_TEXTIZED = 0x4;<br />
public const long SF_UNICODE = 0x10; <br />
public const long SF_USECODEPAGE = 0x20;<br />
public const long SF_NCRFORNONASCII = 0x40;<br />
<br />
public delegate long RTFCallback(long dwCookie, long pbBuff, long cb, long pcb);<br />
<br />
public string buffText;<br />
<br />
[DllImport("User32.dll")]<br />
public static extern long SendMessage(long hWnd, long wMsg, long wParam, ref EditStream lParam);<br />
<br />
[DllImport("User32.dll")]<br />
public static extern void CopyMemory(object Destination, object source, long length);<br />
<br />
public static long EditStreamCallback(long dwCookie, long pbBuff, long cb, long pcb)<br />
{<br />
StringBuilder buff = new StringBuilder((int)cb);<br />
<br />
<br />
switch(dwCookie)<br />
{<br />
case 999:<br />
{<br />
CopyMemory(buff, pbBuff, cb);<br />
pcb = cb;<br />
return 0;<br />
<br />
}<br />
default:<br />
{<br />
return -1;<br />
<br />
}<br />
<br />
}<br />
}<br />
}<br />
}
And the Clientcode:
private void button3_Click(object sender, EventArgs e)<br />
{<br />
RichEditC.RTFCallback myRtfCallback = new RichEditC.RTFCallback(RichEditC.EditStreamCallback);<br />
<br />
EditStream es = new EditStream();<br />
es.dwCookie = 999;<br />
es.pfnCallback = myRtfCallback;<br />
<br />
RichEditC.SendMessage(0x80524, RichEditC.EM_STREAMOUT, RichEditC.SF_TEXT, ref es);<br />
<br />
}<br />
<br />
public long FARPROC(long pfn)<br />
{<br />
return pfn;<br />
}
Is "ref es" written in the wrong way? MSDN says that LPARAM for this SENDMESSAGE Action is a Structure, but I've defined it correctly.
Maybe anybody can help me with this problem. Thanks in advance.
|
|
|
|
|
Try tagging the struct with [StructLayout(LayoutKind.Sequential)] maybe?
|
|
|
|
|
Well, I tryed to do the TransformFinalBlock but it keeps giving me IndexOutOfRange exception, and I don't know why, which is realy odd because it's not and Index!.
I'll give you the sample code, maybe you can trace what's going on.
the function of encoding is called VigBinEncDec.BothStrEncrypt or Decrypt, it's a simple Vigenere and Binary encryption decryption, and if some-one knows it keeps the number of chars the same (eg. if I input 5 chars it will come out 5 chars - supposably [hehe just made up a word here]!!).
so here is the code, and the exception, but why???
public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount)
{
if (VigBinTransformType == Transform.Null)
throw new NullReferenceException();
if (inputBuffer == null)
throw new ArgumentNullException();
if (inputBuffer.Length < inputOffset + inputCount)
throw new ArgumentException();
Byte[] outputBuffer = new Byte[inputCount];
int outputOffset = 0;
for (int i = 0; i < inputCount; i++)
{
Byte[] newBytes = Encoding.UTF8.GetBytes(VigBinEncDec.BothStrEncrypt(Encoding.UTF8.GetString(new byte[] { inputBuffer[inputOffset + i] }), key));
if (VigBinTransformType == Transform.Decrypt)
newBytes = Encoding.UTF8.GetBytes(VigBinEncDec.BothStrDecrypt(Encoding.UTF8.GetString(new byte[] { inputBuffer[inputOffset + i] }), key));
outputBuffer[outputOffset] = newBytes[0];
outputOffset++;
}
return outputBuffer;
}
|
|
|
|
|
You can't get a byte at a time and decode from UTF8. Some characters in UTF8 are stored in three bytes. When you try to decode the first byte of a three-byte code, you get the exception becuse the GetString methods expects another two bytes.
---
b { font-weight: normal; }
|
|
|
|
|
so what do you suggest to do?
|
|
|
|
|
but the problem is not the array, it's the int, and that I don't know why.
|
|
|
|
|
this is changed, but still does exception.. what's the problem here? (at-least now it's in index)
public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount)
{
if (VigBinTransformType == Transform.Null)
throw new NullReferenceException();
if (inputBuffer == null)
throw new ArgumentNullException();
if (inputBuffer.Length < inputOffset + inputCount)
throw new ArgumentException();
Byte[] outputBuffer = new Byte[inputCount];
int outputOffset = 0;
for (int i = 0; i < inputCount; i++)
{
Byte[] newBytes = Encoding.UTF8.GetBytes(VigBinEncDec.BothStrEncrypt(Encoding.UTF8.GetString(new byte[] { inputBuffer[inputOffset + i] }), key));
if (VigBinTransformType == Transform.Decrypt)
newBytes = Encoding.UTF8.GetBytes(VigBinEncDec.BothStrDecrypt(Encoding.UTF8.GetString(new byte[] { inputBuffer[inputOffset + i] }), key));
Byte[] tmpOutputBuffer = new Byte[outputBuffer.Length + newBytes.Length];
for (int j = 0; j < outputOffset; j++)
tmpOutputBuffer[j] = outputBuffer[j];
for (int j = 0; (outputOffset < tmpOutputBuffer.Length) && (j < newBytes.Length); j++, outputOffset++)
tmpOutputBuffer[outputOffset] = newBytes[j];
outputBuffer = tmpOutputBuffer;
}
return outputBuffer;
}
|
|
|
|
|
The code looks like it's doing very much work for nothing. What is it that you are trying to do, really?
---
b { font-weight: normal; }
|
|
|
|
|
I'm trying to encrypt a string... you have any suggesstions on how to efficiant the code?
|
|
|
|
|
Use streams. Use a StreamReader to read the input stream and a StreamWriter to write it. That also takes care of the multi-byte character code problem.
---
b { font-weight: normal; }
|
|
|
|
|
1. How do I determine on which row/line/ is the cursor?
2. How can I set a background color of a line?
|
|
|
|
|
Cristoff wrote: 1. How do I determine on which row/line/ is the cursor?
GetCharIndexFromPosition will accept some coordinates and return the index of the character under that point. GetLineFromCharIndex will get the line from the character index.
(Try consulting the help documentation or even just looking through the intellisense, the method names are quite simple )
Cristoff wrote: 2. How can I set a background color of a line?
Unless you override the painting of the control there is no built-in way to do this. Take a look at some of the articles regarding the RichTextBox here on CP for ideas on how to do this. (There is one I remember that draws the line numbers, should be quite simple to re-write this to background fill the lines).
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Thank you! I'm just starting this stuff again and I'm lost!
I think I found the article! I don't know why I wasn't able to find it before????
Great line about Land Rover!
-- modified at 15:22 Sunday 14th May, 2006
|
|
|
|