|
Hi,
Thanks for the reply.
I will try postmessage instead of SendMessage and
reply in case of any problems.
Thanks a lot.
Selva
|
|
|
|
|
Perhaps your problem is using the MainWnd object across threads (you didn't say if this is MFC or not, but I suspect it is).
It would be safer to either pass the hWnd of your main window in the thread parameters when you start the thread, or to use GetSafeHwnd() when you send your message.
For example:
Worker thread
{
get status from DB.
::SendMessage(GetMainWnd()->GetSafeHwnd(),PROC_MSG, wp, g_nInt)
.....
::SendMessage(GetMainWnd()->GetSafeHwnd(),PROC_MSG, wp, g_nInt)
.........
}
Also, you say the code will "look like" below. Post your actual code, including how you start the thread.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Hi all,
How can use enter key on ListCtrl.
I m using NM_RETURN but its not working, i m also check NM_KEYDOWN.
But problem is not shortout.
I want on which row of list cotrol the user pressed the enter key then the purticular relevant Column or row information get from listctrol.
How can i do this please help me for this.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
I think you should first derive a class called CMyListCtrl from CListCtrl.
from the menu [Insert]->[Class], Create your CMyListCtrl.
then open the MyListCtrl.cpp file, press CTRL+W to show the ClassWizard.
In the [Message Maps] tab, you choose the NM_RETURN, to add a function to deal with the message that the user press the ENTER key in the ListCtrl.
then in your Dlg class substitute CListCtrl with CMyListCtrl.
Hope I express my mind. And Hope it works.
|
|
|
|
|
Please tell me with example.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
LPNMLVKEYDOWN pLVKeyDow = reinterpret_cast<LPNMLVKEYDOWN>(pNMHDR);
NMLVKEYDOWN* nmkd = (NMLVKEYDOWN*)pNMHDR;
switch(nmkd->wVKey)
{
case VK_SPACE:
int nIndex= GetNextItem(-1, LVNI_SELECTED);
CString strItem = GetItemText(nIndex, 0);
AfxMessageBox(strItem );
}
*pResult = 0;
i m using thisfor keydown ,i m using key space if i m using VK_RETURN in place of VK_SPACE than its not working.(Means the message box not show)
and in case of VK_SPACE its working but after this Unhandeled exeception occur the message of exeception is "Unhandled exception at 0x5d0f0892 in Test.exe: 0xC0000094: Integer division by zero."
Please help me for this.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Do be sorry for my first reply, I've tried my first code, it doesn't work at all, sorry.
I can't see which message do you handle, But you do can ovrride the PreTranslateMessage method to achive your goal.
BOOL CListCtrlEnterKeyDlg::PreTranslateMessage(MSG* pMsg)
{
switch(pMsg->message) {
case WM_KEYDOWN:
if (VK_RETURN == (INT)pMsg->wParam && ::GetFocus() == m_ctlList.GetSafeHwnd())
{
int iSelMask = -1;
iSelMask = m_ctlList.GetSelectionMark();
if (iSelMask != -1)
{
LVITEM lvi = {0};
lvi.iItem = iSelMask;
lvi.iSubItem = 0;
lvi.mask = LVIF_TEXT;
TCHAR szBuf[50] = {0};
lvi.pszText = szBuf;
lvi.cchTextMax = 50;
VERIFY( m_ctlList.GetItem(&lvi) );
::AfxMessageBox(szBuf);
}
}
return TRUE;
default:
break;
}
BOOL bRet = CDialog::PreTranslateMessage(pMsg);
return bRet;
}
I hope this time everything will go fine.^_^
|
|
|
|
|
Thanks it really helps me.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
I have two property pages incorporated in a property sheet.
Property page 1 has a edit control and property page 2 has
a simple push button.
I have overridden the OnApply virtual function for both
the property pages.
When the property sheet is shown, I enable the 'Apply'
button by handling EN_cHANGE notification of the edit
control for Property page 1. On clicking the 'Apply'
button, I show a message defined in overridden OnApply ()
of Property Page 1 and disable the 'Apply' button by
SetModified(FALSE).
Then, I go to Property Page 2 tab and click on the button
on it to enable the 'Apply' button.Now, I click on the 'Apply'
button expecting a message defined in the overridden OnApply()
of Property page 2.
But, I get the message defined in Property Page 1 first and then
get the message in Property page 2.
To summarize, On clicking the 'Apply' button while the
Property page 2 is active, my control is going into the
OnApply() of Property page 1 and then comes into the OnApply()
of Property page 2.
Why is this happening ? Is this the expected behavior ?
Thanks in advance.
|
|
|
|
|
SherTeks wrote: Why is this happening ? Is this the expected behavior ?
This is perfectly fine. The Apply button is on the property sheet, not any individual page.
To borrow a phrase, "what would happen if it only did Apply to the current page?". It's very easy to imagine how things would break down.
If you *really* only wanted it to apply to an individual setting on a page, put a button next to that setting, rather than rely on OnApply. Or you could modify all your OnApply's to check if they're the current page. That's less hard that in sounds - you could have each page inherit from a class inheriting from CPropertyPage called
CMyPropertyPageThatBreaksUserExpectations.
(OK, my opinion is subtly encoded in the name).
I hope this helped,
Iain.
|
|
|
|
|
can any body give me an example code for how to use the function
LsaEnumerateAccountRights() ..
vineesh
|
|
|
|
|
I've just looked on MSDN for the command, and it looks fairly cleanly documented.
http://msdn.microsoft.com/en-us/library/ms721790(VS.85).aspx[^]
You pass it a couple of bits of information, it returns information which you tidy up with LsAFreeMemory.
The hard bits would be generating the SID value, and the Policy object. But if you click on the link, it gives you a nice big example on how to get it.
The below link goes to a page called "Translating between Names and SIDs", taken from the contents of the left of the MSDN site.
http://msdn.microsoft.com/en-us/library/ms722463(VS.85).aspx[^]
I hoped that helped you on your way,
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
convert this way:
WideCharToMultiByte(CP_UTF8,0,pBuf,len,pBuf_MBCS,n,NULL,NULL);
ar.Write(pBuf_MBCS,n);
ar.Close;
It seems all right until I edit the file , and save it again.
The file will be preceded by 3 bytes ahead:
EF BB BF
How to solve it?
Thanks.
system
modified on Thursday, July 10, 2008 1:26 AM
|
|
|
|
|
I am sorry what is the problem? Edit what file and using which editor? If some editor is not saving properly then how is that a programming question?
-Saurabh
|
|
|
|
|
edit the saved file using notepad.exe shipped with windows xp (sp3)
system
|
|
|
|
|
That's the Unicode[^] Byte Order Mask[^] which the editor is inserting. I suggest you make your software handle it.
Steve
|
|
|
|
|
Helpful, thanks.
I choosed to use CP_ACP instead of CP_UTF8, no preceeding will be added automatically, well enough.
system
|
|
|
|
|
followait wrote: I choosed to use CP_ACP instead of CP_UTF8, no preceeding will be added automatically, well enough. [Smile]
The text editor is adding them, not Windows.
Steve
|
|
|
|
|
notepad.exe in windows xp sp3 will add the preceding if windows thinks there is needs (eg. contains UTF-8 encode characters).
system
|
|
|
|
|
I that a question? If so I believe the answer is yes.
Steve
|
|
|
|
|
Hi all,
for printing i taking help with this article.
http://www.codeproject.com/KB/printing/QPrint.aspx[^]
With the help of this article the printing is done,But there is no option of print preview.
I want to seen first privew then printing.
What can i do please help me for this.
Thank in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
I suggest you read Roger Allen's articles[^] - he's written lots about printing, and print previewing, and the complex code plumbing needed.
All you ever wanted to know about printing, and never dared ask...
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
I am a Chinese girl,study Programming presently.Last year,I graduated from university.Now I an a software engineer .My English is not very good,so I want to find a friend who can keep Email with me in English .Beacause I want to study English truely.
If you can help me,please write a letter to me.
My E-mail:yangjinna66@163.com
My MSN:halibobo-520@163.com
I am waiting for your letter! thank you!
//??????????? ,?????????????,??,??????,??????????????
|
|
|
|
|
This is not a grammar class and it seems you have read out queries in ENGLISH and !(read not) with C++ perspective. Look closely most of the questions are related to C++ however "THEY" (the programmars here) do use ENGLISH to convey their problems.
If your english is not good how come you wrote all those lines in your query.
halibobo wrote: My MSN:halibobo-520@163.com
Apart from COM(in your email id) there is nothing that resembles with C++/MFC/ATL in general
IMHO, you should try and look for some english tutorials and
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
modified on Thursday, July 10, 2008 3:42 AM
|
|
|
|
|
Thanks for your reply,From your talking, i have trust in the future,through I writing this reply spend much time.
"Apart from COM(in your email id) there is nothing that resembles with C++/MFC/ATL in general "
----I don't know others web I can write this message.
|
|
|
|