|
I guess your advice is probably the better advice.
I'll write a general post in my thread.
|
|
|
|
|
So I wrote a commmon DLL and moved all the common stuff over to it.
Now I get a Access Denied from the Folder
c:\ProgramData\redCopper\smtpMessenger\ and not the serialized binary file.
I wrote a text file to the folder, and set the code to open it, got the same error.
I thought in theory, I would be able to write to it from the Windows Form App, which works and read it from the Common DLL, that represents the Windows Service, Which doesn't work.
So I wonder if it's because I had to elevate VS 2013 To Administrator, to debug the Windows Service OnStart Event. The Windows Service runs on Local Account
Dim m_appPath As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) & "\redCopper\smtpMessenger\smtpCredentials.bin"
Try
Using fs As New FileStream(m_appPath, FileMode.Open)
Dim bf As New BinaryFormatter()
pResults = bf.Deserialize(fs)
End Using
|
|
|
|
|
Users are, by default, not allowed to write to "ProgramData", only admins. It is an admin that installs the application, and any shared files it needs to read. Data is saved somewhere else; it is not part of the installation-package, and since it cannot be reinstalled, it must be in a location that is backed up regularly.
When running under the users' credentials, it will not be allowed to write there; alternatively, you can write to the "public" documents folder. All users should have access to that one (documents and settings\public\etc).
See this[^] page.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I see why you suggested the SQ Lite, you had the foresight of knowing I would run into this.
My post time was the end of the day, and I should of done more research on storing data.
I could of sworn that I read that Program files had read write permissions for any program installed in that folder since Vista, but I haven't updated my knowledge since Windows 7.
I'll try Public today and see how that goes.
Thanks Eddy!
|
|
|
|
|
jkirkerx wrote: I see why you suggested the SQ Lite, you had the foresight of knowing I would run into this. Rereading the question I had the feeling we had a similar problem, so yes, been there*. I tend to stick almost everything in a SQLite .dat file, from resources and sprocs to assemblies. Makes stuff easy to copy and mail, makes stuff easy to update. And best of all, there is SQL to separate the data from the rest of the app, so I won't spend much time on writing code for that infrastructure.
jkirkerx wrote: I haven't updated my knowledge since Windows 7. Neither have I, but I will be installing any later stable version that has a good price/value ratio.
*) A few times
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
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
|
|
|
|
|