|
Hi all,
I need to select items in a tree with Ctrl and other keys
like ctrl+up arrow , ctrl+down arrow for traversing through the items and on on pressing ctrl+spacebar the item shud get selected.
I want to know when the setfocus() is called
when pressing ctrl+VK_UP
|
|
|
|
|
I have a socket server that is to establish a connection with only one client. I can accept the client fine and also receive the data from the client. My problem is that every time I want to reconnect to the server, I get a error message.
Debug Assertion Failed!<br />
<br />
Program: D:\TempProject\Debug\TempPrj.exe<br />
File: sockcore.cpp<br />
Line: 177
When I try and debug it says an unexpected breakpoint has been reached....
What does I have to do when the client disconnects? How do I get the server to come back up in the Listen() state again?
Thanks for helping a noob out.
|
|
|
|
|
NYTSX wrote: My problem is that every time I want to reconnect to the server, I get a error message.
I believe you are accepting the New Socket Connection on same variable without properly closing it...
First make a call to Close().. before acception new connection!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I do call Close() when the disconnect button is pressed. At that point I also do a Listen() which I figured would allow for the next client to connect to the server?
Any more suggestions? Would this be sufficient to have the server always be ready to accept a connection when one is not already established?
|
|
|
|
|
Hi,
I have this code to draw a progress bar at run time, but I dont' want the user to resize it. So is there any way by which I could restrict the user from resizing it.
CProgressCtrl m_ProgressBar;
m_ProgressBar.Create(WS_CHILD|WS_VISIBLE|WS_THICKFRAME ,
CRect(10,rectWnd.top + headerHeight+55,window.Width()-2*10,20),
(CWnd *)this, IDC_PROGRESSBAR);
I think will have to add some WS_ option but don't know exactly.
Thanks,
PJ
|
|
|
|
|
Unless I'm missing something here, controls are not normally resizeable at runtime.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
But I draw other controls like button, edit box, group box, They are not resizable..
Thanks,
|
|
|
|
|
PrashantJ wrote: But I draw other controls like button, edit box, group box, They are not resizable..
My point exactly.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Remove the WS_THICKFRAME style.
Good luck.
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
No that didn't work
|
|
|
|
|
On the surface it doesn't make sense, but I recall 'PJ Arends' mentioned something about it in one of his articles, and now I see something similar to it in another article, which is causing me to try and remember the real reason behind its use.
Here's the code.
BOOL CALLBACK CMyApp::searcher(HWND hWnd, LPARAM lParam)
{
DWORD result;
LRESULT ok = ::SendMessageTimeout(hWnd,
UWM_ARE_YOU_ME,
0, 0,
SMTO_BLOCK |
SMTO_ABORT_IF_HUNG,
200,
&result);
if(ok == 0)
return TRUE;
if(result == UWM_ARE_YOU_ME)
{
HWND* target = (HWND*)lParam;
*target = hWnd;
return FALSE;
}
return TRUE;
}
Is there a reason for the reassigning of a value to the same variable in this manner?
William
Fortes in fide et opere!
|
|
|
|
|
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!
|
|
|
|