|
I have implemented a small web server inside a dialog application that host the web browser control.
On a good scenario, this is what happens: I pass the url to the webbrowser control and it downloads all files from my server and displays it correctly. Something like:
CString navigateTo;
navigateTo.Format((TEXT("http://127.0.0.1:%d/%s")), m_nListeningSocketPort, GetFileName() );
try {
m_IExplorer.Navigate( navigateTo, 0, 0, 0, 0 );
}
...
explorer then gets all the files needed from the web server and all is ok. Then I disconnect from internet and from that point on internet explorer doesn't download anything. It doesnt even try to contact the server!
Events go like this:
http:
BeforeNavigate2Webbrowser()
DownloadBeginWebbrowser()
DownloadBeginWebbrowser()
DownloadBeginWebbrowser()
DownloadBeginWebbrowser()
NavigateErrorWebbrowser():: URL: http:
BeforeNavigate2Webbrowser():: URL: res:
DownloadBeginWebbrowser()
DownloadBeginWebbrowser()
NavigateComplete2Webbrowser():: URL: http:
NavigateError() reports INET_E_DOWNLOAD_FAILURE. Can anyone explain what's going on? How can I force the web browser to contact to local web server? I implemented additinal test to verify server is up and running, and it's all good.
|
|
|
|
|
Is your browser getting switched to "Work offline" mode?
-Suhredayan
|
|
|
|
|
Two questions.
if you're dialup to connect internet?
Check local webserver (like IIS or any other local webserver) is configured. also as said in the previous answer, check if it's enabled to work offline to get the offline content.
else if
you're using proxy, in the internet settings->LAN settings, exclude proxy from local address.
-Sarath.
Rate the answers and close your posts if it's answered
|
|
|
|
|
Thnx for the answers, the server works fine. The problem was in the way ie control works when you put it to offline with .put_Offline(TRUE). Then it never tries to go online.
But when you set the control to online and check the "Work Offline" option in IE, then the control asks to go online. Just didn't occur to me it works that way... Needed just a good night's sleep
|
|
|
|
|
I have seen some applications warn that you have to run it in admin mode, if you do not run it in admin mode in both Windows Vista and 7. How do they detect if it is running with admin privileges or not.
Some application even invoke the UAC (user access control) dialog to pop up, as soon as they run.
Please someone enlighten me about this.
|
|
|
|
|
It's not the application that detects if you're running as admin or not, it's the OS. Any user of Vista/Windows 7 (including Administrator) by default do not run with admin privilege - it must be requested.
Certain actions require admin rights - like writing to HKEY_LOCAL_MACHINE in the registry or creating files within the Program Files directory (and sub-directories).,
You can make your app show that UAC dialog and request admin rights by using the following manifest file.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="YourApp" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Save this file in the folder containing your app with the same name as your app and the extension of .manifest.
For instance, if your app is called MyTestApp.exe, save this file as MyTestApp.exe.manifest. Now when you run the app it will pop up the UAC dialog.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
|
|
No. Adding manifest is not the solution. I think its the process properties that one should look into.
|
|
|
|
|
When I use the following method to disable menu items, only popup ones can be disabled, the top-level menus and other sub-menus seems to do nothing!
<br />
CMenu* menu = CMenu::FromHandle(m_wndMenuBar.GetDefaultMenu());<br />
menu->GetSubMenu(1)->EnableMenuItem(1, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);<br />
This method is OK with CMenu in VS 2005.
Thanks for the helps!
|
|
|
|
|
Perhaps this may give you a clue - I've used this many times to disable a top-level menu:
if (pCmdUI->m_pSubMenu != NULL)
{
pCmdUI->m_pMenu->EnableMenuItem(pCmdUI->m_nIndex, MF_BYPOSITION |
(bShowMenuItems ? MF_ENABLED : (MF_DISABLED | MF_GRAYED)));
}
This code is in the UpdateCmdUI handler for the menu, so it takes care of getting the CMenu that I'm concerned with - you'll need to modify it for your needs.
Hope this helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Thank you so much, but I still failed in disable top-level menus just like File, Edit, etc.
I tried by add UPDATE_COMMAND_UI to a menu item, pCmdUI->SetRadio & pCmdUI->SetCheck turn out to be success, but pCmdUI->EnableMenuItem or pCmdUI->Enable still work in vain.
pCmdUI->EnableMenuItem do work well with menu items that have submenu.
So I will be appreciated if you can tell me something more about your trick, especially that how can I disable all top-level menu items by using one cCmdUI.
Thanks a lot!
|
|
|
|
|
I need functions to get following directories - except SHGetSpecialFolderPath() or SHGetFolderPath(), because they don't work well on win98 and win2k.
typical directories are:
1. C:\Documents and Settings\All Users\Start Menu\Programs
2. C:\Documents and Settings\All Users\Desktop
3. C:\Program Files
|
|
|
|
|
Quit spamming the board. You have precisely the same post three threads before this. Do you really think someone is going to respond to this, who didn't respond to the first one?
All you manage to accomplish with this is to irritate anyone who might have been willing to help you.
|
|
|
|
|
Please Calm Down,
LunaticFringe wrote: You have precisely the same post three threads before this (underline by bvk)
It is technically a subtly different question.
I agree, it would have been better dealt with in the previous thread, but, then again...
To Err is Human, to forgive is devine.
Regards,
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: but, then again...
To Err is Human, to forgive is devine.
Given that the OP does this sort of thing regularly, LunaticFringe's response was not inappropriate.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I refer you to my previous answer to this question - which is still on the first page of the forum.
OK, I've now looked, and your previous question did not mention SHGetFolderPath.
But you never replied to my answer, which is a) rude, b) making me unbothered to help you, and c) not helpful to anybody else who might still care about you.
Did you try my advice? Did it fail?
Iain.
edited again:
I've relooked at you as a member, and remember previous threads like this. You're able to write good articles, so you're far from an idiot. I didn't enjoy "spot the difference" competitions when I was young, so all that posting 99% identical questions, instead of following up on previous helpers does is antagonise the very people you want help from. Please apply the same brain you use to write nice articles to writing better forum posts.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Hi,
I am creating a popup window which slides from the taskbar region. I created a dialog class and attached it into my dialog window. Please tell me which function should i override to put the AnimateWindow, so that when I call DoModal() Dialog will have the slide effect.
Thanks in advance.
Regards,
J.
|
|
|
|
|
|
I have created a simple dialog box using visual studio's form editor, and am creating the dailog like so:
DialogBox(NULL, MAKEINTRESOURCE(IDD_IMGPROPS), hWnd, reinterpret_cast<DLGPROC>(dlgImgPropsProc));
The dialog procedure looks like this:
LRESULT CALLBACK dlgImgPropsProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_INITDIALOG:
SendMessage(GetDlgItem(hWnd, IDC_IMGPROPS_SPINW), UDM_SETBUDDY, (WPARAM)GetDlgItem(hWnd, IDC_IMGPROPS_WIDTH), 0);
SendMessage(GetDlgItem(hWnd, IDC_IMGPROPS_SPINH), UDM_SETBUDDY, (WPARAM)GetDlgItem(hWnd, IDC_IMGPROPS_HEIGHT), 0);
return TRUE;
case WM_CLOSE:
EndDialog(hWnd, 0);
return TRUE;
case WM_COMMAND:
switch(wParam)
{
case IDC_IMGPROPS_OK:
EndDialog(hWnd, 0);
return TRUE;
}
break;
default:
return FALSE;
}
return FALSE;
}
Now, the problem is that every time my application hits the call to createDialog(), it hangs... and it seems to be pretty permanent. I've stepped through the dialog procedure and my dialog is recieving the following messages:
48 WM_SETFONT
85 WM_NOTIFYFORMAT
297 WM_QUERYUISTATE
85 WM_NOTIFYFORMAT
297 WM_QUERYUISTATE
272 WM_INITDIALOG
1024 WM_USER
24 WM_SHOWWINDOW
70 WM_WINDOWPOSCHANGING
71 WM_WINDOWPOSCHANGED
127 WM_GETICON
127 WM_GETICON
127 WM_GETICON
131 WM_NCCALCSIZE
15 WM_PAINT
133 WM_NCPAINT
127 WM_GETICON
127 WM_GETICON
127 WM_GETICON
20 WM_ERASEBKGND
310 WM_CTLCOLORDLG
307 WM_CTLCOLOREDIT
307 WM_CTLCOLOREDIT
312 WM_CTLCOLORSTATIC
307 WM_CTLCOLOREDIT
307 WM_CTLCOLOREDIT
309 WM_CTLCOLORBTN
127 WM_GETICON
127 WM_GETICON
127 WM_GETICON
127 WM_GETICON
127 WM_GETICON
127 WM_GETICON
127 WM_GETICON
...
Now, I'm guessing that it just continues on forever there with WM_GETICON. I didn't bother stepping through it any further than that. My question is, what would cause my dialog to continuously recieve the WM_GETICON message, and how can I fix it?
|
|
|
|
|
I've tracked down the problem and found a solution.
In my .rc file I had the following:
IDD_ABOUT DIALOGEX 0, 0, 219, 110
STYLE DS_SYSMODAL | DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "MS Shell Dlg", 400, 0, 0x0
BEGIN
CTEXT "Lorem Ipsum",IDC_STATIC,7,7,205,96
PUSHBUTTON "OK",IDC_ABOUT_OK,84,89,50,14
END
IDD_IMGPROPS DIALOGEX 0, 0, 101, 73
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Image Properties"
FONT 8, "MS Shell Dlg", 400, 0, 0x0
BEGIN
EDITTEXT IDC_IMGPROPS_WIDTH,35,7,49,14,ES_AUTOHSCROLL | ES_WANTRETURN | ES_NUMBER
CTEXT "Width:\n\n\nHeight:",IDC_STATIC,8,9,27,34
EDITTEXT IDC_IMGPROPS_HEIGHT,35,32,49,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "",IDC_IMGPROPS_SPINW,"msctls_updown32",UDS_ARROWKEYS,84,7,10,14
CONTROL "",IDC_IMGPROPS_SPINH,"msctls_updown32",UDS_ARROWKEYS,84,32,10,14
PUSHBUTTON "OK",IDC_IMGPROPS_OK,25,52,50,14
END
The problem seemed to be the window style of the second dialog box. Replacing it with the same style as the first one solved it.
What then is it, about the combination of the flags DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_CAPTION | WS_SYSMENU that caused my dialog to recieve a constant stream of WM_GETICON messages?
|
|
|
|
|
I need functions to get following directories - except SHGetSpecialFolderPath(), because it doesn't work well on win98 and win2k.
typical directories are:
1. C:\Documents and Settings\All Users\Start Menu\Programs
2. C:\Documents and Settings\All Users\Desktop
3. C:\Program Files
|
|
|
|
|
may be solve your problem
CString sortfile="Add Path";
TCHAR szPath[MAX_PATH];
if(SUCCEEDED(SHGetFolderPath(NULL,
CSIDL_SYSTEM|CSIDL_FLAG_CREATE,
NULL,
0,
szPath)))
{
PathAppend(szPath, sortfile);
}
TCHAR szPathDesk[MAX_PATH];
if(SUCCEEDED(SHGetFolderPath(NULL,
CSIDL_DESKTOP|CSIDL_FLAG_CREATE,
NULL,
0,
szPathDesk)))
{
PathAppend(szPathDesk, sortfile);
}
|
|
|
|
|
You should make sure if they work on win98 before you post your lovely code.
|
|
|
|
|
It's not up to him to test his suggestion on every version of the OS you might be interested in using. That's your job.
You might have told him thanks instead of being a wiseass. I doubt many more will be lining up to help.
|
|
|
|
|