|
Peter Weyzen wrote:
Howdy out there...
For use as inter-thread locks -- are mutex's better than critical sections?
If Under Same Process Critical Section would be better otherwise Mutex!
"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
Support CRY- Child Relief and You
|
|
|
|
|
Hi all,
I have a probelm with the help file of my project. I have a user interface. if the user focus on the control ( such as button, editbox, combobox, etc...) and press F1, i need to display the help file for the focussed control. I created the help file and linked everything. But now the problem is, if i focus on edit control and press F1, help file open and minimized to taskbar. But for other control, it opens in the maximized window. I use the same function to display the help file for all control.
Can anyone please help me in this to make the minimized help window in taskbar to a maximized window in the display?
Thanks in advanve.
Regards,
Ram
|
|
|
|
|
Use spy++ to look at what messages are sent to the controls and the help window when you press F1. You should be able to see what the difference is and code around it
Objects in mirror are closer than they appear
|
|
|
|
|
Does anyone know how to set the keepAliveTime on a per (tcp) socket basis? I know you can change the system wide value by changing the registry key HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters, but I thought I read somewhere that you can change it on a per-socket basis on Windows 2000 and later ... but I just can't find any examples anywhere...
cheers,
Neil
|
|
|
|
|
I don't believe it can be changed per-socket, only per-process, and it's likely not what you want to do anyways.
See: http://tangentsoft.net/wskfaq/newbie.html[^] 2.13.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
There is none per socket, you probably want to implement an application specific keep-alive mechanism (e.g. for a faster detection time of dead connections). I can recommend reading the book "Effective TCP/IP Programming" from Jon Snader.
|
|
|
|
|
Hi. I tried to detect all running user applications (no all processes) and close them all. Obviously this is a usual function that has been existing in many programs.
I used the ::EnumWindows API to enumerate all the windows. There are a lot of irrelevant result so I have to use some filters. One of them is to filter out the invisible windows.
But unfortunately this filter also filters out the applications that was minimized in to a tray icon. But if I turn off this filter, a lot of irrelevant system processes and other hidden windows will get through as well. I have no way to tell which one among them is user application, which one is not.
I noticed that the taskmgr program in windows has the same problem. It doesn't display the tray icon programs. Instead, it only displays their processes in the processes list.
I have imagined that if there is API to enumerate the applications that has a tray icon, it would solve my problem. Or maybe there is a better way to get the list of user applications rather than using ::EnumWindows, but I have no clue about it.
So anyone of you has a thought?
Thanks very much!
|
|
|
|
|
Just a guess, but take a look at EnumProcesses and/or CreateToolhelp32Snapshot . According to MSDN these functions can be used to list all processes running on the system.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Hey I'm a rookie and I want to get familiar with WFC libary.
I have problems in installing (using) this libary. I followed all the steps from the Tehnical Notes but I can't get it to run. I get this message error:
----------------------------------------------------------------------
WARNING! You are compiling for a version of NT before 4.0, you may have problems in the RAS stuff.
You will probably have problems in the RAS stuff.
Don't be suprised is TryEnterCriticalSection fails too.
To get rid of this warning, add WINVER=0x401 to the Preprocessor definitions in the project settings.
Using MFC in a Shared DLL.
Linking with DebugBuildOfWFC.lib
Linking...
LINK : fatal error LNK1104: cannot open file "DebugBuildOfWFC.lib"
Error executing link.exe.
Creating browse info file...
dummy.exe - 1 error(s), 0 warning(s)
-----------------------------------------------------------------------
The code that generates this error is:
-----------------------------------------------------------------------
#include <wfc.h>
#pragma hdrstop
int _tmain( void )
{
CString version_string;
wfc_get_operating_system_version_string( version_string );
_tprintf( TEXT( "%s" ), (LPCTSTR) version_string );
return 0;
}
-----------------------------------------------------------------------
I maneged to built the WFC.lib, but I can't use it. I would really need some
help or suggestions. I can't go on without this. Thanks.
|
|
|
|
|
Star_dust wrote: LINK : fatal error LNK1104: cannot open file "DebugBuildOfWFC.lib"
I've never used WFC before but from the error message, build the debug build of the WFC library. Make sure it's named DebugBuildOfWFC.lib and make sure that the linker can find it on one of the paths.
|
|
|
|
|
Thank you for your response, but how can I BUILT THE DEBUG of the WFC library?
I builted the wfc.lib . I have two *.lib files in WFC directory (WFC.lib, UnicodeSTLWFC.lib) I don't know how to make the DebugBuildOfWFC.lib
|
|
|
|
|
It should be one of the configurations for the project.
|
|
|
|
|
Hi everybody. Long time no messaging. I got an easy question. How can you make a window with a thin (2D) border? BECAUSE I DID THIS IN THE PAST! Less than 3 weeks ago! And now I can't do it any more. It's incredible! I'm totally frustrated! I tried combining so many flags that I think I went through all the possible combinations except the right one.
Take for example this simple way to create a window in a standard Win32 application. This shoud create that 2D window but it's still 3D!!! I remember that in the past when I removed that WS_THICKFRAME attribute, it looked 2D. But it isn't working any more. Aaaaaaaaargh!!!!!
<br />
LRESULT CALLBACK WindowEngine (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)<br />
{<br />
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}<br />
<br />
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)<br />
{<br />
MSG Msg;<br />
WNDCLASSEX wceData;
HWND a;<br />
<br />
wceData.cbSize = sizeof(wceData);<br />
wceData.style = 0;<br />
wceData.lpfnWndProc = WindowEngine;<br />
wceData.cbClsExtra = NULL;<br />
wceData.cbWndExtra = NULL;<br />
wceData.hInstance = hInstance;<br />
wceData.hIcon = NULL;<br />
wceData.hCursor = LoadCursor(NULL, IDC_ARROW);<br />
wceData.hbrBackground = NULL;<br />
wceData.lpszMenuName = NULL;<br />
wceData.lpszClassName = "testClass";<br />
wceData.hIconSm = NULL;<br />
RegisterClassEx(&wceData);<br />
<br />
a = CreateWindowEx<br />
(<br />
NULL,<br />
"testClass",<br />
"Some title",<br />
WS_OVERLAPPEDWINDOW &~ WS_THICKFRAME,<br />
10,<br />
10,<br />
100,<br />
200,<br />
NULL,<br />
NULL,<br />
NULL,<br />
NULL<br />
);<br />
<br />
ShowWindow(a, 1);<br />
<br />
while(GetMessage(&Msg, NULL, 0, 0) > 0)<br />
{<br />
TranslateMessage(&Msg);<br />
DispatchMessage(&Msg);<br />
}<br />
return 0;<br />
}<br />
-= E C H Y S T T A S =-
The Greater Mind Balance
Blending C++ with COM ^
-- modified at 17:14 Tuesday 11th July, 2006
|
|
|
|
|
Hope this helps (taken from MS Win32 Developer's Reference)
CreateWindow dwStyle parameter
Axonn Echysttas wrote: WS_THICKFRAME
Creates a window that has a sizing border. Same as the WS_SIZEBOX style.
Axonn Echysttas wrote: thin (2D) border
WS_BORDER Creates a window that has a thin-line border.
WS_CAPTION Creates a window that has a title bar (includes the WS_BORDER style).
modified 1-Aug-19 21:02pm.
|
|
|
|
|
Hi Richard. Nope, unfortunately it doesn't help. Did you try WS_BORDER with the code above? If you put that WS_BORDER style, the window will still have a title bar. There is not noticeable difference between WS_BORDER and WS_CAPTION.
Pf... totally weird. WS_POPUP | WS_BORDER creates something of a 2D window but I am definitely sure that I was able to create a window with caption, maximize, minimze buttons AND 2D ASPECT! And now I can't do it no more. Aarggggghh! I'm so pissed off! I gotta dug up from the grave some of my old code apparently.
-= E C H Y S T T A S =-
The Greater Mind Balance
Blending C++ with COM ^
|
|
|
|
|
I need a way of limiting the user to enter only integers. The code below goes in an endless loop if any character other than a digit is entered on the screen. I can not use the isdigit() or isalpha() functions as they can only be used for character types. How should I change my test condition to accommodate this? The data2 variable is of type int.
while ((data2 <= 0) || (data2 > 12))
{
cout << "Please subunit number: ";
cin >> data2;
cin.getline(buffer, 99, '\n');
}
-- modified at 16:52 Tuesday 11th July, 2006
|
|
|
|
|
Harold_Wishes wrote: while ((data2 <= 0) || (data2 > 12))
{
cout << "Please subunit number: ";
cin >> data2;
cin.getline(buffer, 99, '\n');
}
Do you mean to have your range of valid values to be (-inf, 0) U (13, inf)? I think you mean to do this:
while (data2 >= 0 && data2 < 12)
{
cout << "Please subunit number: ";
cin >> data2;
cin.getline(buffer, 99, '\n');
}
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
I want to allow integers greater than zero and less than 12. Initially I used the && operator. But when I type in a number out of this range, it jumps out of the while loop and never asks me to enter a valid number. Oddly enough, it worked with the || operator with the screen prompting me as appropriate for numbers out of range. But the program fails in both cases if I type in a non-numeric value.
|
|
|
|
|
Harold_Wishes wrote: I want to allow integers greater than zero and less than 12.
(data2 <= 0) || (data2 > 12)
That will allow all integers below or equal to 0 or greater than 12, but reject anything that is from 1 to 11. What you want is: (data2 >= 0 && data2 < 12) .
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Personally, I'd let the user enter whatever and not read anything until he or she hits enter. After he or she hit enter I'd try and decide if what they typed was a valid number; doing something like
<code>
char buff[1024]; //whatever the user entered
unsigned int value;
int charsRead;
bool validEntry = false;
while(!validEntry) {
//prompt the user
//get a line from the user via whatever method...
if (sscanf(buff, "%u%n", &value, &charsRead) == 1) {
//can further compare charsRead w/ strlen if you want, ie
//test strlen(buff) == charsRead
//
validEntry = true;
}
}
</code>
earl
-- modified at 19:14 Tuesday 11th July, 2006
|
|
|
|
|
earl wrote: Personally, I'd let the user enter whatever and not read anything until he or she hits enter.
That is what cin does ... with far less code.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi all could any one show me how to collect the bold part data from a webbrowser controle . I want to collect those data and place them in a listview and use the color code to color the name in listview. I be happy if some one show me how this can be done. The nubmer of rows in the table are dynamic.Thanks
Note: i want to extract the name and color1 and color2 data from webbrowsser controle as shown in pic
[IMG]http://i5.photobucket.com/albums/y180/method007/extractData.jpg[/IMG]
webbrowser html code:
<html><br />
<br />
<head><br />
<meta http-equiv="refresh" content="60"><br />
</head><br />
<br />
<br />
<p><ul><table border=1 cellpadding=4<br />
<br />
<tr><th>Name</th> <th> color </th> <th> color2 </th> </tr><br />
<tr><td><font color="0800">tony</font></td> <td>32768</td> <td>0800</td><br />
<br />
<tr><td><font color="FF0FF">cindy</font></td> <td>16711935</td> <td>FF0FF</td><br />
<br />
<tr><td><font color="800FF">sarah</font></td> <td>16711808</td> <td>800FF</td> <br />
<br />
</table><br />
</body><br />
</html>
|
|
|
|
|
See here. Use "TD" instead of "FONT" for pcVal .
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
david i am new to visual c++ 6 . i came from visual basic 6 and it is hard for me to use that code. could u tell me step by step how to use that code. I do not know how to implement it. i already have an mfc form with webbrowser on it that loads a specific webpage . I do not know how use your code to extract that data i want. could u tell me how to use u code ? where to place and how to feed it with my html ....
|
|
|
|
|
method007 wrote: could u tell me step by step how to use that code.
You'll need this in your CDialog -derived class:
BEGIN_EVENTSINK_MAP(CMyDialog, CDialog)
ON_EVENT(CMyDialog, IDC_EXPLORER, 259 , OnDocumentCompleteExplorer, VTS_DISPATCH VTS_PVARIANT)
END_EVENTSINK_MAP() Then put that other code into:
void CMyDialog::OnDocumentCompleteExplorer(LPDISPATCH pDisp, VARIANT FAR* URL); After the DocumentComplete event has been received, the OnDocumentCompleteExplorer() method can then be used to extract the data.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|