|
That works but it also makes the window flicker. Is there any other way to do it?
|
|
|
|
|
Well, I haven't tried this, but it might help reduce the flickering. Before repositioning the window, save its original surrounding rectangle with GetWindowRect . After repositiong, invalidate the desktop window with InvalidateRect using the rectangle previously saved.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
That'sa good idea. I tried it but it didn't seem to have any effect at all. Maybe I'm doing it wrong. Do you see any obvious problems with this code?
<br />
void CAnimateWnd::ChangeAppearanceAndPosition(HRGN hNewRgn, int iPosX, int iPosY)<br />
{<br />
CRect oldRect;<br />
GetWindowRect(&oldRect);<br />
<br />
SetWindowRgn(hNewRgn, FALSE);
SetWindowPos(&wndTopMost, iPosX, iPosY, 100, 100, SWP_NOACTIVATE);<br />
<br />
::InvalidateRect( GetDesktopWindow()->GetSafeHwnd(), &oldRect, TRUE);<br />
}<br />
|
|
|
|
|
The code seems OK to me There are a couple of things you might want to try:- Do a
ScreenToClient of the rectangle for the desktop window prior to using it in InvalidateRect .
- Force the repainting of the desktop window with
UpdateWindow after invalidating. Other than these, I cannot come out with any other possible reason for this failing.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I tried each of those but there was no change. My guess is that, since I did not repaint during my SetWindowRgn() call, the desktop thinks it is intended to leave the bits of previous regions behind.
If I have to I can live with the flicker but I'd much rather have a perfectly smooth animation display.
|
|
|
|
|
What about this?
void CAnimateWnd::ChangeAppearanceAndPosition(HRGN hNewRgn, int iPosX, int iPosY)
{
CRgn oldRgn;
oldRgn.CreateRectRgn(0,0,0,0);
GetWindowRgn(oldRgn);
SetWindowRgn(hNewRgn, FALSE);
GetDesktopWindow()->InvalidateRect(&oldRgn);
SetWindowPos(&wndTopMost, iPosX, iPosY, 100, 100, SWP_NOACTIVATE);
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Ah, you mean InvalidateRgn(), right? Hrmm... still no visible effect. I wonder if we're misinterpreting the expected behavior for the Desktop Window. Maybe it doesn't know how to update but, rather, is simply storing an image of the desktop in its current state, in which case that current state would include the broken bits of previous animation frames.
|
|
|
|
|
Ummm. One more try:
void CAnimateWnd::ChangeAppearanceAndPosition(HRGN hNewRgn, int iPosX, int iPosY)
{
CRgn oldRgn;
oldRgn.CreateRectRgn(0,0,0,0);
GetWindowRgn(oldRgn);
SetWindowRgn(hNewRgn, FALSE);
InvalidateRect(&oldRgn);
SetWindowPos(&wndTopMost, iPosX, iPosY, 100, 100, SWP_NOACTIVATE);
} Would you care to tell me the result now?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Same as before. No visible change.
|
|
|
|
|
I found a solution. For the curious, I will post it here:
The main problem is that the window needs to change its HRGN shape and its position at the same time. Since the new shape will not be correct until the window is in the new position, I needed the window to redrawn only when both the new HRGN and the new position have been set but I still needed to restore the background in areas of the old shape which were not part of the new shape.
<br />
void CAnimateWnd::UpdateRgnAndPos(HRGN hNewRgn, int iPosX, int iPosY)<br />
{<br />
HRGN hOldRgn = CreateRectRgn(0, 0, 0, 0);
GetWindowRgn(hOldRgn);<br />
<br />
HRGN hOffRgn = CreateRectRgn(0, 0, 0, 0);
CombineRgn(hOffRgn, hNewRgn, NULL, RGN_COPY);
OffsetRgn(hOffRgn, iPosX - m_iOldPosX, iPosY - m_iOldPosY);
<br />
HRGN hCombinedRgn = CreateRectRgn(0, 0, 0, 0);
CombineRgn(hCombineRgn, hOffRgn, hOldRgn, RGN_OR);
<br />
SetWindowRgn(hCombinedRgn, FALSE);
<br />
SetWindowPos(iPosX, iPosY, 100, 100, SWP_NOACTIVATE);
<br />
SetWindowRgn(hNewRgn, TRUE);
<br />
Invalidate(TRUE);
<br />
m_iOldPosX = iPosX;
m_iOldPosY = iPosY;<br />
}<br />
|
|
|
|
|
Maybe you could uses 2 windows. You set the shape on the new window, show it (above the old), hide the old.
Or uses layered windows (see SetLayeredWindowAttributes) if you are using Windows 2000 or Windows XP. This allows to create transparent and semi-transparent windows.
Philippe Mori
|
|
|
|
|
Hello,
I have problem with a CListCtrl. As you know, pushing up/bottom arrow allow you to move up and down through the elements of your list (it's builtin). Everything was perfect since yesterday
I noticed that the arrows didn't respond. A message (WM_KEYDOWN) seems to be blocked by something but i can't put the finger on it. Mouse events work perfectly.
I derived a class from CListCtrl and i put it in a form derived from CFormView. As i said,all was working perfectly two days ago. The problem seems to be simple, i do not use special or custom code to process messages. I think i respect the way to implement controls using MFC.
Any tips to locate simply (with VC debugger) where the problem is?
Thank u!
Fred
C++/MFC/SQL Developer.
|
|
|
|
|
I'm not sure what differences you have between now and two days ago, but it sounds like you're being bitten by IsDialogMessage. Certain keystrokes are trapped by the system and treated as dialog navigation keys, rather than being sent to the control. Besides direction keys, this also includes things like Tab. Try adding a handler for WM_GETDLGCODE to your control. Return DLGC_WANTARROWS.
Scot Brennecke
Software Developer
VC++ MVP
|
|
|
|
|
Thank you,
I try immediately.
Fred
|
|
|
|
|
Scot,
First,thank you to pay attention at my problem!.
I noticed, after you answered me, that any controls trough the application get messages (concerning keystrokes).
I implemented what you adviced me everywhere in my controls but never i entered in the fucntion OnGetDlgCode ...
afx_msg UINT OnGetDlgCode( );
ON_WM_CREATE()
UINT
Cxxx::OnGetDlgCode()
{
return Cxxx::OnGetDlgCode() | DLGC_WANTARROWS | DLGC_WANTTAB;
}
It's a very weird situation.
Anyway thanks for your help.
Frédéric.
Fred
C++/MFC/SQL developer
|
|
|
|
|
Hi,
I am writing a html help file for an application(which is similar to Adobe photoshop help files).I would like to know is there any microsoft standard guidelines for writing such help files?
Thanks
Asha
|
|
|
|
|
|
I have a Composite Control with a list control drawn in my resource. I created my own CListCtrl derived class, which adds sorting of columns.
Now I want to do some custom drawing, but I cannot get this to work. Some how I do not receive the NM_CUSTOMDRAW message. I used ON_NOTIFY_REFLECT and also tried the OnNotify method to receive this message, but here I only got the message from the header, not from the list itself.
How can I receive this message ? Must I do something else with the message map?
By the way, I used m_mylist.SubclassWindow(GetDlgItem(IDC_LIST)) to link the list control object to the list control.
|
|
|
|
|
hi all,
pls try answer my question!
i want to know how can i send data to java server in client/server program?
since the server is not written in java which do not use CArchive to receive data, i found there is some strange data sent to the java side server if i use the CArchive in the mfc client application.
do you know how can i send a pure data to other server or receive data from server if i don't use CArchive. Or, how can send data to non-MFC application in client/server program in a MFC application using CSocket, CSocketFile and CArchive?
thanks,
jim
|
|
|
|
|
Screw the MFC socket class and use the Win32 api directly. Its easy. CArchive & co are meant for when there are other MFC apps on the other end.
Beware of byte ordering issues.
BTW, wouldn't it be better to use java on the client and C in the server. I was thinking of the performance implications, unless the server will only have, at most, a handful of clients.
bibamus, edamus, cras moriemur [eat, drink, for tomorrow we die]
|
|
|
|
|
I've created an ISAPI module and i want to write an installation kit.
Is it possible to create virtual directories on IIS working just in command line style?
rechi
|
|
|
|
|
I'm hosting Web Browser in my app. When document contains frames with pages from different domains, it causes acces denied (COM Error) when trying to access document in frame. How to avoid it??
I read MSDN article "Permission Denied Error Message When Scripting Across Frames", but there was written about scripts only...
|
|
|
|
|
Help me to clear doubts on VC++ DhtmlEdit Controll for IE5[Table insert,Paste html...]
I am trying to develop a html editor using vc++6.
Now I am facing five major problems
1 How add Toolbar in a Dialog Based Application using vc+6 ? ,Is it possible in Dialog Based Application ?.
2 How insert a Table in a html page using vc+6's DHTML EDIT Control for IE5 ?.
3 How implement PasteHtml using vc+6's DHTML EDIT Control for IE5 ?.
4 How insert an adjecent Html?
5 How devolop a file opening dialog with html preview ?
The following shows my code for each problem ...
** Problem 2: VB code OK:-
Dim s As New DHTMLEDLibCtl.DEInsertTableParam
s.Caption = "test"
s.NumCols = "2"
s.NumRows = "2"
s.TableAttrs = "border=20"
s.CellAttrs = "bgcolor=black"
DHTMLEdit1.ExecCommand DECMD_INSERTTABLE, OLECMDEXECOPT_PROMPTUSER, s
** How it solve in VC++6 ?
----------------------------------------------
** Problem 3: VB code OK:-
Private Sub btnInsertNewTag_Click()
'insert new tag at cursor position
Dim tr As Object
Set tr = DHTMLEdit1.DOM.selection.createRange
tr.pasteHTML " "
End Sub
** How it solve in VC++6 ?
----------------------------------------------
** Problem 4: VB6 code Error:-
DHTMLEdit1.DOM.body.insertAdjacentHTML "body", "hr"
** Problem 4: VC++6 code Error:-
// It is not proper working.
LPCTSTR lpStrWhere= "body";
LPCTSTR lpStrHtml= "hr";
m_ctrlDhtml.GetDom().GetBody().insertHTML(lpStrWhere,lpStrHtml);//error
----------------------------------------------
If you know any methods to solve any of these problem ,you please send the source code or web site address.
Anticipating your early reply
Regards
ranjithe2002@hotmail.com
Thanks..
mail me
ranjithe2002@hotmail.com
|
|
|
|
|
hi
i have to make a font editor application which creates customised fonts
i have designed a ui which gives user a place to draw the font charactor's shape
now i dont know how am i going to convert it into font & store it into the file
if anyone there can guide me or give me some appropriate links
thanks
surbinsho
|
|
|
|
|
oh god, really not easy work to create usable font (editor)
do they really know what they request?
(do you know something more about fonts than they have shapes? maybe try look at links from http://www.codeproject.com/winhelp/format_tips.asp)
what font type do they want?
maybe older infos (?): http://www.wotsit.org/search.asp?s=font
maybe http://www.sourceforge.net/search ("font editor")
msdn help/specifications/opentype links to adobe.com, truetype seems inside
(sorry, no real experience with font file type specifications)
t!
|
|
|
|
|