|
You might want to pose this question to Dr. Newcomer.
The only other thing that I can offer is that:
HWND *target = (HWND *) lParam; equates to:
HWND *target;
target = (HWND *) lParam; which is different than:
*target = hWnd;
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Your explanation makes a lot of sense and I believe is the reason for what's being done.
Thanks.
William
Fortes in fide et opere!
|
|
|
|
|
I saw that David explaned that it was not a reassignment.
I hope someone knows the anwser to the implied question: What is the reason behind this?
I consider that more important, because I would have just returned the handle to hWnd or 0, instead of returning TRUE or FALSE. It would have been a lot simpler.
INTP
Every thing is relative...
|
|
|
|
|
John R. Shaw wrote: I consider that more important, because I would have just returned the handle to hWnd or 0, instead of returning TRUE or FALSE. It would have been a lot simpler.
Searcher is an EnumWindows callback function. Nowhere in the documentation (that I could find anyway) do you have access to the return value from the callback function. It is only used by the EnumWindows function as a signal to continue or stop the search. The LPARAM parameter however is guaranteed to be consistant through out the EnumWindows process. The idea behind the code is to return the HWND of the found window to the process that called EnumWindows, and it is done through the LPARAM variable.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote: Searcher is an EnumWindows callback function.
Thanks! I did not think of that.
INTP
Every thing is relative...
|
|
|
|
|
Thanks!
That clears things up.
William
Fortes in fide et opere!
|
|
|
|
|
WREY wrote: HWND* target = (HWND*)lParam; // value assigned to ptr *target = hWnd; // value assigned to ptr AGAIN!
I think he is Indirectly trying to modify lParam.
Owner Drawn
--Nothing special
|
|
|
|
|
Dear All,
I am using the IWebBrowser control as part of my project. My application browses to the internet. Whenever i browse to a certain web site, the url on the address bar does not change to match the current web page.
I am trying to get the current URL using the following method.
CString currentURL = m_webBrowser.get_LocationURL(); (where m_webBrowser is an instance of CExplorer1)
this only works if the url is manually entered in the address bar. however, If a certain web page is pursued through clicks, the above does not give any results.
In a nutshell,
can someone tell me how to retrieve the current URL of a particular web site being browsed ? (in both case, when the url is typed or if resulted from link clicks)
your suggestions would be highly appreciated.
Cheers
llp00na
|
|
|
|
|
Handle the event BeforeNavigate2 of the web browser control..The parameter VARIANT* URL, will give you the url of the page it is going to load....
|
|
|
|
|
I had a similar issue. After installing the VS2005 Pro as well as the VS2005 C++ express, I got a package load error each time I started VS2005 pro OR the vs2005 C++ express editon. I uninstalled and reinstalled several times and got the same result. I also tried using the uninstall exectutable from Microsoft to no avail.
Finally I took the following steps:
1. uninstalled EVERYTHING that had to do with Visual Studio, and .NET components (2.0, 1.1, 1.0), SQL Server and MSDN, MSXML. I mean everything. I followed the uninstall directions given in the dialog after uninstalling Visual Studio and removed/uninstalled the items in the order specified.
2. Then I went to the WINDOWS\assembly directory and deleted EVERYTHING under that directory.
3. I went to "Program Files" directory and deleted everything that had to do with Visual Studio and .NET (2.0, 1.1, 1.0) and SQL Server and MSDN.
4. I also went to the following directories and deleted everything and all directories that had to Visual Studio, SQL Server, MSDN and .NET (2.0, 1.1, 1.0)
"Documents and Settings\<username>\Application Data\Microsoft"
"Documents and Settings\<username>\Local Settings\Application Data\assembly"
"Documents and Settings\<username>\Local Settings\Application Data\Microsoft"
5. Finally I deleted all tempory files in all temporary directories and cleared the internet cache and temporary files using IE
6. I also went to "My Documents" and deleted the Visual Studio stuff there.
After all that I reinstalled VS2005 Pro and VS2005 C++ express and I no longer get the errors.
|
|
|
|
|
I looked for articles on this before asking a question on this
forum. But...
How can I add a local hotkey to an application only? I want to
add the hotkey CTRL + A and I want it to popup a dialog box.
Anyone have any sample code, instructions, or a simple demo
project?
Please, any response any one can give me will be greatly
appreciated.
My email is brinasas@yahoo.com
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
I assume you are talking about an accelerator. If so, you first need to add an entry to the accelerator table. Per MSDN:
1) Select the new-item box at the end of the list.
2) Type the key you want to use as an accelerator. The Accel Properties page appears, with the focus in the Key box.
3) Select an ID from the drop-down list in the ID box.
4) Change the modifier and type, if necessary. The modifier specifies whether the key you chose is a combination formed with CTRL, ALT, or SHIFT. The type indicates whether the key is an ASCII or a virtual key value.
5) Press ENTER.
You'll then need to call LoadAccelerators() to load the table. In your message pump, use TranslateAccelerator() .
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Take a look at RegisterHotKey, UnRegisterHotKey, WM_HOTKEY.
Happy Programming.
Owner Drawn
--Nothing special
|
|
|
|
|
How do I bold a static text control? Thanks!
|
|
|
|
|
There is a brief example here.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
|
Hi All
I am using "ISO ANSI C++",and i am beginner in C++, and i am working now in console applications , and i want to know if is there any way to control data entry in "ISO ANSI C++"
for example
close all the keyboard except the numerical keys
so user can only add numbers
thx all
|
|
|
|
|
Can you use getchar() for this?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi all,
I am Visual C++ junior in the begginer level. I encounter the problem when using some functions built in c file (such as printf("..."); ....) for my project GUI Visual C++ MFC.
ex: when button is clicked then function prinf("..") will be called. But Errors occur when I build solution.
void CButtonTestDlg::OnBnClickedButton1()
{
printf("test printf used in GUI MFC"); // error here.
}
How can I reuse all functions in c file supplied for specific device by manufacture. Thanks
MilkyWay
|
|
|
|
|
Well, you cannot use printf because there is no standard out in a Win32-based program. You can either use message boxes or change a static text item. You can start by replacing that printf statement with
MessageBox(_T("message box text in GUI MFC"), _T("test"), MB_OK);
|
|
|
|
|
Ah, it helps me a bit. Thank you.
But I have a long list of functions and few external c files.
For example:
my dlgfile.cpp in GUI has
void CButtonTestDlg::OnBnClickedButton()
{int num1 = 5; int num2 = 10; int result; int error =1;
result = sum(num1, num2); //error unresolve external symbol "int .."
result = extern sum(num1, num2); //remove above lin , extern error
//extern displayError(error, result); //erro internal compile
displayError(error, result); //error unresolve external symbol "int .."
}
my ExtFile.c has
int sum(int num1, int num2)
{int SUM;
SUM = num1 + num2;
return SUM;
}
void displayError(int error, int result)
{ printf(sum %d \n"result);
switch (error)
{case 1: printf("error 1"); break;
case 2: printf("error 2"); break;
default: printf("error unknown"); break;
}
}
... other function()
Any ideas thanks.
MilkyWay
|
|
|
|
|
Again, there is no standard out, you can't just printf characters to the console, there is no console. You can change displayError to look like this:
void displayError (int error, int result) {<br />
CString szMsg;<br />
switch (error) {<br />
case 1: { szMsg.Format ("sum %d\nerror 1", result); } break;<br />
case 2: { szMsg.Format ("sum %d\nerror 2", result); } break;<br />
default: { szMsg.Format ("sum %d\nunknown error", result); } break;<br />
}<br />
MessageBox ((LPCTSTR) szMsg, _T("Error"), MB_ICONSTOP);<br />
}
That creates a CString called szMsg. CString's have a member function called Format which you can fill the CString just as if you're using printf/sprintf. Depending on the error, it fills szMsg with the text you want. At the end, it calls MessageBox to display the text. I like to cast my CString's to regular null-terminated strings. The next item is the caption, or what's displayed in the title of the box. The last item is the icon or button style to use, I selected it to just show the traffic "STOP" sign. That will do just what you need.
|
|
|
|
|
hi everyone i'm new here and in programming too
so i have a question.
i assign char to a text field variable and on screen appear the text which i'd like to appear but after this text there are some symbols.
i think my function which converts int to char could cause this ...
here is my function :
char* CPro01Dlg::Convert(int *y, int num)
{
int i, a, b, k=0;
char *text;
text = new char [2*num];
for(i=0;i<num;i++) {
="" if(y[i]="">=0 && y[i]<10) { text[k]=y[i]+48; k++; }
else if(y[i]>=10) { a = y[i]/10; text[k]=a+48; k++; b=y[i]-a*10; text[k]=b+48; }
}
return text;
}
each y[i] is from 0 to 26
Programistebo saqartvelosi sheertdit
|
|
|
|
|
What exactly is the Convert() method supposed to do? If it is simply converting from int to char , you've got way too much code. It's not that complicated.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I am not sure what your code is realy supposed to be doing. But you can get rid of the extra simbols by simply appending a '\0' character to the end of 'text'.
I decided to rewrite your code so it makes a little more since:
char* CPro01Dlg::Convert(int *y, int num)
{
int i, a, b;
char *text;
text = new char [num+1];
for(i=0; i<num; ++i)
{
if( y[i] >= 10 )
{
a = y[i] / 10;
text[i] = a + 48;
b = y[i] - a * 10;
text[i] = b + 48;
}
else if( y[i] >= 0 )
text[i] = y[i] + 48;
}
test[i] = '\0';
return text;
}
INTP
Every thing is relative...
|
|
|
|