|
thank your help info. i change the variable as code below, but the problem keeps the same:
IWebBrowser2 *pBrowser = NULL;
HRESULT hr = m_pBrowserApp->QueryInterface(IID_IWebBrowser2, (void **) &pBrowser);
if (!SUCCEEDED(hr))
return;
VARIANT vtBandGUID, vtShow;
vtBandGUID.vt = VT_BSTR;
vtBandGUID.bstrVal = SysAllocString(OLESTR("{30D02401-6A81-11D0-8274-00C04FD5AE38}"));
vtShow.vt = VT_BOOL;
vtShow.boolVal = VARIANT_TRUE;
VARIANT vtEmpty = {0};
hr = pBrowser->ShowBrowserBar(&vtBandGUID, &vtShow, &vtEmpty);
SysFreeString(vtBandGUID.bstrVal);
pBrowser->Release();
|
|
|
|
|
Hi,
Your code appears to be absolutely correct. The error you are encountering could be caused by the browser control not supporting explorer bars.
Best Wishes,
-David Delaune
|
|
|
|
|
thank you for you reply.
i think the reason is as you pointed out.
my enviroment: windowsXP sp3 + IE8
|
|
|
|
|
i write a class derived from CHtmlView, and write the code as below, when it run, no bar appear, and a messageBox show a string '0x80040100', what is the reason? how can i make it work. any suggestion or help are appreciated
void CXxView::OnShowBar()
{
IWebBrowser2 *pBrowser = NULL;
HRESULT hr = m_pBrowserApp->QueryInterface(IID_IWebBrowser2, (void **) &pBrowser);
if (SUCCEEDED(hr))
{
VARIANT vtBandGUID, vtShow;
vtBandGUID.vt = VT_BSTR;
vtBandGUID.bstrVal = SysAllocString(OLESTR("{30D02401-6A81-11d0-8274-00C04FD5AE38}"));
vtShow.vt = VT_BOOL;
vtShow.boolVal = TRUE;
HRESULT hrx = pBrowser->ShowBrowserBar(&vtBandGUID, &vtShow, 0);
if (FAILED(hrx))
{
CString _str;
_str.Format("0x%x", hrx);
AfxMessageBox(_str);
}
SysFreeString(vtBandGUID.bstrVal);
pBrowser->Release();
}
}
|
|
|
|
|
I just can't understand the meaning of unique_ptr or auto_ptr, as we all know, once the parameter gets out of its scope, we won't get memory leaks. However, is it a better idea if I create the parameter on the stack rather on the heap. I don't see its advantage over normal parameters. If we really need to create parameters on the heap, then we must use '
new ' operator, right?
Here is a little code snippet:
class Base
{
public:
Base()
{
cout << "Base::()" << endl;
}
virtual ~Base()
{
cout << "~Base()" << endl;
}
virtual void iPhone()
{
cout << "I'm iPhone5s" << endl;
}
};
class Derive : public Base
{
public:
Derive()
{
cout << "Derive()" << endl;
}
virtual void iPhone()
{
cout << "I'm iPhone 6" << endl;
}
virtual ~Derive()
{
cout << "~Derive()" << endl;
}
};
void main()
{
{
auto_ptr<Base> ptr(new Derive()); ptr->iPhone();
Derive d; Base* base = &d;
base->iPhone();
}
}
|
|
|
|
|
Note: std::auto_ptr has been (mostly) replaced by std::unique_ptr .
The use of std::unique_ptr and std::shared_ptr offer better memory management (garbage control, ... ) than naked pointer (google for the difference between unique and shared).
{
Derive* p = new Derive;
}
{
std::unique_ptr<Derive> p(new Derive);
}
In all (most) cases it would be better to not use pointers at all; but when it happens, use std::unique_ptr or stdshared_ptr depending on your need.
So in your example, it could simple be :
{
Derive d;
d.iPhone();
}
In simple examples using one or the other will probably not make a difference, but in larger systems, it will.
I'd rather be phishing!
|
|
|
|
|
It's essentially meant for the cases where you do need the heap... when you're already using new/delete. It eliminates the need to call delete explicitly and prevents leaks by taking care of the deallocation automatically. That's pretty much the crux of it (I personally don't use it at all).
|
|
|
|
|
I never found it especially useful. By the time it arrived I had disciplined myself when I created code that I didn't see failures to deallocate anymore.
I did find that attempting to refactor code (others) that did have problems was at best a futile exorcize but maybe I never understood it in detail enough.
|
|
|
|
|
|
In general it may indeed be better to create it on the stack. The reason you'd use new is when you want more control over it's lifetime. For example you can't use the stack if it need to stay "alive" after the function returns (more generally, when it goes out of scope).
Steve
|
|
|
|
|
In Embedded programming working with Win c, can we develop Win c applications in visual studio, for that any special licence required.
|
|
|
|
|
I develop Win CE program using VS2005,but need SDK from hardware vendor.
then my program can run on it's hardware platform.
|
|
|
|
|
ok thank you for your reply, can u tell me if i am using visual studio 2008 or 2010 is there any necessity of SDK in these versions also, please help me.
|
|
|
|
|
I think you need to ask the hardware vendor. for example, if you use ARM CPU, and I assume you develop WinCE based program, then, either hardware vendor create a SDK for you, or you can create a SDK for yourself with PlatForm Builder.
PlatForm Builder is a software from Microsoft.
|
|
|
|
|
Visual studio 12 will allow you to compile direct to Windows RT on an ARM processor which can be useful.
Personally however I cheat I usually write a UI interface that emulates the the embedded target on the PC or I have an old version of WINE which I have doctored and call Darkside which provides all the basic API interface of windows but runs a very simple concept of a device context and no multitasking.
It sort of weird I often have a linux thread kernel pushing into a faked version of Windows UI .... seems all wrong if you think about it.
The trick with all these techniques it to have a clear idea of interfaces on your embedded project so you can do the emulations. You can't just start random coding and hot and hope planning is everything.
|
|
|
|
|
Does it have any constraint in MFC, because the same code works fine when I run on win32 console. Will be grateful.
|
|
|
|
|
SetWindowsHookEx [^] is a Windows API . Calling it (correctly) in a MFC application or in a Win32 console application is the same.
Veni, vidi, vici.
|
|
|
|
|
What error code do you get?
|
|
|
|
|
|
it works fine for some time on MFC. I get a feeling that it gets unhooked from the OS for some reason after approx 10 notifications
|
|
|
|
|
Post some code. Not reams of code if you expect an answer, a minimal program that shows your problem. I concede that at times this is easier said than done.
Steve
|
|
|
|
|
If we create the ribbon project in VS 2008 update SP1. statically we are in inserting the item in tree control but i want to insert it in run time plz let me know how can i do?
|
|
|
|
|
Use the TVM_INSERTITEM message.
See CTreeCtrl::InsertItem
Within you lies the power for good - Use it!
|
|
|
|
|
Hello every one. i want to show an image in every place of screen with MFC. for example i want to load an arrow picture near windows clock or near start menu or in every place in its original shape and not in the dialog or form. Please help me or give me a good link for this action.
Thanks.
|
|
|
|
|
You could use a borderless popup window. You could even use window regions to have the window in the shape you want.
Within you lies the power for good - Use it!
|
|
|
|