Generating Control ID
-
I ll be having a array of controls all of whose parent is same . now since these controls are created at runtime I cannot assign a Id to it at programing time. How do I generate a uniqe Id each time I create a new CWnd derive control ? I wish I could rate Gurus the way its on Codeguru . in any case any help would be appreciated. Abhishek Narula "Learn to appreciate others ... World would appreciate you"
-
I ll be having a array of controls all of whose parent is same . now since these controls are created at runtime I cannot assign a Id to it at programing time. How do I generate a uniqe Id each time I create a new CWnd derive control ? I wish I could rate Gurus the way its on Codeguru . in any case any help would be appreciated. Abhishek Narula "Learn to appreciate others ... World would appreciate you"
Start with some value and increment it each time you're adding a control. If you have a mixed situation - your controls and controls created by some other code, you may use EnumChildWindows. For each HWND returned, check the id with GetWindowLong(hwnd, GWL_ID). Calculate max existing ID, add 1 and create control. Abhishek Narula wrote: wish I could rate Gurus the way its on Codeguru . in any case any help would be appreciated. Stop brown-nosing. ;) Tomasz Sowinski -- http://www.shooltz.com
-
Start with some value and increment it each time you're adding a control. If you have a mixed situation - your controls and controls created by some other code, you may use EnumChildWindows. For each HWND returned, check the id with GetWindowLong(hwnd, GWL_ID). Calculate max existing ID, add 1 and create control. Abhishek Narula wrote: wish I could rate Gurus the way its on Codeguru . in any case any help would be appreciated. Stop brown-nosing. ;) Tomasz Sowinski -- http://www.shooltz.com
What is the definition of some value ?? can I start with any arbitrary value ?? Abhishek Narula "Learn to appreciate others ... World would appreciate you"
-
What is the definition of some value ?? can I start with any arbitrary value ?? Abhishek Narula "Learn to appreciate others ... World would appreciate you"
Abhishek Narula wrote: can I start with any arbitrary value ?? Yes, if parent window contains only children created by your code. Tomasz Sowinski -- http://www.shooltz.com
-
Abhishek Narula wrote: can I start with any arbitrary value ?? Yes, if parent window contains only children created by your code. Tomasz Sowinski -- http://www.shooltz.com
No there would be so many other things like so many input dialogs etc .. Can also explain what is WM_USER constant ? and can we some how use this ? Abhishek Narula "Learn to appreciate others ... World would appreciate you"
-
No there would be so many other things like so many input dialogs etc .. Can also explain what is WM_USER constant ? and can we some how use this ? Abhishek Narula "Learn to appreciate others ... World would appreciate you"
Abhishek Narula wrote: No there would be so many other things like so many input dialogs etc .. So you have to use EnumChildWindows/GetWindowLong to enumerate all existing children IDs. Calculate the max value, add 1, and use as start ID. Abhishek Narula wrote: Can also explain what is WM_USER constant ? and can we some how use this ? No, WM_USER is not about control IDs. It's about messages. Tomasz Sowinski -- http://www.shooltz.com
-
We like it this way: we can give bad advice and not be held accountable for it!!!! Sorry to dissapoint you all with my lack of a witty or poignant signature.
Should I contact my lawyer? :-D Tomasz Sowinski -- http://www.shooltz.com
-
Start with some value and increment it each time you're adding a control. If you have a mixed situation - your controls and controls created by some other code, you may use EnumChildWindows. For each HWND returned, check the id with GetWindowLong(hwnd, GWL_ID). Calculate max existing ID, add 1 and create control. Abhishek Narula wrote: wish I could rate Gurus the way its on Codeguru . in any case any help would be appreciated. Stop brown-nosing. ;) Tomasz Sowinski -- http://www.shooltz.com
We like it this way: we can give bad advice and not be held accountable for it!!!! Sorry to dissapoint you all with my lack of a witty or poignant signature.