|
Thank you for your reply,
Keybd_event() is working fine for opening start menu and search files. But when i open any new application with process class its not working. I think focus is not done in newly created process window and keyboard focus is also not there. But i have setfocus() for keyboard focus and still its not working.
Please help me.
Thank you in advance.
|
|
|
|
|
I don't know if anyone on here has used the DDay.iCal library to create iCal files, but I thought I'd throw this out anyway, and see what I get. I've posted the same question just now on their forum as well. Basically, I'm trying to create an iCal file that includes reminders; in other words, when I open the item in Outlook, the appointment has, say, 1 Day as the reminder setting. I just can't seem to get it to work, though. The appointment looks good, except for this one facet. Here's the relevant code:
Alarm alarm = new Alarm();
alarm.Action = AlarmAction.Display;
alarm.Description = "Reminder";
alarm.Trigger = new Trigger(TimeSpan.FromDays(-1));
evt.AddAlarm(alarm);
Any ideas? Thanks in advance. If the DDay forum gets back to me, I'll post their response here for anyone else to view.
|
|
|
|
|
Hello all,
I have one problem in my module. in my project we are using the charcaters ASCII 32 to 255. we are display the character based on value i.e., if we want display Ö char just convert the 153 to charcater (char x = (char)153). But one of my coustmer wants if he enter the character by pressing Alt + 153 that will also we have to display. Now we are facing the problem Alt + 153 charcter is giving 214 value.we are not the proper value for that charcter. like this from 128 to 255 character we are facing the problem. can any one suggest some solution? it is very helpfull to me.
thanks in advance
Bhaskar
|
|
|
|
|
That is realy odd. "Ö" that is the char when i press ALT + 153. "Í" that is the char with ALT+214. Have you tried using Encoding.ASCII?
Also windows have Character map app. Some characters show on it with alt combination.
|
|
|
|
|
Thanks For ur reply,
If u try to debug the code.
char ch1 = (char)153;
char ch2 = 'Ö'; // alt + 153;
in this case ch1 value will be 153 and ch2 value will be 214.
|
|
|
|
|
Alt Codes[^]
Acording to that page, those codes are not ASCII or unicode. But rather ANSI or old MS-Dos code page based. if the numbers doesn't have zero in front of "Alt+153" uses MS-Dos code pages.
System.Text.Encoding.GetEncoding(850).GetChars(new Byte[]{153})[0]
That code uses code page: 850. That is "Multilingual (Latin-1)" (Western European languages) (Copied from wiki, link below)
List of Code pages[^]
|
|
|
|
|
char x1 = (char)153;
char x2 = 'Ö';
byte ss1 = System.Text.Encoding.GetEncoding(850).GetBytes(new char[] { x1 })[0]; // result 63
byte ss1 = System.Text.Encoding.GetEncoding(850).GetBytes(new char[] { x2 })[0]; // result 63
this is not working.
i want the value 153 if i use the character (char)153 and alt+153.
|
|
|
|
|
edit:
It isn't:
.GetEncoding(850).GetBytes
It shoud be:
.GetEncoding(850).GetChars
char x1 = (char)153;
char x2 = 'Ö';
char ss1 = System.Text.Encoding.GetEncoding(850).GetChars(new byte[] { Convert.ToByte(x1) })[0];
byte b1 = System.Text.Encoding.GetEncoding(850).GetBytes(new char[] { x2 })[0];
Edit: I have tried your second code, second ss1, it shoud work. Try code-page 437 instead 850.
bhaskarsgb wrote: i want the value 153 if i use the character (char)153 and alt+153.
Are you askinng the folowing: User Press ALT+153 and you want same character with a character code: 153?
modified on Thursday, December 3, 2009 7:24 AM
|
|
|
|
|
yes i am asking that one if user enter the charcter by using Alt+153 or (char)153 convertion also i want the same value 153.
i think it is little bit confusion. in my module i have symbol editor it contains the character from 32 to 255. if user want the value on the symbol editor he just double click on the value(if user wants "Ö" user will double click on the charcter. in this case i am getting the position of the character in that editor. the position is 153) user can use this symbol editor or he can use directly by pressing the Alt+ value.
in my code i am just coverting the charcter what i am having in the symbol editor text box. this is the actual problem i am facing.
thanks in advance
bhaskar
|
|
|
|
|
That is gonna be hard but i think I found info:
Encoding unicode = Encoding.Unicode;
Encoding CodePage850 = Encoding.GetEncoding(850);
char c1 = (char)'Ö';
byte[] ub1 = Encoding.Unicode.GetBytes(new char[] {c1});
byte[] ub2 = Encoding.Convert(unicode, CodePage850, ub1);
More info here[^][^]
|
|
|
|
|
still that example is giving 214 only. but i want 153 at any case.
|
|
|
|
|
Thats of. Did you tried updating .net framework or using diffrent version?
My Picture[^]
Do you have same output as i have from my picture? (Look at local Watch)
|
|
|
|
|
Encoding unicode = Encoding.Unicode;
Encoding CodePage850 = Encoding.GetEncoding(850);
// Test character
char c1 = (char)153;
// Convert 153 from Char to array.
byte[] ub1 = Encoding.Unicode.GetBytes(new char[] {c1});
// convert char code 214 from unicode to CodePage850, with a char code 153.
byte[] ub2 = Encoding.Convert(unicode, CodePage850, ub1);
If use char c1 = (char)153;
this case ub2[0] is 63. that is the problem i am facing.
|
|
|
|
|
It seems on my Side it behaves differently than on your side. I am using Visual Studio 2008. My default project uses .NET framework 3.5. I have both Visual Studio 2008 and .Net Framework 3.5 upgraded to SP1.
What version of Visual Studio or other IDE you are using? Witch .NET framework are you using and is it upgraded (dotNET 3.5 SP1 or dotNET 2.0 SP2)?
If you have fully upgraded .NET Framework, I Suggest your project to use different version of .NET framework
|
|
|
|
|
bhaskarsgb wrote: we are using the charcaters ASCII 32 to 255
impossible. ASCII is a 7-bit code, it goes up to 127.
You probably mean ANSI characters, those are 8-bit; chose the right code page, in Western Europe it probably is 1252.
|
|
|
|
|
ya that is ansi only. i have tried with 1252 code page also but i didn't get the result what i am expecting.
|
|
|
|
|
I have a 2d function that can be represented in a grayscale Format32bppArgb bitmap. I simply divide each value of the function by the maximum value in the function then multiply by 255. I use a lockbits routine to set the pixels.
I have a reversible transformation (similar to an FFT) that I apply to the function and I can represent it the same way.
I wanted to store the transform in the bitmap. The trouble is, if I use an 8 bit color depth, it only has 256 discrete levels. This is too coarse for my application (I cannot inverse transform the data stored in the bitmap and obtain the original function). A 16 bit color depth would give me 65536 discrete levels and this would do nicely.
The trouble is, I have not found a way to render a 16 bit color depth bitmap. I seems that the required Format16bppGrayScale and format and the Format64bppArgb are not functional VS. (I use VS 2005). Most of what I have seen for a work around involves scaling the bitmap data to an 8 bit color depth format.
I would like to be able to both store and “see” the transformed function in 16 bit detail. (Having the visualization be based on a bitmap structure isn’t a necessary requirement for me.) I have looked at some alternate approaches (such as directx) for managing this task but I haven’t been able to noodle out exactly how to do it. The Google stuff I’ve found is pretty sketchy on the implementation steps for my limited skills.
Can anyone give me a boost?
|
|
|
|
|
Member 4590656 wrote: Can anyone give me a boost?
Not really. I recent question on one of the forums here suggested to me GDI+ still has some 16-bit limitations hidden deep inside, so you probably will never be able to create a Form or a Panel with sizes above either 32K or 64K. Anyway, trying to display a 4Mpixel image (64K squared) doesn't seem a very good idea either.
Member 4590656 wrote: I have a reversible transformation (similar to an FFT)
I have strong doubts that is even possible. With real numbers you would get rounding errors, with integers you're bound to loose some information on any non-linear transformation you could come up with. You probably mean the inverse transform almost returns the original?
|
|
|
|
|
Screens don't support 16bit colour depth anyway, but I think I have an idea.. There are many more "colours of green" than just the ones with all green and no red/blue, you may be able to get more "perceived colour depth" by using only shades of green and include the "extended green" colours
The required calculations are a bit complex though, and is likely not easily reversible (so you'd need to keep a copy of the actual values as well)
Or you could just split the value over 2 colour components, but that would make the picture hard to interpret visually
|
|
|
|
|
"Or you could just split the value over 2 colour components, but that would make the picture hard to interpret visually"
I toyed with this idea using the alpha channel with 8 bit grayscale (perhaps superimposed on a black background). Again, I wasn't able to wrap my brain around an interpretable implementation. But, I could store the transform this way and present the 8 bit per color image by ignoring alpha. (Pngs can be made in 16 bit color depth format so there must be some app/platform that supports their rendering.)
The monitor limitation is a real concern. I have a graphics card with 64 bit capability but perhaps my lcd is a limiting factor. I know that medical diagnostics applications use 16 bit grayscale but I also know that the monitors are mega expensive.
I saw some stuff on using "textures" to emulate 16 bit detail. One reference alluded to Directx but gave no details.
|
|
|
|
|
Member 4590656 wrote: Pngs can be made in 16 bit color depth format so there must be some app/platform that supports their rendering.
There is no rule saying that, you know Maybe the PNG guys were optimistic and forward looking?
Member 4590656 wrote: using the alpha channel with 8 bit grayscale (perhaps superimposed on a black background)
While that would certainly allow you to store 16 bits per pixel, it would make it impossible to (visually) make any kind of sense of the image at all (the same resulting colour can be represented in many very different ways)
Member 4590656 wrote: I saw some stuff on using "textures" to emulate 16 bit detail. One reference alluded to Directx but gave no details.
You could look at HDR, but even that is not "true" 16bit color depth, it is just made to look (close to) that way
|
|
|
|
|
I'm currently experiencing a race condition: my data-receive thread isn't ready by the time it's supposed to receive data
Thread clientThread = new Thread(new ParameterizedThreadStart(ProcessServerResponse));
clientThread.Start(RDclient);
logText("Connected to Server");
String clientRequest = "SYNC|" + strClientPassword;
Byte[] sendBytes = Encoding.ASCII.GetBytes(clientRequest);
tcpClientStream.Write(sendBytes, 0, sendBytes.Length);
tcpClientStream.Flush();
how do I ensure that my ProcessServerResponse() thread is at the .Read() before my main thread sends .Write ?
private void ProcessServerResponse(object client)
{
TcpClient _RDclient = (TcpClient)client;
NetworkStream tcpClientStream = _RDclient.GetStream();
String strTemp;
byte[] message = new byte[Properties.Settings.Default.iReceiveBufferSize];
int iBytesReceivedCount;
while (true)
{
iBytesReceivedCount = 0;
try
{
iBytesReceivedCount = tcpClientStream.Read(message, 0, message.Length);
}
|
|
|
|
|
Have a look at Thread.Join()
|
|
|
|
|
Hi,
In very general terms the writing thread should wait for a ready signal from the reading thread.
void Initialise() {
using (ManualResetEvent mre = new ManualResetEvent(false)) {
Thread t = new Thread(ThreadProc);
t.Start(mre);
...
mre.WaitOne();
}
}
void ThreadProc(Object mre) {
...
((ManualResetEvent)mre).Set();
...
...
}
The reader thread should signal as soon as it can and the writer should delay waiting until it is ready to write. That way the actual wait period will be minimised.
Alan.
|
|
|
|
|
What is the advantage of using a ManualResetEvent over an EventWaitHandle? I always use an ewh in these situations. I don't really understand the difference between these two classes and why you would use one rather than the other.
|
|
|
|