flat assembler
Message board for the users of flat assembler.

Index > Windows > GetDlgItem(SetWindowLongA)

Author
Thread Post new topic Reply to topic
jumpex



Joined: 29 Jan 2006
Posts: 38
jumpex 30 Jul 2010, 17:00
Segment:

Code:
[...]
ID_CHECKBUTTON equ 14
[...in_DialogBox_proc]
invoke GetDlgItem,[dwnd],ID_CHECKBUTTON ;success
invoke SetWindowLongA,<invoke GetDlgItem,[dwnd],ID_CHECKBUTTON>,GWL_STYLE,WS_VISIBLE+WS_BORDER+WS_DISABLED ;success
invoke GetDlgItem,[dwnd],ID_CHECKBUTTON ;1421 - Control ID not found.
[...]    


Any successive calls to GetDlgItem result in the same error.
If I keep the handle in a variable and use it, it works fine.
But if I want to get it again with GetDlgItem - 1421, Control ID not found.

Am I doing something wrong? If not - any ideas?
Post 30 Jul 2010, 17:00
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20486
Location: In your JS exploiting you and your system
revolution 30 Jul 2010, 18:06
Post your source. There is not enough shown to say what is wrong.
Post 30 Jul 2010, 18:06
View user's profile Send private message Visit poster's website Reply with quote
jumpex



Joined: 29 Jan 2006
Posts: 38
jumpex 30 Jul 2010, 18:35
Why not?
It's three functions calls. Speculate.

What else do you need?
Post 30 Jul 2010, 18:35
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20486
Location: In your JS exploiting you and your system
revolution 30 Jul 2010, 18:48
Posting some code that we can debug will help us to help you solve the problem.

Speculation is boring and time wasting. It is very common to find that the real problem lies somewhere else in the code that the OP never shows.
Post 30 Jul 2010, 18:48
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 30 Jul 2010, 19:02
Speculation Very Happy

dwnd is NOT a variable local to the WindowProc (and by local I don't mean only scope, also that it is isolated in a stack frame), and maybe some of those calls triggers a message and when processed some other code inside the proc destroys the variable.

Yep, we really need more. Smile
Post 30 Jul 2010, 19:02
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 30 Jul 2010, 19:12
On a less speculative thought, try adding WS_CHILD to the list of styles, I think it is important for GetDlgItem.
Post 30 Jul 2010, 19:12
View user's profile Send private message Reply with quote
jumpex



Joined: 29 Jan 2006
Posts: 38
jumpex 30 Jul 2010, 20:29
I strongly agree with the following statement.

Quote:
revolution
It is very common to find that the real problem lies somewhere else in the code that the OP never shows.


revolution, not trying to waste your time, but considering my opinion on the above, you can be sure I've ruled out the possibility.

LocoDelAssembly - it's an argument to the DialogProc, I just renamed it. Nice speculation.
And cheers for the second - that was the solution.

Thank you for the responsiveness.
Post 30 Jul 2010, 20:29
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 31 Jul 2010, 09:44
jumpex: you are the one asking others to waste their time with helping you, so you should at least be as helpful as possible when someone requests more data.
Post 31 Jul 2010, 09:44
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
jumpex



Joined: 29 Jan 2006
Posts: 38
jumpex 31 Jul 2010, 11:19
How is it that somebody HAS to play your role, vid?

1. I've got my answer.
2. LocoDelAssembly, who provided it, didn't mind me not writing out my whole source.
3. The problem was solved and, as you may have seen, it DOES NOT have to do with any other code in my program - thus, posting my whole source would have been a waste of time for revolution.
4. How are you involved in this thread in particular to judge?
5. Your post wasn't helpful to the subject of the thread (neither is this one, so I'm not planning to continue any argument here).

I don't want to be rude - I explained myself to revolution, he did not reply. It's his right not to analyze the segment I've posted, since he wants more. But posting more code is entirely my choice, since I am the one that wants help and I shouldn't/can't/won't force anybody to help me.

Again - don't take this as a rant or an insult, I just think it's fair.
Post 31 Jul 2010, 11:19
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 02 Aug 2010, 12:48
Quote:
How is it that somebody HAS to play your role, vid?

Because new members of forum who really need a bit of help often don't know yet how to properly ask for it and assist others in providing help. Rather than letting them learn themselves "how it goes", it can be faster if it is simply explained.

Quote:
1. I've got my answer.

The problem often is somewhere else, even though programmer feels he ruled out the possibility.

Besides, with full code we can just go on debugging, this way we need to create full source and insert code there to start debugging.

In fact, it is common for one who is asking for help to prepare minimal code which demonstrates his problem. And it is not uncommon to discover the bug while preparing minimal code.

Quote:
2. LocoDelAssembly, who provided it, didn't mind me not writing out my whole source.

And his answer had to be speculative, enumerating possible reasons, all of them we could check directly if you provided entire source code.

Quote:
3. The problem was solved and, as you may have seen, it DOES NOT have to do with any other code in my program - thus, posting my whole source would have been a waste of time for revolution.

From your description I am not entirely sure what was the problem, but it seems it was a name conflict (if renaming argument to proc helped). If that is the case, it DID have to with other code in your program, and you was just lucky Loco made a correct guess.

Quote:
4. How are you involved in this thread in particular to judge?

Like everyone else - I am posting to this thread to help you. I give you general advice on how to ask for help so that your chances of getting it are maxed.

Quote:
5. Your post wasn't helpful to the subject of the thread

No, it was meant to be helpful towards your future conduct as forum member, and towards getting help in your future questions.

Quote:
(neither is this one, so I'm not planning to continue any argument here).

However you wish.

Quote:
I don't want to be rude - I explained myself to revolution, he did not reply. It's his right not to analyze the segment I've posted, since he wants more. But posting more code is entirely my choice, since I am the one that wants help and I shouldn't/can't/won't force anybody to help me.

Again - don't take this as a rant or an insult, I just think it's fair.

Nobody is forcing you. I just tried to explain how to behave if you want to increase odds of getting help. Not just this time, long term.
Post 02 Aug 2010, 12:48
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
jumpex



Joined: 29 Jan 2006
Posts: 38
jumpex 03 Aug 2010, 22:47
Your first reponse was in contrast with this one, vid.
You are partially right. I wasn't trying to be rude, anyway.

As it's directly related to my original problem, the solution was the WS_CHILD style missing. (not related to another part of the code)
Post 03 Aug 2010, 22:47
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.