Error 1053 Windows service [closed] - c

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have created a windows service, however when I start the service I get a 1053 error.I have installed .net framework 4 on my machine.can anybody help!!

More than likely you are doing to much in the OnStart(). Try something like this.
'Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
Try
Dim worker = New Thread(AddressOf DoWork)
worker.Name = "MyWork"
worker.IsBackground = False
worker.Start()
Catch ex As Exception
'write to a log somewhere, however you usually handle your errors
End Try
End Sub'
Try something like that but we really do need more information to help you

You absolutely need to debug further. As others have already pointed out, "error 1053" is too generic to help much.
1) Read this link. It tells you how to debug a service in Visual Studio. You'll need to create a dummy "OnStart()" method (so that you can debug the "real" OnStart):
http://msdn.microsoft.com/en-us/library/7a50syb3%28v=vs.80%29.aspx
2) Here's a good article on Windows Event logging:
http://www.codeproject.com/Articles/39218/How-To-Create-a-Windows-Event-Log-and-Write-your-C
For starters (if you don't already have your own event log), I'd consider just appending "printf's" to a text file
3) Once you've isolated the problem to a specific part of your code, feel free to post it here.
'Hope that helps!

Related

Apertura de form en C# [closed]

Closed. This question is not written in English. It is not currently accepting answers.
Stack Overflow is an English-only site. The author must be able to communicate in English to understand and engage with any comments and/or answers their question receives. Don't translate this post for the author; machine translations can be inaccurate, and even human translations can alter the intended meaning of the post.
Closed 9 days ago.
This post was edited and submitted for review 9 days ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
Good day people, sorry to bother with a consultation that is sure is very easy but I am very new to the subject and there are simple things that complicate me. The issue is that I have a Form which is the main screen and from the menu I call another Form (Customers) and without closing this second I want to open a third (Articles) but it does not let me open it until the first child closes. This is all in C#. I would appreciate it if someone could explain to me how I should do it. Thank you
I've always called with .Show() but in this case I do not know how to do it

Naming a New C API [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
This might not be the ideal place to ask this question, but I'm really at a dead end and don't know where else to ask (suggestions would be appreciated).
I'm trying to come up with a name for 4 new API's for my company's C Library.
These API's are being added to an existing set, so they have to match an already made pattern, which limits my choices.
What all of the API's (existing and new) do is allow the user to get/set the value string or nonstring variables used in a program.
The way mine are different is that they allow you to get the value using the name of the variable, as apposed to already existing methods.
Here is what I currently have:
VariableGetValueString
VariableSetValueString
VariableGetValue
VariableSetValue
The only problem with this, is that it does not make it clear that it uses the NAME of the variable. I cannot think of a non-cluttered sounding name that makes this clear to the customer.
Preferably, there should be nothing removed from the names, as it matches the patterns of the other API's (which do not explicitly state their retrieval methods in their names, though this one should, for extraneous reasons).
Any help is appreciated, and though I know there is no definitive answer, I will obviously accept the one that fits the best.
Sorry again if this is a poor place to ask the question, I would love suggestions of a more appropriate place if there is one.
EDIT:
Some existing API names are:
VariableGetTaskString
VariableGetTask
VariableGetGlobalString
VariableGetGlobal
Along those lines. Task and Global refer to the scope of the variable. They weren't named very well in the first place, which makes my job more difficult, but they cannot be changed because customers have grown used to them and the changes would break old programs. I didn't include these initially because of how little help they offer (in my opinion).
The parameters of each API will make it obvious to the customer what each one does, but it would be preferable for the name to do that as well. Thanks for your feedback.
EDIT 2:
Here is an example of a call into the API:
if(!VariableGetValueString(Handle handle, LPCSTR variableName, TaskID taskID, LPSRT value, DWORD bufferSizeinBytes)
{
//retrieve failed.
}
if(!VariableGetValue(Handle handle, LPCSTR variableName, TaskID taskID, PDWORD value)
{
//retrieve failed.
}
Hope thats clear enough. Feel free to keep asking for more, I'll edit this all day. Thanks for the continued support.
Here are some possibilities:
suggestion 1
UseVariableNameToGetTaskString(...);
UseVariableNameToGetTask(...);
UseVariableNameGetGlobalString(...);
UseVariableNameToGetGlobal(...);
suggestion 2
VariableGetTaskStringByVarName(...);
VariableGetTaskByVarName(...);
VariableGetGlobalStringByVarName(...);
VariableGetGlobalByVarName(...);
suggestion 3
VariableGetTaskStringByName(...);
VariableGetTaskByName(...);
VariableGetGlobalStringByName(...);
VariableGetGlobalByName(...);
How about:
NamedVariableGetValueString
NamedVariableSetValueString
NamedVariableGetValue
NamedVariableSetValue
so that the distinction NamedVariable means a variable specified by name, whereas just Variable means a variable specified by ID or whatever the old functions use.
How about:
getVariableName()
and
setVariableName(char* value)

Implementation of an own message dispatcher in C [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I want to make my own message dispatcher in C...
For example, I want to send a message to MyButton or MyWindow structures.
And these structures have their own handlers.
Have any gurus any suggestions?
PS: for embedded application (using microcontroller)
PPS: thanks to sean - this is what I need.
My simple interpretation of sean's advice:
typedef void (*MyHandler)(size_t param);
MyHandler Handlers[32];
void RegisterHandlers(size_t id, MyHandler handler) {
Handlers[id] = handler;
}
void SendMessage(size_t id, size_t param) {
Handlers[id](param);
}
To implement this I would do the following:
Design a thread safe container for the events that are fired, a queue.
Then I would design a system to tie an event id, string or a integer, to a function through way of a hash table or some other mechanism like that.
After these two chunks are made you just need a way to register event id's with a function pointer and then just have a common way to send parameters to the functions and that's pretty much all there needs to be done with a message dispatcher. You push messages to the queue and then you pop things off the queue and react to whatever the message contains.

Why System.Windows.Automation.Peers.AutomationPeer.GetPattern() method does not use Generics? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
The GetPattern() method implementation of WPF UI Automation system is implemented taking the enum parameter PatternInterface and we normally use it in the following way:
//Code with original implementation
ButtonAutomationPeer buttonPeer = new ButtonAutomationPeer(button1);
IInvokeProvider provider = (IInvokeProvider)buttonPeer.GetPattern(PatternInterface.Invoke); //Line in Question
//To invoke the click event of button we then use the following code:
provider.Invoke();
From the above code, it seems that the line with comment Line in Question is not strongly typed, we need to cast the return from GetPattern() method to the required interface and then use it to invoke the specific UI automations.
Question is:
Would it not have been better if the implementation of the GetPattern() method in WPF was done using already present Generics in .Net Framework as below:
public T GetPattern<T>;
where, I would then pass the required interface pattern name while
calling the GetPattern<T> method and get that interface instance
strongly typed and would also not need a cast. What
thought has Microsoft given in the original implementation of
GetPattern() method requiring an enum?
Would using enums in the method parameters not break the
maintainability of the GetPattern() original implementation. I
would say that when a new Control interface pattern is needed to be
supported, that pattern interface's enum value would need to be
added to the enum parameter named PatternInterface
I suppose it is easier and better to call the method and get the interface pattern using the below new code that uses calling the Generic implementation:
//Code with New Generics based implementation
ButtonAutomationPeer buttonPeer = new ButtonAutomationPeer(button1);
IInvokeProvider provider = buttonPeer.GetPattern<IInvokeProvider>(); //Line in Question
//To invoke the click event of button we then use the following code:
provider.Invoke();
It is for the usual reason: they didn't have a time machine. Visible from the "History" annotations in the source code files available from the Reference Source, work on the UI Automation classes started around June 2003 with evidence that it got derived from earlier work. Generics didn't become available until 2005.
From dd/wpf/src/UIAutomation/UIAutomationTypes/System/Windows/AutomationPattern.cs:
// History:
// 06/02/2003 : BrendanM Ported to WCP
Which was very likely Brendan McKeon. No decent guess at what "WCP" might have meant.

Writing in a file with Phonegap [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I've a problem with the Phonegap File API.
Here a simple example of my problem :
function gotFileWriter(writer) {
for(var i=0;i<300;i++){
alert(i);
writer.write(i);
}
}
Navigator alert 0.
0 is written is the file
Navigator alert 1.
And nothing else.
Thanks
PhoneGap file operations are async. What is most probably happening is that the first write has not finished before you call the second write which would cause an exception, a PendingOperation one IIRC. You will either want to build up a string with all the information you want to write to the file and send it over in one write command or you'll need to wait for the onwriteend event from the FileWriter before you can write the next item.
Take a look at the FileWriter full example for an idea of how to use onwriteend.
http://docs.phonegap.com/en/1.3.0/phonegap_file_file.md.html#FileWriter

Resources