I'm using Visual Studio 2003, and MFC/C++.
I want to simulate just the update/refresh portion of the maximize command, on an ie window. I've already managed to connect to the window and can send minimize and maximize commands to it, as well as move the window around the screen, even hide and show the window if I wish to. I just need to know what message or function I have to pass to that window to get it to do JUST the refresh portion of its maximize command.
Here's some background info and stuff I've already tried:
I have an internet page, that uses java applets served from a server I have no control over. The internet page loads, but none of the background graphics, or button graphics load, so you pretty much have to click on a blank screen and "guess" where the buttons are.
However, if you minimize the window, and maximize (tested over 100 times, by multiple people, under different conditions, with a 100% success ratio), it'll redraw the window properly.
I've tried simulating a very rapid alt+tab and it restored the buttons graphics but not the main graphic (not acceptable to my client). I've also tried the following commands:
Thank you very much, I'll give this a try on the job site tonight or tomorrow, I cannot replicate the problem at home, but this seems to be giving the desired effect.
Appears to be working great, thank you, had to do a little more research and realized I wrote way too much code...but hey, it works, next time I know what to do.
Actually, as an update to this, I'm having some slight issues now after slightly over a week.
First, I'm using a series of timers to decide when to redraw the window, I only target IE windows opened with a specific name, once one is open, I issue an invalidate and update once, and then again 2 seconds later. Then I go into another timer waiting for that window to close, when it closes, it triggers a timer waiting for another one to open again, thus, essentially, every time a window loads with that title, I get two screen refreshes which fixes my problem.
Unfortunately, there's a few issues, the InvalidateRect and UpdateWindow cause the screen to briefly flicker, and that was undesirable, hence going from constantly doing it on one timer, to my multiple timers. If I could find a way to redraw the window without the flicker that'd be great, but that's not the largest issue.
The largest issue is Java, for some reason, when Java locks up, it locks my timers, and my program refuses to work from that point onward, and the windows go back to displaying their normal graphical glitch. I'm using WM_Timer messages, and was wondering if that may be causing the problem, and if so, what alternatives I should consider.
Here's a copy of my code for those interested in helping.
And here's a code tag with the related sections
Code:
BOOL CMarineFixDlg::OnInitDialog(){
SetTimer(1,200, NULL); // Set Timer for IE window to open
return TRUE;
}
void CMarineFixDlg::OnTimer(UINT nIDEvent){
if((nIDEvent==1) && bd_CheckMarine()){ // Timer to for IE window to open
SetTimer(2,3000, NULL);
KillTimer(nIDEvent);
}
if(nIDEvent==2) { // Timer to redraw IE window
if(bd_CheckMarine())
SetTimer(4,2000,NULL);
else
SetTimer(1,200,NULL); // Timer to wait for window to open
::InvalidateRect(NULL,NULL,FALSE);
::UpdateWindow(NULL);
KillTimer(nIDEvent);
}
if((nIDEvent==3) && !bd_CheckMarine()){ // Timer to wait for IE window to close
SetTimer(1,200,NULL); // Timer to wait for window to open
KillTimer(nIDEvent);
}
if(nIDEvent==4) { // Timer to redraw IE window a second time
if(bd_CheckMarine())
SetTimer(3,200,NULL);
else
SetTimer(1,200,NULL); // Timer to wait for window to open
::InvalidateRect(NULL,NULL,FALSE);
::UpdateWindow(NULL);
KillTimer(nIDEvent);
}
}
bool CMarineFixDlg::bd_CheckMarine(){
HWND hIE = ::FindWindow(0,"US Marine Corps Museum - Windows Internet Explorer");
HWND hIE2 = ::FindWindow(0,"US Marine Corps Museum - Mozilla Firefox");
if(hIE || hIE2)
return true;
else
return false;
}
Code:
// MarineFixDlg.h : header file
#pragma once
class CMarineFixDlg : public CDialog{
// Construction
public:
CMarineFixDlg(CWnd* pParent = NULL); // standard constructor
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnPaint();
enum { IDD = IDD_MARINEFIX_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnInitDialog();
HICON m_hIcon;
DECLARE_MESSAGE_MAP()
private:
bool bd_CheckMarine();
};
Still having an issue with this, couldn't figure it out last night, tried using a multimedia timer, and java locking up still screws up my timer code for some reason, as long as java doesn't lock, I'm fine. But I have to be able to get around that, cause relying on java not locking up isn't really a good solution.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.