|
What a pain in the A??.
I was looking at other windows services loaded on my machine, and noticed a few that used the Windows user account to run as. So I figured I'll give that a try.
Easier said than done. Installing the service as a user with a password was much harder than I thought. So I ended creating a new console app that can run as a Windows service, and used some new stuff out there referred to as a Custom Service Base, Custom Service Installer and IServiceLogic and TransactedInstaller. Pretty slick now. The service can self install and uninstall, can be debugged pretty easy now. In fact its so nice, I should publish an article on it.
So I just performed my i/o test, using the common DLL file that now does all the I/O for both programs, the SOAP calls to the Web Service, And the reading and writing of my serialized class files that store parameters, which is now located in the AppData folder of the user account (LocalApplicationData) and it worked without any errors on all 3 programs. No more folder errors or binary read errors from the creator assembly.
So now, I since I wrote a new service, I might as well trick it out, and make it better and more up to date, guess I'll write some threads that the service can run to do it's gig.
I was smart enough this time to make a copy of the project, in it's sort of raw form that just supports install and uninstall and debug, with no other logic in it.
Thanks Dave and Eddy for the help!
The Link to the Service code that I used
Creating easy to debug Windows Services in .NET - CodeCaster.nl - Blog[^][^]
|
|
|
|
|
I have used two forms and one form open to showdialog condition...
while showdialog closing at the same time need to another form closed...this is my problem so please solve this..........
|
|
|
|
|
On return from ShowDialog you can close the form.
|
|
|
|
|
I need vb.net project on finance marketing please get me the working project
|
|
|
|
|
|
Code Project is not a "code-to-order" site. If you want a completed projects, go pay for it at Freelancer.com. Oh, and I hope you're not picky about the quality of the code.
|
|
|
|
|
Hai All,
How to change PC Time format in application loading time
very Urgent.......pls reply
Thank you
regards,
Dha Na
|
|
|
|
|
|
I need to change the System (Control Panel-->Regional Setting-->Short Date Format) Date through VB.Net code.
|
|
|
|
|
|
That sounds rather.. wrong.
If your application needs to use some other format, then you change the application - not the users' preference or his/her settings. Your change may have unintended consequences in other applications, and cause data-loss.
If your app complains about the time being in the wrong format - then one should fix the app, instead of messing with the users' settings.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I am trying to use the sendinput function to send keys to a running DOS application. Example DOS Edit)
I can sendinput key strokes to a DOS cmd window but not to the DOS program that's running is that window.
Here are both a empty command window and the DOS Edit as they appear as processes.
The application I am really trying to send keystrokes to is the first one it is a DOS application. (cncm # CNC11-D Mill # 5872)
cncm # CNC11-D Mill # 5872
cmd # C:\Windows\system32\cmd.exe - edit # 2888
cmd # C:\Windows\system32\cmd.exe # 5992
How do I sendinput to the "cmd # C:\Windows\system32\cmd.exe - edit # 2888" (DOS Edit application)
or better yet to the
(cncm # CNC11-D Mill # 5872) application?
This is the way I am using the function sendinput.
Dim ProgramIDParts As String()
Private Sub BtnSetFocus_Click(sender As System.Object, e As System.EventArgs) Handles BtnSetFocus.Click
Dim App As Process() = Process.GetProcessesByName(ProgramIDParts(0))
For Each p As Process In Process.GetProcessesByName(ProgramIDParts(0))
ShowWindow(p.MainWindowHandle, SHOW_WINDOW.SW_NORMAL)
Next p
AppActivate(App(0).Id)
Thread.Sleep(100)
Dim Data As String = Trim(txtKeysToSend.Text)
LabelError.Text = SendStringKeys(Data)
End Sub
BTW I don't get a error returned from the sendstrings function.
modified 29-Dec-15 12:41pm.
|
|
|
|
|
You posted this same question below, and received some suggestions. However, the SendInput function merely adds the keystroke messages to the keyboard input stream. It does not guarantee which application will read them. You may also try the SendKeys Method[^], but that again will only send them to the active window. Perhaps it would be better if you explained in clear detail what issue you are trying to solve.
|
|
|
|
|
This question has the same title but it is not the same question. Below I was trying to find out which function to use to communicate with a dos program (Send Key Strokes).
Now I am trying to find out how to set focus to a dos program. I am not sure "set focus" is even the right word(s).
You are absolutely right! I edited the post to explain it better. I am 68 a geek so I don't explaine things clear enough. Please let me know if any more information is needed. As far as what I am trying to do. I use a DOS cnc program that uses two simultaneously key presses to control movement. Example Ctrl + S
There are a few dozen of these. I want to create a application with each button labeled that sends the proper hotkey combination. I am a amateur but good enough that if I can send keys to the DOS CNC application I can write the rest easily.
Thank You!
Ron Derkis
modified 30-Dec-15 10:10am.
|
|
|
|
|
rderkis wrote: I am not sure "set focus" is even the right word(s). It is; there's only one application that has input-focus. SendKeys and SendInput will send information to the current active window, which may be different from your intention. Not only is input-focus limited to a single application, it is limited to a single control; press tab and you see the input change focus. Press alt-tab and you see applications change focus.
If I had to automate a console-application, I'd look into redirecting stdin and stdout instead of sending individual keystrokes.
rderkis wrote: I am 68 a geek so I don't explaine things clear enough You're among geeks here and you can always post a new message explaining stuff in detail.
I only know that you want to send input to a console-application, and writing to the input-stream would do that. It would still be a good excercise to write that device-driver though
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I bought the control pendant ($800) for the cnc mill so I don't need to write the program anymore.
I sent email to the programmer that wrote the onscreen keyboard program, asking him what function he used to communicate with the current DOS program. He said Sendinput. I should have asked him how he found and set the focus to the Dos program and control. Upon thinking about it, I should have gotten that information, somehow from windows, as the current screen control that has control before my program took control.
|
|
|
|
|
I can send keystrokes to a DOS command prompt screen but unable to send keystrokes to a DOS application like DOS Edit..
I have downloaded and ran a few virtual onscreen keyboards, a few of these can write to DOS Edit, other can't.
Can someone please point me in the right direction. I have tried sendkeys, clipboard copy paste, p-invoke etc.
Quite a few people say it can't be done but since some of the onscreen keyboards do it, it can be done.
Thank You
Ron Derkis
win 7
vb.net 2010
modified 26-Dec-15 16:48pm.
|
|
|
|
|
|
Well Mr.Kreskowiak I setup the code module shown in your link. It shocked me because it compiled perfect with nothing to fix. And it is super easy to use.
First I tried it with note pad to make sure Everything was setup right. Worked perfect. Then I tried it with DOS Edit. It would not work with the sendinput function. nor would it work with my DOS CNC program.
I really, really appreciate your taking the time to help me! Any more ideas?
Ron Derkis
|
|
|
|
|
|
rderkis wrote: Quite a few people say it can't be done but since some of the onscreen keyboards
do it, it can be done. That it can be done does not mean that there is a solution publicly available. I'd imagine the best onscreen keyboard would be an actual device driver that acts as an input-device.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Ok, I sent a email to one of the free onscreen code authors (that work with a DOS application).
He said they use sendinput.
I think I understand my problem now. I am sending the input to the cmd window and not the dos application itself. I will ask in another message how to do that. Thank all of you that took your valuable time to try to help me!
|
|
|
|
|
There is no target information in SendInput. Nothing that says "send the input to this window". So, are you sure the DOS window you launched has the focus when you call SendInput?
|
|
|
|
|
I reposted the message stating what I have done. And that I normalize the window and then set focus to it. The proper DOS screen comes up but I think your right some how I am not sending keys to the DOS application. Please check out my new post.
|
|
|
|
|
Hi everyone! I am trying to send keys from a vb.net program to a cnc control dos program.
I know it can be done because the onscreen keyboards will send keys to it.
I have searched and tried everything I could find.
At present I can set the focus to the application.
Tried pasting clipboard to it.
etc.
I have been told over and over it cant be done but like I stated the onscreen keyboards work with it.
Windows 7
VB 2010
Thank You!
Ron Derkis
|
|
|
|