Declaring a Handle for a specific window [closed] - spy++

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I have just used spy++ to find the handle of a window that I need, but spy++ is giving me a number:
Window Handle: 00010080
And I mean... usually when you declare a handle its done like:
HWND windowHandle;
Question:: So I am guessing that 00010080 is some sort of ID or something, but how do I use it to declare the right handle that I want in my code?
I mean I cant do
HWND windowHandle = 00010080; (haha if you know what I mean, so how do I use this number to get the window handle?)

The value given to you by Spy++ is the same one returned by calls like CreateWindow. Using Spy++ to acquire this value and then using it in your program is not the most optimal solution as the value will change each time the target application starts.
Instead I suggest you use FindWindow, FindWindowEx or even EnumWindows. These are the same calls used by Spy++ to get a list of windows. For example the following will search for the first top level window created using a class name of SomeWindowClass.
HWND hwnd = ::FindWindowEx(NULL, NULL, "SomeWindowClass", NULL);

HWND is as HANDLE
HANDLE is PVOID
So, just assign your number to variable:
HWND hwnd = (HWND) 0x00010080;
don't forget that hwnd is different for each application run.
reference http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx

Related

Exception of 50000 characters at 'SpreadsheetApp.flush()' in Google Sheets? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I'm trying to import a list from my Gmail into a spreadsheet.
It has worked flawlessly several times, but I decided to do some cosmetic changes and now I get a baffling error:
var l = artikelen.length; //l = 40 in this case
var importSh = SpreadsheetApp.getActive().getSheetByName("import");
var range = importSh.getRange(2,1,l,1);
range.setBackground("#ab6e6e");
SpreadsheetApp.flush(); //throws error 'Input exceeds the limit of 50000 characters in a cel'
What is that? I'm not trying to put anything in a cell?? I'm just ordering to pick a range and set a colour AFAIK. Which in fact is not executed either...
What am I overlooking here?
Any suggestion will be welcome.
The culprit may be elsewhere in your code. Chances are that there is an attempt to put more than 50,000 characters in some cell.
Spreadsheet writes are lazy, and the error may only get shown when the script terminates, or at flush(), as the case seems to be here. To debug, add a flush() after every Range.setValues() and Range.setValue() call. Use console.log() to find what the values you are writing look like.

Erlang store file contents in a list [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
code
read_CNF_File(FileName)->
case file:read_file(FileName) of
{ok, Data} -> print(binary:split(Data, [<<"\n">>], [global]));
{error, Reason} -> Reason end.
print([]) -> ok;
print([L|List]) ->
L,
print(List).
[Pic Related] How do I store contents from a file into a list (ideally a list of every line), if I try to io:fwrite As in read_CNF_File it seems to store it the way I want, however once I try to call print with that it just passes As as an empty list, thanks.
It is your print function that does nothing.
If you pass it à non empty list, it removes the first element (A in your code), the statement A, does nothing, and then recursively call itself with the tail of the list, until it is empty a' finally returns OK.

Adding user defined functions to a simple calculator YACC [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I've been searching all over the internet for a comprehensible example to how you can define and call a function in a simple calculator interpreter. Maybe I've found the answer but since I'm not familiar with YACC I couldn't see it.
So the question is, how do you set up a symbol table for user defined functions and how do you store/call these functions in a calculator interpreter?
I'm basically looking to achieve something like this:
def sum(a,b) { a + b }
sum(5,5)
result:
10
Any pointers or examples would be appreciated
That's definitely diving in to the concepts required to interpret (or compile) a programming language, which makes it difficult to provide an answer in a format suitable for StackOverflow. Here's a quick outline:
You need a symbol table which can hold both functions and variables. Or two symbol tables. In the first case, the mapped value will be some kind of variant type, such as a discriminated union; you might need that anyway if you have more than one type of variable. In the second case, you can use a specific type for the mapped value of function names. I'd go for the first option, because it allows functions to be first-class objects.
You need some kind of type which represents the "value" of a function definition. The obvious type is the Abstract Syntax Tree (AST) of an expression (or a program), and doing that will generally simplify your code so I'd highly recommend it. That means that the calculator/parser will not actually evaluate 5+5 (even if that is the literal input) or a+b, but rather will return an AST to whoever called the parser. Consequently, you will need:
A function which can evaluate an AST. That's usually straightforward to write, since it's just a depth-first tree walk. But now you need to worry about variable scope because when you do evaluate they body of your function sum, you probably want to only locally set the values of the parameters.
If you manage all that, you will have gone several steps beyond the usual "let's build a calculator with flex and bison" project, and I definitely encourage you to do so. You may want to take a look at the classic text Structure and Interpretation of Computer Programs (Abelson & Sussman, 1996; often referred to simply as SICP).

invalid command name in TCL [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
invalid command name "if{0}{"
Giving me an error, for that I have find how many cell in the file.
Where am I making a mistake?
Update::::::::::::::::::::::::::::::::::::::::::::::::::::::::
I am having an issue while sorting an array...
It says
enter image description here
Since the last element is integer, still it says "expected integer but got...
Where am i making mistake?
You must place a space between 'if' and the opening brace.
Basicly, the Tcl interpreter tokenizes commands by searching for whitespace, while at the same time substituting stuff inside []. So first, the regexpr is evaluated, yieling 0 and togehter with the remaining characters this yields the command name.

Does an uncompressable string exist? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I was wondering if there is one or more strings that cannot be losslessy compressed. More formally:
Let String be a string, f(var) a compression function which returns a compressed version of var, g(var) a decompression function such that g(f(var)) = var and strlen(var) a function which returns the length of var,
is there a valid value for String such that strlen(String) < strlen(f(String)) or strlen(String) = strlen(f(String))?
Theoretical answers are welcome, as well as examples in different languages and with different compression algorithms.
The pigeonhole principle tells us that for any given compression function*, there must always be at least one input string that will be expanded.
* i.e. a function that genuinely compresses at least one input string.
I would expect that this string would fit the bill: ""
Yes and for a simple reason: take for example a function that is garanty to return a losslessy compressed string that will be at least one bit less for any input string. Is such a function exists, then by reapplying this same function to its previous result over and over again, we are garanty to compress any string at least one bit further successively for each pass and therefore, we are garanty to be able to compress losslessy any string of any length down to a single bit every time.
Obviously, this is false (some initial strings could give such a final result and it's easy to find about them be applying the decompression algorithm to a compressed string of one bit in length but this result cannot be extended to all uncompressed strings) and therefore, such a function cannot exists; which means that for any compression algorithm, there exists at least one uncompressable string.