|
JG53_Jaguar wrote: and I use other elements from the bitmap file to draw on the screen.
I have never done that but I would believe using that same approach you can create an image object for each one and add it to an image list.
led mike
|
|
|
|
|
that's what I have been thinking as well...might have to create a small bitmap and just dump one image into it at the time and then add it to the list before moving on to next one...
|
|
|
|
|
Why you dont use of CListCtrl?
|
|
|
|
|
I don't see CListCtrl being any different, the challenge is assigning the specific regions of the bitmap and assign it to each element in the ImageList that's the challenge for me...
modified on Tuesday, April 15, 2008 10:49 AM
|
|
|
|
|
JG53_Jaguar wrote: I don't see CListCtrl being any different
Correct, it's not.
led mike
|
|
|
|
|
You can either break the bitmap into bits and get windows to handle it, or you do do owner draw, and just plot different parts of the bitmap. You already know how to draw bits on the screen, so it won't be much harder.
There should be plenty of owner draw examples on CP, and even some simple ones (which is all you're after) on MSDN.
Iain.
Iain Clarke appears because CPallini still cares.
|
|
|
|
|
Thanks Ian, I will look into it...I want to keep things as simple as possible. So I will try first assigning the bitmap bits to a bitmap for the imagelist one at the time first and see how that goes.
|
|
|
|
|
Hello,
Do you know any registry key that says which Operating System we are using?
Thanks! 
|
|
|
|
|
Why bother reading the registry when there is an API call that retrieves that information? GetVersionEx[^]
Judy
|
|
|
|
|
Thanks!!! 
|
|
|
|
|
I have a mfc application that i run with different resolution. So i want to change size of controls as resolutions rate.
When the resolution increases, size of controls and font must increase with same rate between new and old resolution. please tell me how to make it simply. Thanks 
|
|
|
|
|
You can use of WM_SIZE and MoveWindow or SetWindowPos.
|
|
|
|
|
There are loads of articles on codeproject that relate to this.
They're aimed at windows that change size as the user drags the edges with the mouse, but that's no different in principle.
If you mean the dpi changes, then you can MapDialogRect to make your app like a dialog box, and change size proportional to DPI.
Iain.
Iain Clarke appears because CPallini still cares.
|
|
|
|
|
Couldn't get any input from the "Mobile Development" board, so now I turn to the COM giants here
The docs on this are sparse, to say the least...
My problem: I'm trying to embed a WebBrowser object in a Windows Mobile application. I can create it and query its size and window handle, but IWebBrowser2::Navigate2 fails with E_FAIL .
Can anyone give me any hints to why it fails?
Code (yes, C++):
My host control is declared like this:
class HtmlControl : public Window
{
public:
HtmlControl(HWND window)
: Window(window)
, iOleObject_(NULL)
{
iOleSite_.host = this;
iOleFrame_.host = this;
CreateWebControl();
}
Site iOleSite_;
Frame iOleFrame_;
IOleObject* iOleObject_;
private:
void CreateWebControl();
}; Where Site and Frame are declared like this:
struct Site : public IOleClientSite,
public IOleInPlaceSite
{
HtmlControl* host;
STDMETHODIMP QueryInterface(REFIID riid, void** ppvObject);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
STDMETHODIMP SaveObject();
STDMETHODIMP GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker,
IMoniker** ppmk);
STDMETHODIMP GetContainer(LPOLECONTAINER FAR* ppContainer);
STDMETHODIMP ShowObject();
STDMETHODIMP OnShowWindow(BOOL fShow);
STDMETHODIMP RequestNewObjectLayout();
STDMETHODIMP GetWindow(HWND FAR* lphwnd);
STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
STDMETHODIMP CanInPlaceActivate();
STDMETHODIMP OnInPlaceActivate();
STDMETHODIMP OnUIActivate();
STDMETHODIMP GetWindowContext(LPOLEINPLACEFRAME FAR* lplpFrame,
LPOLEINPLACEUIWINDOW FAR* lplpDoc,
LPRECT lprcPosRect,
LPRECT lprcClipRect,
LPOLEINPLACEFRAMEINFO lpFrameInfo);
STDMETHODIMP Scroll(SIZE scrollExtent);
STDMETHODIMP OnUIDeactivate(BOOL fUndoable);
STDMETHODIMP OnInPlaceDeactivate();
STDMETHODIMP DiscardUndoState();
STDMETHODIMP DeactivateAndUndo();
STDMETHODIMP OnPosRectChange(LPCRECT lprcPosRect);
};
struct Frame : public IOleInPlaceFrame
{
HtmlControl* host;
STDMETHODIMP QueryInterface(REFIID riid, void** ppvObject);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
STDMETHODIMP GetWindow(HWND FAR* lphwnd);
STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
STDMETHODIMP GetBorder(LPRECT lprectBorder);
STDMETHODIMP RequestBorderSpace(LPCBORDERWIDTHS pborderwidths);
STDMETHODIMP SetBorderSpace(LPCBORDERWIDTHS pborderwidths);
STDMETHODIMP SetActiveObject(IOleInPlaceActiveObject* pActiveObject,
LPCOLESTR pszObjName);
STDMETHODIMP InsertMenus(HMENU hmenuShared,
LPOLEMENUGROUPWIDTHS lpMenuWidths);
STDMETHODIMP SetMenu(HMENU hmenuShared, HOLEMENU holemenu,
HWND hwndActiveObject);
STDMETHODIMP RemoveMenus(HMENU hmenuShared);
STDMETHODIMP SetStatusText(LPCOLESTR pszStatusText);
STDMETHODIMP EnableModeless(BOOL fEnable);
STDMETHODIMP TranslateAccelerator(LPMSG lpmsg, WORD wID);
}; The implementations of Site and Frame will be provided if needed, so that this space isn't cluttered too much.
So, the interesting function here is HtmlControl::CreateWebControl() . Let's walk it through, so that the possible strangeness of the IWebBrowser2::Navigate2 failure can be better seen.
First, an instance of the WebBrowser COM object is created and its associated IOleObject is retrieved:
IUnknown* iUnknown = NULL;
HRESULT hr = ::CoCreateInstance(CLSID_WebBrowser,
NULL,
CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,
IID_IUnknown,
(void*)(&iUnknown));
VERIFY(SUCCEEDED(hr));
hr = iUnknown->QueryInterface(IID_IOleObject, (void*)(&iOleObject_));
VERIFY(SUCCEEDED(hr)); These operations were all successful in the sense that hr == S_OK .
After getting the WebControl object, I want to show/activate it using our IOleClientSite implementation:
hr = iOleObject_->SetClientSite(&iOleSite_);
VERIFY(SUCCEEDED(hr));
const RECT rect = GetClientRect();
hr = iOleObject_->DoVerb(OLEIVERB_SHOW, NULL, &iOleSite_, 0, GetHwnd(), &rect);
VERIFY(SUCCEEDED(hr)); These operations were also successful in the sense that hr == S_OK . However, the end result (the IWebBrowser2::Navigate2 failure) occurs also if OLEIVERB_SHOW is changed to OLEIVERB_UIACTIVATE or OLEIVERB_INPLACEACTIVATE .
Next, I dig the IWebBrowser2 out of the WebControl object and checks if the browser HWND is sane:
IWebBrowser2* iWebBrowser = NULL;
hr = iOleObject_->QueryInterface(IID_IWebBrowser2, (void**)&iWebBrowser);
VERIFY(SUCCEEDED(hr));
HWND hwndBrowser = NULL;
hr = iWebBrowser->get_HWND((long*)&hwndBrowser);
VERIFY(SUCCEEDED(hr));
VERIFY(hwndBrowser != NULL);
VERIFY(::GetParent(hwndBrowser) == GetHwnd());
IOleWindow* iOleWindow = NULL;
hr = iOleObject_->QueryInterface(IID_IOleWindow, (void*)(&iOleWindow));
VERIFY(SUCCEEDED(hr));
hwndBrowser = NULL;
hr = iOleWindow->GetWindow(&hwndBrowser);
VERIFY(hwndBrowser != NULL);
VERIFY(::GetParent(hwndBrowser) == GetHwnd()); Again, these operations were successful in the sense that hr == S_OK . Also, the browser HWND is equal in both method 1 and 2 and its parent is indeed our host control. I see this as some kind of indication that something works.
But... the thing I need doesn't work; the precious IWebBrowser2::Navigate2 :
VARIANT vURL;
vURL.vt = VT_BSTR;
vURL.bstrVal = ::SysAllocString(L"about:blank");
VARIANT vEmpty;
vEmpty.vt = VT_EMPTY;
hr = iWebBrowser->Navigate2(&vURL, &vEmpty, &vEmpty, &vEmpty, &vEmpty);
VERIFY(SUCCEEDED(hr)); Now I get hr == E_FAIL .
I cannot really see the problem, since everything up to this point worked successfully, and the last call seems trivial.
Is anyone still around all the way down here with some guess as to what might be going on?
Thanks for any input!
--
Time you enjoy wasting is not wasted time - Bertrand Russel
|
|
|
|
|
There's a article here on how to host the web browser via C code and the author does an *EXCELLENT* job of walking you through exactly what has to happen - try and look for that, maybe it will off you hints as to what's missing.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
PS if you can't find the article I wrote code for C++ on the desktop (don't know how applicable it is to embedded) that does wrap the web browser:
Win32WebBrowserHost.h[^]
Maybe that will help a bit?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
hi,
we can display icons in system tray. but i want to display an icon as number in system tray. how can i create an number icon in a system tray or dynamically?
or any way to create an icon dynamically?
Regards,
Srinivas
|
|
|
|
|
|
enhzflep wrote: Here ya'are, this code'll do it.
There really are nuggets of gold here on this site, eh...
Iain.
Iain Clarke appears because CPallini still cares.
|
|
|
|
|
Sure are mate. I'd hate to imagine what it would cost if I'd been required to pay for all that I've learned from this wonderful site.
You've certainly contributed to that which I know Iain.
Thanks All.
Simon.
The easiest way to make the world a better place is to refuse to help those that wreck it....
|
|
|
|
|
Hi all,
I have a folder and in that i have some files, i want to delete that folder with files and for doing so i am using RemoveDirectory api....
but it is not deleting my folder...
How can i do it????
Thanks in advance
|
|
|
|
|
Try this in CMD
rd /s FOLDER
i think it will work
Regards:
Xohaib Shirani
|
|
|
|
|
But i want to do it through coding...
|
|
|
|
|
While you can do what Shirani's suggests via code, it's definitely the wrong aproach.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
See Here[^]
Edit: Sorry, that was the CE-version.
See Here instead[^]
An interesting piece of information from that page is:
To recursively delete the files in a directory, use the SHFileOperation function.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|