|
You won't get a WM_MOUSEMOVE message in the dialog when the cursor is
moved over a button. You need to check for WM_MOUSEMOVE in the button class.
In your button class' OnMouseMove(), the first time it's called when the cursor
enters the button, you can use TrackMouseEvent() with the TME_LEAVE flag. Then
you'll get a WM_MOUSELEAVE message when the cursor is moved off the button
so you can set the bitmaps back to the original.
Also, after your LoadBitmaps() calls, you may need to call UpdateWindow() on the
button(s) to get them to redraw (maybe not, but if the button bitmaps aren't changing,
it's worth a try ).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
tanx, i'll try that!
|
|
|
|
|
Given the coordinates on the desktop, how could I get a handle to the window at that position.
Sample code will be ok too. Thank you very much.
Tmay_99
|
|
|
|
|
POINT point={100,200};
HWND hWnd=::WindowFromPoint(point);
if (hWnd) {
// Do something
} else {
// Nothing here
}
|
|
|
|
|
Thank you very much. Well I have another question, does the handle I get with this code belong to a top-level window or a child window. If it is a child window, how could I get the top-level window? Thank you.
Tmay_99
|
|
|
|
|
POINT point={100,200};
HWND hWnd=::WindowFromPoint(point);
HWND hWndParent=NULL;
if (hWnd) {
// Find the highest level parent
do {
hWnd=::GetParent(hWnd);
if (hWnd) {
hWndParent=hWnd;
}
} while (hWnd);
}
if (hWndParent) {
// do something with highest parent
}
|
|
|
|
|
Well, I'm not sure if you wanted the parent or just the top-most z-order child window.
Let me know if I misunderstood your second question.
|
|
|
|
|
If I'm missing the mark on this one, you can check out the explanations of the relationships and functions to find them if you open up MSDN, click on the search tab, and find "Win32 Window Hierarchy and Styles".
It goes over the relationships and functions.
|
|
|
|
|
Wow,thanks a lot.Yes, I want the top-level window which GetParent returns NULL. I appreciate your help!
Tmay_99
|
|
|
|
|
Hi ,
i built an SDI Project (RTFView) and i want to edit displayed Text in the fonttype "Terminal" (OEM/DOS Font).
I try this with the CFONTDialog. I can now change the text in every fonttype but not in "Terminal".
Do yo know how i can do this ? Is there a tut or a Code snippet or can you explain how i can fix this Problem ?
Here is my code:
[CODE]
void CTereader0004View::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
CTereader0004Doc *pDoc = GetDocument ();
CRichEditCtrl& rCtrl = GetRichEditCtrl(); // Pointer auf das RichEditControl erstellen um dessen Funktionen zu nutzen
CHARFORMAT cfm; // Struktur die die Aktionen der Selektion enthält/ CFont myFont;
rCtrl.ReplaceSel(pDoc->cstrAusgabe);
rCtrl.SetSel(0,482);
cfm.cbSize = sizeof(CHARFORMAT); // Funktionen
cfm.dwMask = CFM_BOLD; // des RichEditCONTROLS zur
cfm.dwEffects = CFM_BOLD; // formatierten Darstellung benutzen
rCtrl.SetSelectionCharFormat (cfm); // Aktionen der Selektion ausführen
rCtrl.SetSel (0,0);
rCtrl.SetModify(FALSE);
}
void CTereader0004View::OnFontChoose()
{
CFontDialog fontDlg;
CFont *m_font = new CFont;
if (fontDlg.DoModal())
{
m_font->CreateFont (fontDlg.GetSize() / 7.25
,NULL
,0
,0
,fontDlg.GetWeight ()
,fontDlg.IsItalic ()
,fontDlg.IsUnderline ()
,fontDlg.IsStrikeOut ()
,DEFAULT_CHARSET
,OUT_DEFAULT_PRECIS
,0
,DEFAULT_QUALITY
,DEFAULT_PITCH
,fontDlg.GetFaceName ());
}
CRichEditCtrl& rCtrl = GetRichEditCtrl(); // Pointer auf das RichEditControl erstellen um dessen Funktionen zu nutzen
CHARFORMAT cfm;
rCtrl.SetFont (m_font);
}
[/CODE]
many many thx
CrocBuck
|
|
|
|
|
O.K.
I solve the prob.
CrocBuck
|
|
|
|
|
Hi anyone knows if I can get Visual Studio Express on a disc? Installer from Microsfot's site works but our network guys have blocked the installer from downloading packages for installation to complete.
Thanks
|
|
|
|
|
Yes, it's possible, I think you can order it from MS for $5 or something. I know it can be done, I've got teh DVD.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Also, you can download CD ISO images and burn your own.
See here[^].
I can't seem to find the link for ordering CDs - I know I saw it in the past.
Did they discontinue shipping CDs for Express editions? I don't know
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
That's great Mark, even better!!
Many thanks!!
|
|
|
|
|
Hello everyone,
I am developing a COM DLL (native unmanaged C++ using Visual Studio 2005). I have the following requirements and I am wondering what technology should I use to achieve my goal?
1. The COM DLL will be used by multiple different applications (processes), and for some COM objects, I want the different processes to share a single copy of data (CoClass object instance), and for some other COM objects, I want the different processes to share a separate copy of data (CoClass object instance).
2. The COM DLL I developed is working passively and providing service to other 3rd party applications when they invoked the DLL. I can not control the applications (can not access or change code). And the only thing I can control is the COM DLL itself. So, the technology I select to use should be transparent to the applications and only need code change in the COM DLL itself.
thanks in advance,
George
|
|
|
|
|
dear all
how to biuld a array which size is 500x500 in c++. thanks
zhiyuan
Li Zhiyuan
2/9/2007
|
|
|
|
|
int ar[500][500]; //doesn't work???
|
|
|
|
|
See
int a[5]={10,20,30,40,50};
int b[]={1,2,3,4,1000};
int[500][500];
char names[100][200][24][50][50];
int array[20];
|
|
|
|
|
I think you posted this question before and got replies.
void SomeFunc()
{
int My500x500Array[500][500];
...
}
void SomeFunc()
{
int (*My500x500Array)[500] = new int[500][500];
...
delete[] My500x500Array;
} Make sure you have enough stack space for the stack-based variable -
it's 1000000 bytes and the default stack size is generally 1MB.
Mark
Last modified: 11hrs 5mins after originally posted --
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Make sure you have enough stack space for the stack-based variable -
it's 1000000 bytes and the default stack size is generally 1MB.
Only to understand better the problem for myself... I use often big arrays
I found often this "stack-based variable" indication but never studied it deeper:
Is this static variable...
int A[10000];
...a stack-based variable ? So it needs to be checked?
And... is this array...
p = new int[10000];
a not stack-based variable ? ... so it doesn't need a check?
thanks
Russell
|
|
|
|
|
native C++ is platform dependent. If the variable is greater then stack size it even will not compile. But you need to check
p = new int[10000];
because you can be out of memory, and you dont need to check
int A[10000];
|
|
|
|
|
|
Ehi... I make a little research on internet....and I found the opposite of what you sad:
Static variables (as int i[100];) goes on the stack.
Dynamic variables (as int*p=new int[100] ) is allocated in the heap (of course: p is in the stack and *p is in the heap)
Is the heap and the stack the same thing?
Russell
|
|
|
|