|
You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.
The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Debugger - Wikipedia, the free encyclopedia[^]
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
Hi; i m just confused about defaulting arguments.can someone simply explain defaulting arguments
|
|
|
|
|
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
It's simply a means to provide values for the arguments that will be a good default (or starting point).
For example, if let's say... you're opening a socket to provide some service. By default, most libraries will bind to any (or every) Ethernet address available on a system. Reason you'd want to do this is because you don't necessarily want to only provide the service on one Ethernet device but not the other (for example, servers have multiple Eth devices for load balancing). If however, you do only want the service to be provided on one device, then you can choose to bind to the specific Eth address of interest.
|
|
|
|
|
Does wp_cache still load Wordpress and use MySQL?
|
|
|
|
|
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
How to pass Array[Seq[String]] to apache spark udf? (Error: Not Applicable)
|
|
|
|
|
Is this a C / C++ / MFC question?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
How to organize nested props in VueJS?
|
|
|
|
|
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Thank you very much
|
|
|
|
|
I've used SendMessageW API to direct an EM_SETSEL message to
a designated Edit control to make it locates the searched text
entered from the another Edit control. Why it doesn't provide
visual feedback to reflect its current state?
I used Spy++ to detect the EM_SETSEL message and the message
was correctly listed in the message window.
Can anyone give suggestion?
My current development tool is MSVS Community 2015, project type is Win32 that merely uses A.P.I.
modified 19-May-16 13:01pm.
|
|
|
|
|
I have just tried this (with VS 2010 Express) and it selects and highlights the text correctly. Can you show the exact code you are using?
As a suggestion, do not use the A or W suffixes on Windows API calls. Use the base name, without the suffix, and let the compiler generate the correct call based on your projrct's Unicode/ASCII setting.
|
|
|
|
|
I've tried to omit the suffix letter and it still produced the same effect.
Below is code that sends the EM_SETSEL message to the Edit control.
int selPos = (int)(pInitialFound - lpWStr1) + 1;
int selEnd = selPos + (lstrlenW(lpWStr0));
SendMessage(hwndEdit, EM_SETSEL, selPos, selEnd);
Are there any suggestions to better correct that problem?
modified 19-May-16 13:02pm.
|
|
|
|
|
programmingalholic wrote: I've tried to omit the suffix letter and it still produced the same effect. That's because the A or W is nothing to do with your problem. That is just a suggestion for better code writing, and you should fix it in all your programs.
As to the actual problem, what are the values of selPos and selEnd when the code runs?
|
|
|
|
|
The selPos is the value denotes the first character's position of the selected text and the selEnd is the value denotes the end character's position of the selected text.
Did any VS.Community users have the same experience like me?
|
|
|
|
|
programmingalholic wrote: The selPos is the value denotes the first character's position of the selected text and the selEnd is the value denotes the end character's position of the selected text. Seriously? Richard asked what their values were, not what purpose they served.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I know that. But have you actually used your debugger to check that they are both valid at the time of your SendMessage call? Is selPos >= 0, and selEnd > selPos && < editTextLen()?
|
|
|
|
|
The selPos and selEnd had actually referred to the precise character index of the selected text. Thanks.
|
|
|
|
|
As per Richard said debug the dam thing because there is something wrong with a value and you are asking us to guess what.
However something obvious to me which you have not explained you have two different string pointers in the above lpWStr1 and lpWstr0 and since there is something wrong with selPos or selEnd which you haven't debugged is this related as no explaination of these???
In vino veritas
|
|
|
|
|
programmingalholic wrote: Below is code that sends the EM_SETSEL message to the Edit control.
int selPos = (int)(pInitialFound - lpWStr1) + 1;
int selEnd = selPos + (lstrlenW(lpWStr0));
SendMessage(hwndEdit, EM_SETSEL, selPos, selEnd);
And what are the actual values of selPos, selEnd, and the length of the text in hwndEdit edit control?
|
|
|
|
|
|
the actual value of selPos and selEnd just represent as what they are, both contained int value that denoted character index. To hwndEdit, the return value of GetWindowTextLengthW just not false ( other values than 0 ).
|
|
|
|
|
programmingalholic wrote: ...to make it locates the searched text enter from the another Edit control. This is very unclear. Are you wanting to select text (EM_SETSEL ), or get the text that is selected (EM_GETSEL )? These are two separate problems, requiring two separate messages.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
modified 20-May-16 9:27am.
|
|
|
|
|
I want to select text in the Edit control and make it has visual effect that represents the highlight of selected text. But how does WM_SETSEL come? It was undefined in the edition of my Visual Studio.
Any suggestion please??
modified 19-May-16 13:03pm.
|
|
|
|