|
If MFC is dying, why do new versions keep being released for each new version of VS [^]?
Steve
_________________
I C(++) therefore I am
|
|
|
|
|
We are changing the style of our MFC app to be the "XP Style" - mainly this was done by setting the manifest using a #pragma comment in stdafx.h.
The problem we have is that edit fields created in Dialogs using the resource editor have a blue border to them, whereas dynamically-created ones have a black border. I had planned to get around this by subclassing CEdit and overriding OnNcPaint() and OnNcCreate().
The OnNcPaint() works fine - as the mouse passes over the entryfield the border colour is changed to the blue as required. However, the field is still initially created with the black border, so I had expected to also need to override OnNcCreate():
BOOL CXPEdit::OnNcCreate(LPCREATESTRUCT lpcs)
{
CEdit::OnNcCreate(lpcs);
OnNcPaint();
return TRUE;
}
However this doesn't seem to work. I do have the "ON_WM_NCCREATE()" and the method is definitely called, it just doesn't repaint the border. I tried adding Invalidate() and UpdateWindow() to no avail.
Any ideas?
Thanks
-M.
|
|
|
|
|
May be you can consider using an owner drawn edit box.
|
|
|
|
|
Well I've managed to get around the problem as I got the dynamic edit control to draw the same by adding the ClientEdge extended style and removing the border. However, it doesn't explain the problem above still!
|
|
|
|
|
That's weird... Try calling:
pWnd->SendMessage(WM_THEMECHANGED, 0, 0);<br />
pWnd->SendMessage(WM_NCPAINT, 0, 0);<br />
after you create those edit controls dinamically
|
|
|
|
|
Hi,
Actaully my applicaiton is like small window that will get in top of the desktop screen,the Height of window is 40.
Whats my problem is if my applcaiton is running,the items in desktop is hided behind the application.
To access desktop items like MyComputer,My Documents,i have to minimize the applcaiton and im invoking tht.
Is there any way,immediately when my application is get invoked,all desktop items should display after 40 pixel.
Pls help me.
Anu
|
|
|
|
|
I don't know of any easier way -that only means i don't know about it, not that it does not exist- but you could try hooking into the control that hosts the icons on the desktop (i believe it is some derivate of the common list control) and handle WM_NCCALCSIZE[^] to change the client area of this control. Dunno if this would work or not, never tried it, but it might...
[Edit] Also, look at SystemParametersInfo[^] with SPI_GETWORKAREA and SPI_SETWORKAREA for the uiAction parameter of it, these look promising [/Edit]
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace GenericMergeSort
{
class MergeSort
{
/// <summary>
/// Sorts an array of Objects
/// IComparable - use 'CompareTo' to compare objects
/// where T : new() - need to create a new Type 'T' object inside the method
/// </summary>
/// <param name="X"></param>
public static T[] Merge_Sort<T>(T[] X) where T : IComparable, new()
{
int n = X.Length;
X = MegrgeSort_Internal(X, n);
return X;
}
/// <summary>
/// Internal method for sorting
/// </summary>
/// <param name="X"></param>
/// <param name="n"></param>
private static T[] MegrgeSort_Internal<T>(T[] X, int n) where T : IComparable, new()
{
// Define 2 aid Sub-Arrays
T[] A = new T[(n / 2) + 2];
T[] B = new T[(n / 2) + 2];
// Initialize the 2 Sub-Arrays with an infinite 'sorting parameter'
// Therefor, You must include a default ctor in your class
// which will initialize an infinite value - To the sorting parameter
// using 'where T : new()' here
for (int i = 0; i < A.Length; i++)
{
A[i] = new T(); ;
B[i] = new T();
}
// Recursive Stop-Condition, Sorting a Basic Array (Size 2)
if (n == 2)
{
int CompareValue = X[0].CompareTo(X[1]);
if (CompareValue > 0)
{
T tempT = X[0];
X[0] = X[1];
X[1] = tempT;
}
}
else
{
// The Sub-Arrays Size is Large than 2
if (n > 2)
{
int m = n / 2;
// Initialize the 2 Sub-Arrays (The first relevant values)
for (int i = 0; i < m; i = i + 1)
{
A[i] = X[i];
}
for (int j = m; j < n; j++)
{
B[j - m] = X[j];
}
// 2 Recursive Calling, Sorting Sub-Arrays
A = MegrgeSort_Internal(A, m);
B = MegrgeSort_Internal(B, n - m);
// Merging the Sorted Sub-Arrays into the main Array
int p = 0;
int q = 0;
for (int k = 0; k < n; k++)
{
{
int CompareValure = A[p].CompareTo(B[q]);
if (CompareValure == 0 ||
CompareValure == -1)
{
X[k] = A[p];
p = p + 1;
}
else
{
X[k] = B[q];
q = q + 1;
}
}
}
} // if
} // else
return X;
} // MegrgeSort_Internal
}
}
|
|
|
|
|
Few notes:
- The subject should be written using English language.
- Your code is not properly formatted.
- The code looks managed one, i.e. you have missed the right forum.
- There is no question at all.
BTW: Welcome at CodeProject.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
That's nice.
What was the question?
edit: Ninja'd!
|
|
|
|
|
can u please explain the problem, rather than just sending the code.
Величие не Бога может быть недооценена.
|
|
|
|
|
Hi, Im having MDI application.
In that all childframe have system menu.When i minimized it minimized to down.When maximized its get maximized to full screen.
But what i want is, if i press maximize the window should maximizd to limited width and height.
How can i do that?
I saw OnGetMinMaxinfo(),but i dont know wat parameter should use only for maximizing to certain height and width.
Pls help me.
Anu
|
|
|
|
|
I think you forget to check MINMAXINFO parameter of the OnGetMinMaxInfo(),
change the value of lpMMI->ptMaxTrackSize, then you can limit the width and height.
Величие не Бога может быть недооценена.
|
|
|
|
|
yes, i can set width and height of window.
But i want to set X and Y position of window.
How can i do that?
Anu
|
|
|
|
|
I'd like to create an application that is capable of hooking all input, ie mouse movement and keystrokes that the system recieves. No, I'm not writing a keylogger. If possible, I'd then like to stop those messages in their tracks, add them to a container, and then resend them later on after a specified time period in order to simulate an input delay.
My concern is with the hooking/blocking messages part. Is it possible to do this globally for the entire system?
|
|
|
|
|
Yes it is. Take a look at the function SetWindowsHookEx especially the values WH_KEYBOARD_LL and WH_MOUSE_LL
for the idHook parameter.
With this hooks you can capture every mouse and key input and you also will be able to stop forwarding these messages to the next "hooking" applications and the focused window.
Edit: Except the keystroke "ctrl-alt-delete". You will be able to capture this keystroke, but you will not be able to stop forwarding this keystroke!
Greetings
Covean
|
|
|
|
|
|
Hi, folks
I am thinking of writing a program which opens two files in one window. and these two files needs to be scrolled simulateneously.
(I have to put the scrollbar here as I have multiple views).
I plan to use such a structure
CMDIChildWnd, which has a scrollbar, and CSplitterWnd, its role is to change answer scroll related message such as OnSize, OnScroll.
CView, handles OnDraw, displays file.
CDocument, which has files info.
(I need to take advantage of OnOpenDocument)
the question is, when I load a file (which is handled by CDocument) either by OnOpenDocument() or some user defined open file function, how could I update CMDIChildWnd?
thanks in advance!
baum
|
|
|
|
|
You can call UpdateAllViews with a hind to update a particular view
Please refer for more details
[^]
Величие не Бога может быть недооценена.
|
|
|
|
|
thanks for the reply.
but updateview doesn't solve my problem, as scrollbar doesn't belong to a specific view (it belongs to CMDIChildWnd), and I need to update it too.
any idea?
thanks!
|
|
|
|
|
I think you dont need to update the CMDIChildWnd.
Величие не Бога может быть недооценена.
modified on Tuesday, January 19, 2010 12:19 AM
|
|
|
|
|
it is not, it is a CFrameWnd, container of CDocument and CView.
|
|
|
|
|
I think what you want to achieve is update two scroll views from the document?
i.e on update the two views simultanously?
Величие не Бога может быть недооценена.
|
|
|
|
|
exactly.
but I don't want to use two scrollbars, is it achievable?
|
|
|
|