|
I've read this kind of tutorial in msdn:
<url=http: msdn.microsoft.com="" library="" default.asp?url="/library/en-us/winui/WinUI/WindowsUserInterface/Resources/Cursors/UsingCursors.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Resources/Cursors/UsingCursors.asp
I'm doing an mfc app, and that seems winampi, but i tried to implement what's there anyways.
first of all, in my dialog class i've got these member variables
HINSTANCE hinst;
HCURSOR hCursor;
In the constructor of the dialog i've got:
hCursor = LoadCursor(hinst, MAKEINTRESOURCE(IDC_LAPIZ_CUR));
then i've got this:
BOOL CVentanaPizarra::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if (changecursor==true)
{
SetCursor(hCursor);
}
return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
so, when i press a button, the changecursor variable is set to true.
But it still doesn't show the cursor when i press that button
what am i doing wrong?
|
|
|
|
|
kfaday wrote:
hCursor = LoadCursor(hinst, MAKEINTRESOURCE(IDC_LAPIZ_CUR));
Ouch. You are not initializing hinst to the application instance handle.
Rewrite to:
hCursor = LoadCursor(AfxGetResourceHandle(), MAKEINTRESOURCE(IDC_LAPIZ_CUR));
kfaday wrote:
BOOL CVentanaPizarra::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if (changecursor==true)
{
SetCursor(hCursor);
}
return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
what am i doing wrong?
You are calling the base class implementation in OnSetCursor. Rewrite to:
BOOL CVentanaPizarra::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
BOOL result = TRUE;
if (changecursor==true)
{
if( SetCursor(hCursor) )
result = TRUE;
}
else
result = CDialog::OnSetCursor(pWnd, nHitTest, message);
return result;
}
|
|
|
|
|
thank you very much for your help!!
it worked!
|
|
|
|
|
|
Hi guys,
I've written a very simple chat/message-application, when I compiled it I had no errors and even no warnings. So I thought my application is ready to execute and than the hell breaks out!
It is very frustrating , first I had 120 errors or more, than I reduced to 0 , so I thought now my application is ready to start than I got the message: Debug Assertion Failed . I could choose to break, again, or ignore.
Can anybody help me please ? I don't know what that message mean and what went wrong.
Come on guys you can do it, you helped me out once before and I'm sure you can do it again now!
(I'm sorry for my bad English, I'm from Holland and my dutch is worse )
Peace!!
|
|
|
|
|
Where does the assertion occur?
Kuphryn
|
|
|
|
|
Hi Kuphryn
The assertion failure occurs when I try to execute my application. I mean execute from Visual C++ (6.0), than I get a dialogbox with "Debug Assertion Failed"
So I hope can help me my friend
|
|
|
|
|
Try debugging your software. Look at the line of code that generated the assert. Usually they will document what the problem is or it will be obvious looking at the source.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
If you press 'Abort' (or whatever that might be in Dutch ), the debugger will stop at the ASSERT in the MFC source code. More often than not, there will be a comment giving the reason for the problem. ASSERTs are a way for the code telling that some condition is not fullfilled at this point of the execution.
BTW, a clean compile does in no way mean you have an even mildly runnable program, only that the compiler and linker successfully converted your instructions to a binary file. This has the implication that you will have to test your application after it is written, something that comes as a surprise to many developers, newbies and experiences alike
|
|
|
|
|
1) Choose to break (not abort or ignore).
2) View->Debug Window->Call Stack (or ALT+7)
3) Look at what caused the assertion.
4) Trace backward thru the callstack untill you reach the line in your code that made origanal call (checking values as you go).
Note: At this point you can place a break point at the code line in your code and stop the debugging session via the debug menu. The restart the program and single step forward if you want (some time thou it may make serveral call before one of them fails).
Good Luck!
INTP
|
|
|
|
|
|
Hi everyone...
Please i'm getting nuts with this...some activex controls when my project is compiled they don't appears on the dialog, such as Microsoft forms 2.0 (Fm20.dll) and Microsoft Datagrid 6.0 control (msdatgrd.ocx).
I think it's weird cos in another project everything is doing fine, they appears...i think the problem isn't dll's or ocx's files, is there something wrong in my project file?
Please help me with this.
thanks in advance
|
|
|
|
|
Hi,
i have the same problems.
it happens in my programms, when i have more then two windows above each other. dialog1 calls dialog2->DoModal(), dialog2 calls dialog3->DoModal(). The
ActiveX-Elements will not appear in Dialog3.
So, what I did, i put them in a dialog in a dll. then they work.
not really a help, but a information.
|
|
|
|
|
anyway you have a found a way out...i'll follow...
thanks for the hint George.
|
|
|
|
|
how do I make a chat bot with C++
|
|
|
|
|
the way you like...
be more explicit in your question please.
TOXCCT >>> GEII power
|
|
|
|
|
Using your brain!
You set the server that you will make .... that when it will receive certain messages will answer.
And this will way you will configure your virtual bot (the server) the way you want
gabby
|
|
|
|
|
you would need to use WinSock
Bikram Singh
|
|
|
|
|
hi guys,
I m very new to using VC++.Can anybody tell me how can i add property pages to a dialog box, so that all the other controls also remain in place.
Aarti Vimal
Scientist 'B'
Defence research & Development Organisation,
Bangalore,
Karnataka,
India.
|
|
|
|
|
Describe more on what you are trying to accomplish.
Kuphryn
|
|
|
|
|
Hi guys,
I have a CListCtrl control inserted to my dialog app (MFC). I needed to customise the text display on the control and from Michael's suggestion (Thanks, Mr. Dunn!), I tried using LVN_GETDISPINFO message, which calls my OnGetDispInfo function. The problem is that the callback doesn't seem to get call when already using LPSTR_TEXTCALLBACK .
The message map is created as below:
<code>
ON_NOTIFY_REFLECT(LVN_GETDISPINFO, OnGetDispInfo)
and the callback function is decalred in my CMyDlg class.
<code>
afx_msg void OnGetDispInfo(NMHDR* pNMHDR, LRESULT* pResult);
I add items to the control (m_TaskList) using the way below:
<code>
m_TaskList.InsertItem(LVIF_TEXT|LVIF_STATE, itemCount, LPSTR_TEXTCALLBACK, LVIS_SELECTED, LVIS_SELECTED, 0, 0);
and the following callback function is never called,
<code>
void CMyDlg::OnGetDispInfo(NMHDR *pNMHDR, LRESULT *pResult)
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
if (pDispInfo->item.mask & LVIF_TEXT)
pDispInfo->item.pszText = _T("Testing");
*pResult = 0;
}
Can anyone spot where I have done wrong?
Thanks alot
|
|
|
|
|
What change?
You have to explicitly notify the list control upon a change. One example is LVM_INSERTITEM.
Kuphryn
|
|
|
|
|
Thanks for the reply Kuphryn,
I'm not quite sure if I understand what you mean. In MFC, when I'm calling InsertItem() on the CListCtrl control, it euqally means sending the notification LVM_INSERTITEM to the control. Doesn't it?
Thanks again.
|
|
|
|
|
You're not receiving the LVN_GETDISPINFO message, correct? I'm saying that you have to update the list control via sending its a message if you want to to make the change.
Kuphryn
|
|
|
|
|
Doesn't the call
<code>m_TaskList.InsertItem(LVIF_TEXT|LVIF_STATE, itemCount, LPSTR_TEXTCALLBACK, LVIS_SELECTED, LVIS_SELECTED, 0, 0);
mean sending a message (LVM_INSERTITEM) to the control and update it according to specified information?
LPSTR_TEXTCALLBACK tells the control the text is a callback item, so will call OnGetDispInfo()
Why do I have to explicitly send message to the control again? Am I missing something?
Thanks again
|
|
|
|