|
I had a test that to insert "\n" or "\r\n" into a string,but not effective. Do not support this style in vc6 default ctrl?
Please help me.Thanks a lot!
下辈子美利坚。
|
|
|
|
|
The list control only supports single-line entries.
For multi-line, you'll need to use an edit control.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Have you seen this?
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Yes,I just need it. Oh,god,thank you very much,my friend!
|
|
|
|
|
hi all,
can anybody help me to move a treeitem with its child items.
like when i use deleteitem its delete its child also,so is there any way to add its child when move a item to another location.
thanks.
|
|
|
|
|
There is no direct support to do this.
Here is a good article on how its done - Move Tree Items[^]
|
|
|
|
|
|
Hi,
All new TCP connections begin with a SYN packet... you should use your favorite search engine to investigate a 'SYN Flood'.
How To: Harden the TCP/IP Stack[^]
Also... it is very difficult to protect against these attacks from the operating system... you will be better off using a high end router to limit the rate of SYN packets. Keep in mind that 'Saying No' consumes cpu cycles... and that there is technically no defense to a massive DDOS.
The best defense is to unplug the network cable.
Best Wishes,
-David Delaune
[UPDATE]
Your problem has nothing to do with SYN Floods or DOS attacks... your source code has some serious problems.
modified 24-Feb-12 16:39pm.
|
|
|
|
|
Hi
i need some help in my work with PreTranslateMessage.
PreTranslateMessage dont work if my worker thread is runnin? I kant catch keyevents if i want to copy and paste from my CListCtrl with ctrl + c :
<br />
BOOL CMyDialog::PreTranslateMessage(MSG* pMsg )<br />
{<br />
UINT uMsg = pMsg->message;<br />
<br />
if(uMsg == WM_MOUSEWHEEL)<br />
{<br />
}<br />
return CDialog::PreTranslateMessage(pMsg);<br />
}<br />
When the workerthread ist stoped PreTranslateMessage works fine and i can cach keyboard input.
What is wrong with my code??
Best regards
bosfan
|
|
|
|
|
The code shown is OK. But we don't know what your worker thread is doing. If it is performing long operations without using wait calls, it may block other threads.
|
|
|
|
|
Hello,
worker thread fill a large CListCtrl with data etc.
I look into workerthread and try to find what causes this!
Thanks for answer.
Regards
bosfan
|
|
|
|
|
bosfan wrote: worker thread fill a large CListCtrl with data etc.
Your secondary thread should not be interacting directly with a UI control it does not own. It should be posting a message to the owning (primary) thread instead.
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi,
thanks for answer,sorry my mistake, the worker thread don't fill a list control directly,
they just fill a stl::map with data, and a owner thread(primary thread) take the
items from map and show them, is "Owner Data" of CListCtrl. This way is ok?
best regards
bosfan
|
|
|
|
|
When the worker threads runs for a significant time (above 100 ms), there should be some function calls allowing other threads to run (WaitForSingleObjectm , WaitForMultipleObjects , Sleep ).
If the worker thread runs with the same priority as the main thread, you may insert some Sleep(0) calls inside the loop to check if this allows your main thread to handle its messages. If so, you should change the worker thread in some way without using Sleep() .
You may also check the communication between worker and main thread. There may be problems even when not directly accessing UI elements. How did you send messages from the worker thread to your dialog or list control?
|
|
|
|
|
I don't use ::SendMessage(..) for this, i set a timer to set the size for this list control
with CListCtrl::SetSize(newsize) and new size is stl::map size, number of items in map.
Like you said i check first communication between worker and main thread.
I start this thread (worker) with a lowest priority.
|
|
|
|
|
if(uMsg == WM_MOUSEWHEEL)
{
return ;
}
return CDialog::PreTranslateMessage(pMsg);
}
|
|
|
|
|
Hi,
there is an return, that what i mean is i cant set a breakpoint in this function
when worker thread is running, there is an code for [strg + c] and [strg + v],
i mean for copy and paste , and this don't work and i dont know why?
Like i said before this works only if i stop a worker thread not when he is active.
So i think i do something wrong
Here is little more code:
if(WM_KEYDOWN == uMsg)
{
if(GetKeyState(VK_CONTROL) < 0)
{
if('C' == pMsg->wParam )
{
theApp.CopyToClipboard();
}
else if('V' == pMsg->wParam || 'v' == pMsg->wParam)
{
}
}
}
bosfan
|
|
|
|
|
Hi,
There is probably nothing syntactically wrong with your code. Your architecture is wrong. When worker thread B interacts with a window belonging to thread A... the windows subsystem (win32k.sys) associates thread B with the window and thread B will potentially recieve messages from the input queue... it actually depends on which thread is the 'foreground thread'.
This effectively causes worker thread B to eat your input message for lunch.
Best Wishes,
-David Delaune
P.S.
I assert that the documentation on MSDN is incomplete: About Keyboard Input[^]
The graph and description there is a simplification of what is actually happening and does not address thread groups.
Best Wishes,
-David Delaune
|
|
|
|
|
You're not trying to update the control inside of PreTranslateMessage are you?
The controls get updated from messages sent through the message pump. If you're blocking from inside of PreTranslateMessage, then your code could hang.
|
|
|
|
|
I am getting follwoing error when compiling in VS2010. The same code compiles in VC6. Any help on this?
error C2535:
d:\program files\microsoft visual studio 10.0\vc\include\xfunctional 341 TestVect
In Test.h file:
struct VerifyAddressAtAllSlots:
public binary_function<const long, const long, bool>
{
VerifyAddressAtAllSlots()
{
}
const bool
operator()(const long& thisAddress,
const long& thatAddress) const
{
return true;
}
};
In Test.cpp file:
std::vector<long> addrList;
long verifyAddress = 0;
for_each(addrList.begin(), addrList.end(), bind2nd(VerifyAddressAtAllSlots(), verifyAddress));
|
|
|
|
|
Try making the operator inline :
inline const bool
operator()(const long& thisAddress,
const long& thatAddress) const
{
return true;
}
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
I have created a toolbar in mfc. I want to add this toolbar on my dialog. So in the dialog's OnInitDialog() function I am trying to create this toolbar. But the toolbar is not coming. Please tell me how can create it.
[code]
BOOL CDlgsViewDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CToolBar toolBar;
CRect rcClientOld; // Old Client Rect
CRect rcClientNew; // New Client Rect with Tollbar Added
GetClientRect(rcClientOld); // Retrive the Old Client WindowSize
toolBar.Create(this);
toolBar.LoadToolBar(IDR_MAINFRAME);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,0,reposQuery,rcClientNew);
return TRUE; // return TRUE unless you set the focus to a control
}
[/code]
|
|
|
|
|
See here[^]
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
sujandasmahapatra wrote: CToolBar toolBar;
Shouldn't this be a member variable?
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi friends,
When i close the dialog that time OnTimer function is automaticaly killed. I dont know what is the reason behind this. For your information this dialog is added in the PropertySheet. Normally, if dialog is closed also the onTimer function keep run.. But i my case OnTimer function is get killed.
Dialog contain CaptureOn and CaptureOff button. when captureOn button is pressed that time SetTime function get invoked and CapStopWatch function is called, to calculate and display time(like stopwatch) and when i press the CaptureOff button then timer get killed.
If i press CaptureOn button and close the dialog that time OnTimer function automatically get killed. When same dialog invoked after, OnTimer called automatically, and its operate every slower(more than 1000 to 2000) but Initially i called set timer function with 100millisecond and i given code for your reference.
void CReplay::OnCaptureOn()
{
CapWatchID = SetTimer(CAP_STOPWATCH, 100, TIMERPROC);
}
void CReplay::OnTimer(UINT nIDEvent)
{
if(CapWatchID)
{
CapStopWatch();
}
}
void CReplay::CapStopWatch()
{
CString sTime;
static clock_t tThisTime;
static int TempSec=0;
static int idelay=0;
tThisTime = clock();
dMin1++;
if(dMin1 == 10)
{
double TimeDiff = (double) ( tThisTime - tSimTime ) / CLOCKS_PER_SEC;
TempSec = (int)TimeDiff;
if( TempSec >= 60 )
{
niSec++;
tSimTime = clock();
}
else
niSec++;
if( niSec >= 60 )
{
nMin++;
niSec -= 60;
}
if( nMin >= 60 )
{
nHr++;
nTotHr++;
nMin -= 60;
tSimTime = clock();
}
sTime.Format("%02d:%02d:%02d",nHr,nMin,niSec);
iHrEnd = iCurHr= nHr;
iMinEnd = iCurMin= nMin;
iSecEnd = iCurSec = niSec;
if(CaptureRunning == 1)
{
m_CaptureSW.SetFont(&StopWatchFont);
m_CaptureSW.SetWindowText(sTime);
}
else if(ReplayRunning =1)
{
m_Elapsed.SetFont(&StopWatchFont);
m_Elapsed.SetWindowText(sTime);
}
}
if(nHr==12)
nHr=0;
}
if(dMin1 >= 10)
dMin1 =0;
}
Kindly help me friends...
Regards
S.Shanmugaraja.
|
|
|
|