|
Hi Jeff!
Finally I got to try out your suggestion. Unfortunately it didn't work either.
While I'm able to send key strokes to "regular" windows (notepad for example) using WM_KEYDOWN/WM_KEYUP, nothing is happening when the mstsc window is the target.
Funnily enough, Spy++ doesn't show _any_ keyboard or clipboard messages when monitoring the mstsc window.
Anything else I could try?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hmm, that is surprising. Are you certain that you matched the events sent to notepad exactly? For example, did you match your keyboard's key identifier for both the keys? Post the code you tried so perhaps I can check for errors? If there were none, then perhaps you could try to show the target window first, as it may be aware of when it has focus, and ignore messages sent when it is hidden.
Jeff
|
|
|
|
|
Hi!
That's part of the code that works with notepad, write, ... as long as I use the HWND of the edit control (for the test program I just got a textbox where I put the HWND I get via Spy++):
[DllImport("user32.dll")]
private static extern bool PostMessage(IntPtr hWnd, int msg, int wPar, uint lPar);
private const int WM_KEYDOWN = 0x100;
private const int WM_KEYUP = 0x101;
private const int VK_V = 0x56;
private void button1_Click(object sender, EventArgs e)
{
IntPtr hWnd = new IntPtr(int.Parse(textBox1.Text, System.Globalization.NumberStyles.AllowHexSpecifier));
bool res;
res = PostMessage(hWnd, WM_KEYDOWN, VK_V, 0x002f0001);
res = PostMessage(hWnd, WM_KEYUP, VK_V, 0xc02f0001);
}
Btw. it doesn't write "v" when I use the HWND of the main application window either, so this could be a hint that WM_KEYDOWN/WM_KEYUP might be inappropriate in this case.
The only thing I haven't tried so far is using SendInput, but I expect it to fail just as keybd_event did. Nevertheless, I'll give it a try.
If you have any further ideas I'd be really grateful.
Thanks,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
ReHi!
Meanwhile I've also tried SendInput(), but, as I expected, it failed just as miserable as all the previous methods did
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I will try to look at this in detail either tonight or Thursday night and give you some more ideas before the weekend...
Jeff
|
|
|
|
|
hi everyone!
i created a windows service. this worked fine. i added an installer projekt. this worked fine as well. then i chose install it completed successfuly, but the service doesn't show up in the service list after installation! so i guess there is something wrong in the installsettings.
i guess it installed correctly but did not register correctly or whatever.
at the moment i do not have a clue what could be wrong. does anyone of you have an idea where i could be looking for?
thanks.
stephan.
|
|
|
|
|
stephan_007 wrote: does anyone of you have an idea where i could be looking for?
where you might look is MSDN
what you might be looking for is the documentation[^]
|
|
|
|
|
i managed to let it register. i chose it to be automatic.
the problem is, it doesn't want to start. when i try to start it manually then i get the error message (sorry if it is not a propper english error message, i had to translate it from german into english):
Service "Parser" was started on "local pc" and stopped again. some services might be stopped automatically, if they weren't used by other programms or services.
functions of my parser:
it watches a directory for incoming files. if there are files which match the filter they are parsed and an output is generated to a new file. if there are none it is in standby, waiting for new files to come.
so i wonder, why the service doesn't want to start. or did i forget an option when creating the installer??
any help is very welcome!
thanks!
stephan.
|
|
|
|
|
Hi all! I'm coding a class to print barcodes. One of my methods is this:
public Metafile GetMetafileImage()<br />
{<br />
PrinterSettings ps = new PrinterSettings();<br />
Graphics g = ps.CreateMeasurementGraphics();<br />
IntPtr pHdc = g.GetHdc();<br />
<br />
Metafile mf = new Metafile(pHdc, EmfType.EmfOnly);<br />
<br />
g.ReleaseHdc(pHdc);<br />
g.Dispose();<br />
g = Graphics.FromImage(mf);<br />
<br />
g.PageUnit = GraphicsUnit.Millimeter;<br />
g.PageScale = 1;<br />
<br />
Brush b = Brushes.White;<br />
g.FillRectangle(b, 0, 0, whiteMarginWidth, height);<br />
<br />
<br />
float x = whiteMarginWidth;<br />
<br />
foreach (char ch in encodedValueString)<br />
{<br />
if (ch == '1')<br />
b = Brushes.Black;<br />
else<br />
b = Brushes.White;<br />
<br />
g.FillRectangle(b, x, 0, x + barSize, height);<br />
<br />
x += barSize;<br />
}<br />
<br />
b = Brushes.White;<br />
g.FillRectangle(b, x, 0, x + whiteMarginWidth, height);
<br />
g.Dispose();<br />
<br />
return mf;<br />
}
It works fine but the last FillRectangle operation. Its width isn't "whiteMarginWidth", but it's larger than "whiteMarginWidth". It seems to fill a rectangle whose wide reach the "end" of a region, perhaps a region set by the printer handle...
I can't solve this problem Can you help me?
Thank you!
Luca
|
|
|
|
|
Change "x + whiteMarginWidth" to "whiteMarginWidth". That parameter is the width of the rectangle, NOT the right x-coordinate of the rectangle.
-Jeff
|
|
|
|
|
Great! I was wrong in considering it as the right x-coordinate of the rectangle! Thank you very much Jeff
Hope that helps!
Luca
Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks!
|
|
|
|
|
anyone got any ideas how to get a list of all the available terminal servers on a given domain or across all domains?
|
|
|
|
|
worked it out. not hard really since you just try to open a socket on 3389.
|
|
|
|
|
I am writing an application which captures IP packets from the default network interface. The original code uses hard coded data which does not allow it to be used by other programmers.
I am attempting to rewrite the code to use an event which should be triggered every time a packet arrives however i am STUCK!
The packet capture method, called Capture() stores each packet in a class called IPPacket
I have a delegate declared as
public delegate void PacketArrival(object sender, IPPacket packet);
and an even declared as
public event PacketArrival OnPacketArrival;
I do not know how to link the Capture() method to the delegate so that when the event is used, the capture method will notify the event each time a packet arrives
Please help!!!
|
|
|
|
|
I've worked it out! all working. The Capture() method captures a packet and fires an event. All event listeners are able to recieve the captured packet and perform some action on it.
|
|
|
|
|
Hi,
i trying to find out if there is a class named IniFile
but i could not find any in MS-VS-2005-Express
Do i need to Build it myself?
and if So, any suggestion??
THANKS
Have Fun
Never forget it
|
|
|
|
|
|
Hi:
I Mujahid Hussain Awan,I am a software Developer,I have a problem in Crystal Report.First I was working in Visual Studio 2003(C#).I built many crystal reports using DataSet method,and the Procedure was so simple.First I add Dataset and then add new element and give all it's attributes,and Datatype of all these attribute.then In Frontend at C# I add new crystal report then I select Blank Report,then I open Field Explorer Window right Click on Database Fields then I select Database Expert,a Database window Express Opens then I select Project Data and then I select ADO.net DataSet a Dataset with the same I created above apears,then I open it and Drag & Drop each Fields in Crystal Report's Detail Section.and then I Open a Form I initialize Dataset and Crystal report and write quer in Adapter then I Fill DataSet and set DataSorce Property of Report Object.and set ReportSource property of Crystal report Viewer and run Project and Record displays in Crystal Report. This is the Procedure of Crystal Report in Visual Studio 2003.
But When I do all these in Visual Studio with same Procedure but no Record Displays in Crystal Report.Can any body Help me How can I do all this in Visual Studio 2005.
Mujahid Awan
|
|
|
|
|
The procedure your telling here is all fine.
when ur done with making the crystal report you need to populate the table on which ur making ur crystal report from ur application. Remember that it doesnt populate by itself. when u populate that table you do need to write 1-2 lines of code that are not in my mind right now. I remember I got goin by searching a few articles on CP
http://www.codeproject.com/useritems/CrystalReportDevlopment.asp
http://www.codeproject.com/csharp/crystalreportaccesscs.asp
Hope it helps! try searchin in detail on CP I'm sure you'll get ur answer
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Call refresh report on the Crystal Report object after binding the up to date data source.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
how to hide ip address using c#.net code
|
|
|
|
|
|
suppose we are accessing any website they know who can accessing that information they are identify the incoming request coming which
pc. but my requirement is iam accessing any website anonymously using c# coding . plz post me code
|
|
|
|
|
Why reinvent the wheel?
Try Tor
"You're very clever, young man, very clever," said the old lady. "But it's turtles all the way down!"
|
|
|
|
|
sivaramireddy p wrote: how to hide ip address using c#.net code
Well, you could write an NDIS driver and manually modifiy the packet as it goes through the network card. However, you can't do that in C# and you would never get a response because the reply would go to what ever machine was at your fake IP address (if it exists).
Upcoming FREE developer events:
* Developer! Developer! Developer! 6
* Developer Day Scotland
My website
|
|
|
|