|
Using DirectX for a commercial application does not require paying a license.
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
|
|
|
|
|
Daniel Kanev wrote: do I have to pay Microsoft for that
No. Last time I checked, you have to pay ME to do that
|
|
|
|
|
Hi all,
I've a button to move to the next point in a plot
when the button is pushed.
The matter is that i must click on the button many times
if i wanna continue to pass to the next point in the plot,
while i would like to obtain this keeping clicked the button.
How can i do that ?
Thanx in advance,
Desmo16.
|
|
|
|
|
OnButtonDown:
start a timer
OnTimer:
move the selection to the next point
OnButtonUp:
stop the timer
|
|
|
|
|
I suggest you override CButton and create a button class that repeats the BN_CLICKED event.
Have a look at Joe Newcomer's article here[^] for tips on how to accomplish this behaviour.
You could even have more than one timer event to make the BN_CLICKED events generated with higher frequency if the button is kept down for a longer time.
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
Desmo16 wrote: The matter is that i must click on the button many times
if i wanna continue to pass to the next point in the plot,
while i would like to obtain this keeping clicked the button.
How can i do that ?
Set timer and send BN_CLICKED message from it!
"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
I want to get the Windows TaskBar Height and Width in MFC.
Any API's are welcome
Thanx in advance
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
Hello!
HWND hWnd = FindWindow("Shell_TrayWnd","");
if(hWnd != NULL)
{
RECT rect;
GetWindowRect(hWnd, &rect);
int height = rect.right - rect.left;
int width = rect.bottom - rect.top;
}
modified 8-Mar-17 3:53am.
|
|
|
|
|
I suppose you could subtract the height of the desktop's client area (i.e., SystemParametersInfo(SPI_GETWORKAREA, ...) ) from the height of the screen (i.e., GetSystemMetrics(SM_CYSCREEN) ). The difference would be the height of the taskbar. For an MFC solution, something like:
CWnd *pTaskbar = CWnd::FindWindow("Shell_TrayWnd", NULL);
CRect rc;
pTaskbar->GetWindowRect(rc);
int nWidth = rc.Width();
int nHeight = rc.Height();
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Call SHAppBarMessage(ABM_GETTASKBARPOS) . No sense searching through windows when there's an API that does exactly what you want.
|
|
|
|
|
According to the API description you have to pass the hwnd of your taskbar. :/
SHAppBarMessage(ABM_QUERYPOS, pabd);
pabd
A pointer to an APPBARDATA structure. The uEdge member specifies a screen edge, and the rc member contains the proposed bounding rectangle. When the SHAppBarMessage function returns, rc contains the approved bounding rectangle. You must specify the cbSize, hWnd, uEdge, and rc members when sending this message; all other members are ignored.
Source: msdn
|
|
|
|
|
How can i test with C++ if i had the mode "do not display content while moving windows" in windows desk properties settings.
To get this mode:
-right click on windows desktop, choose general settings
-Tab "appearance"
-clic on Effects.
|
|
|
|
|
Have a look at the MSDN documents for the SystemParametersInfo[^] API - the SPI_GETDRAGFULLWINDOWS flag in particular.
Your code should end up something like this:
BOOL bResult = FALSE;
if( SystemParametersInfo( SPI_GETDRAGFULLWINDOWS, 0, & bResult, 0 ) )
{
if( bResult )
MessageBox( NULL, TEXT( "on" ), 0, 0 );
else
MessageBox( NULL, TEXT( "off" ), 0, 0 );
}
|
|
|
|
|
|
Rather than starting a new thread, I will attach my question here since it is related.
Is it possible to enable/disable this setting for a single application at runtime? Ie, I do not want my app to display it's contents while sizing, but I don't want to change the registry as it would effect all other windows.
|
|
|
|
|
Windows itself doesn't provide a way to disable full window drag for a specific application / window. The only way I can think of would be to intercept the windows move / resize messages and disable the effect on the fly using SPI_SETDRAGFULLWINDOWS which is really a hack and definately not recommended.
Having just done some digging around this[^] article touches on the subject of drawing your own drag boxing, whilst not totally what your after you could to use that as a good starting pointing.
|
|
|
|
|
Thanks for the link. It has put me a little closer to achieving my goal. Though if I can get my GDI routines to work faster I may not even need to draw a drag box.
|
|
|
|
|
dll problem,help me
i create dll project ,the dll is Use MFC in a Static Library
i hope exe call ListCtrl class from dll
==================DLL====================
<<<<<<<<<<listctrl.h>>>>>>>>>>>>>>>
#pragma once
class AFX_EXT_CLASS ListCtrl :public CListCtrl
{
public:
__declspec(dllexport) ListCtrl();
__declspec(dllexport) ~ListCtrl();
public:
DECLARE_MESSAGE_MAP();
public:
afx_msg void OnNMClick(NMHDR *pNMHDR, LRESULT *pResult);
};
<<<<<<<<<<<listctrl.cpp>>>>>>>>>>>
#include "Stdafx.h"
#include "ListCtrl.h"
ListCtrl::ListCtrl()
{}
ListCtrl::~ListCtrl()
{}
BEGIN_MESSAGE_MAP(ListCtrl,CListCtrl)
ON_NOTIFY_REFLECT(NM_CLICK, &ListCtrl::OnNMClick)
END_MESSAGE_MAP()
void ListCtrl::OnNMClick(NMHDR *pNMHDR, LRESULT *pResult)
{
AfxMessageBox(_T("OK"));
*pResult = 0;
}
=====================EXE============================
i Create Exe,the exe is Use MFC in a Static Library
<<<<<<<<<<<testdlg.h>>>>>>>>>>>>
#pragma comment(lib,"Dll.lib")
#include "ListCtrl.h"
class TestDlg : public CDialog
{
DECLARE_DYNAMIC(TestDlg)
public:
TestDlg(CWnd* pParent = NULL); // standard constructor
virtual ~TestDlg();
enum { IDD = IDD_DIALOG1 };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
ListCtrl m_ListCtrl;
};
<<<<<<<<<<<<<<<testdlg.cpp>>>>>>>>>>
#include "stdafx.h"
#include "Test.h"
#include "TestDlg.h"
IMPLEMENT_DYNAMIC(TestDlg, CDialog)
TestDlg::TestDlg(CWnd* pParent /*=NULL*/)
: CDialog(TestDlg::IDD, pParent)
{}
TestDlg::~TestDlg()
{}
void TestDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LIST1, m_ListCtrl);
}
BEGIN_MESSAGE_MAP(TestDlg, CDialog)
ON_BN_CLICKED(IDOK, &TestDlg::OnBnClickedOk)
END_MESSAGE_MAP()
======================
the exe project call ListCtrl from dll project
Mouse click the m_ListCtrl window,error
why????
help me,thank you
Blog:
http://360.yahoo.com/rxgmoral
|
|
|
|
|
rxgmoral wrote: error
why????
1) speak proper englisk
2) provide useful informations : What error message ? how exactly did it happen ?
|
|
|
|
|
You asked the same question - please don't keep reposting the same question.
You're probably not getting an answer as you don't really give much info. Today you're getting an error. What is the error? Have you tried stepping through in a debugger when you click your list control? What happens?
|
|
|
|
|
|
Hi, i'm learning c++ and i'm having a problem using a class.
My class is defined like this:
// ****************************************************
class CTest
{
public:
CString *sName;
CTest();
~CTest();
};
CTest::CTest()
{
this->sName=NULL;
}
CTest::~CTest()
{
if (this->sName!=NULL)
delete[] (this->sName);
}
// ****************************************************
And used like this:
CTest test;
test.sName = new CString("Just a test");
It works, but when test is destructed it gives me an unhandled exception error. I though that when you used a pointer to something like an array, you had to use delete[]. I've tried without the [] and it works, but i think there will be a memory leak, no?
Hope someone can explain this to me.
Thanks in advance,
Rad.
|
|
|
|
|
new -> use delete
new[] -> use delete[]
|
|
|
|
|
Thanks for the quick reponse! I was worried about the memory leaks . Thank you.
|
|
|
|
|
Just a question: why are you using a pointer ? You know that CString is a class and you don't need to work with it the same way as a standard char array ?
You can simply have declared it CString sName and use sName. The CString class will manage everything for you.
Also, on a side note:
this->sName=NULL;
I never understood why people were using the this pointer everytime they access a member variable
|
|
|
|