|
I was thinking last night just put the file io and serialization classes in a 4th project DLL, and just have the 2 windows programs reference it.
I was aware of saving the serialized classes as XML, but I was on another planet, looking back at earth after trying to debug the web service. I didn't know it would be that easy to do.
I'll look into changing where I save the files, right now, I saved them in the Program files folder for the project.
I'll give it a spin today and see what happens.
Thanks Dave
|
|
|
|
|
Yeah, everything under Program Files is read-only to users. Not a good place to write data at all.
|
|
|
|
|
I didn't know it was read only, good call on making that comment, thanks!
Now I have 7 projects in my solution. It's getting complicated to just send promotional emails.
But I was able to write the file in the Win app, and read it in the Win Service using the Common DLL that I just wrote. So now I guess I might as well centralized all the shared stuff, to make it easier to update and keep track of, and dump the registry storage for the Binary files. And move the Service Reference to the Common DLL and the Soap calls as well.
Thanks Again Dave!
|
|
|
|
|
I'd recommend using a file-based database, like SQLite. Easiest way to prevent versioning-problems with serialization, is not to use serialization.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
That's a good idea, but I already wrote a Web Service for the web site that the programs access data for. Hard to explain, but the windows programs access a website web service that in turn access the database server for data. The Serialization binary files store the web service location and credentials and the mail server location and credentials.
I was trying to avoid using another database server.
I'll try a 4the project today and integrate common code into it, that both windows programs can use to access common features.
I'll give it a spin right now.
Thanks Eddy!
May be back today.
|
|
|
|
|
jkirkerx wrote: I was trying to avoid using another database server. SQLite, SqlCe and Access aren't servers; with SQLite having a very small footprint and being available on multiple platforms
jkirkerx wrote: I'll give it a spin right now. You're welcome
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
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.
|
|
|
|