|
Let ToolBarCtrl's buttons have diffrent size icons in ONE bitmap resource.
Help me please!
|
|
|
|
|
this is what I used in my CMainFrame class's OnCreate() handler function. My bitmap has 9 32 x 32 bitmaps in one image.
<code>
HBITMAP hbm = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP1), IMAGE_BITMAP, 0,0,
LR_CREATEDIBSECTION | LR_LOADMAP3DCOLORS );
CBitmap bm;
bm.Attach(hbm);
int ret = m_ilToolBar.Create(32,32,ILC_COLOR8 | ILC_MASK,1,0);
ret = m_ilToolBar.Add(&bm,RGB(0,0,0));
m_wndToolBar.GetToolBarCtrl().SetImageList(&m_ilToolBar);
SIZE szButton,szImage;
szButton.cx = 39;
szButton.cy = 38;
szImage.cx = 32;
szImage.cy = 32;
m_wndToolBar.SetSizes(szButton,szImage);
m_wndToolBar.GetToolBarCtrl().AutoSize();</code>
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
Sorry,but I can't exactly understand the codes.
Have you seen the "Google Toolbar" in IE?The icon in the first button("Google" button) is rectangle and much longer than the others.I want to implement a toolbar just like that.I mean that my first icon may be "100x20" pixels,and my second icon may be "20x20" pixels,and so on...
|
|
|
|
|
Hi Guys ...
All those lovers of conio.h of borland C , I have got a gift for you ...
Yeah I know you have been missing all those functions of conio.h
I recoded them....
You can get library at my personal site www.maxpert.tk in downloads section...
I hope you love it ...
Waiting For Your response
|
|
|
|
|
IMHO
Wrong forum...
How do I print my voice mail?
|
|
|
|
|
Conio.h in Windows Enviornment CoOL
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Conio.h in Windows Enviornment CoOL
Any wAy thanks
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
you can already include conio.h in VC++ or at least in my version (VS.NET 2003)
ALL YOUR BASE ARE BELONG TO MICROSOFT!
Demonware Studios Leader
|
|
|
|
|
EDIT: This wasn't it either Turns out an application cannot select more than one bitmap into any one device at a time...i'll look into this more carefully now...
What causes SelectObject to fail???
I am trying to select a BITMAP into a memory DC I created using CreateCompatibleDC but it returns NULL...?
I can however select Pens, etc into the DC and everything is cool...why would a bitmap fail???
The bitmap is actually loaded my an imagelist and is retreieved using:
GetImageInfo(nImage, &ii);
CBitmap* pBmp = CBitmap::FromHandle(ii.hbmImage);
I'm inside a derived CImageList::Draw()
The memory DC is created from the pDC passed in as the first parameter to Draw .
All the handles and pointers to everything else are cool...for instance ii.hbmImage is not NULL...
I've tried using PJ Arends HBITMAP viewer, but can't get it working...
Any reason why SelectObject() would fail on BITMAPS??? I've tried MFC objects and SDK handles...still no go...
The only thing I can think of is...initially I first had one of my icons in the imagelist as an 24x24 32bit image...and the rest were normal 16x16...but i've since removed that 32bit image and still nothing...i've rebuilt and everything...?
Would SelectObject if a BITMAP is invalid or something??? What the heck is going wrong...any ideas???
Thanks
How do I print my voice mail?
|
|
|
|
|
The only thing I would say is the bitmap is incompatible with the dc.
What happens if you change the lines
<br />
CBitmap* pBmp = CBitmap::FromHandle(ii.hbmImage);<br />
memDC.SelectObject(pBmp);<br />
to
<br />
CBitmap bitmap;<br />
bitmap.CreateCompatibleBitmap(pDC, ii.rcImage.right - ii.rcImage.left, ii.rcImage.bottom - ii.rcImage.top);<br />
memDC.SelectObject(&bitmap);<br />
<br />
** Forgot a line **<br />
<br />
CImageList::Draw(&memDC, nImage, point, ILD_NORMAL);<br />
<br />
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
It worked!!!
Thanks
hoever i'm confused as to why...if the bitmap is larger than the DC is it not valid???
I added icons to the image list...but I thought/think they were stored as HBITMAP anyways...
Regardless...it appears to be working now which is great news
Thanks you muchly!!!
Cheers
How do I print my voice mail?
|
|
|
|
|
Pooh
I just remembered why I didn't use this approach...
I was trying to select bitmaps from an imagelist which had icons added by the user...
if I create a compatible bitmap, then how do I get those icons bitmaps into that compatible bitmap so when I draw I see icons which were loaded by user???
Creating a compatible bitmap would work if I was drawing directly to the bitmap...but I just wanted to select existing bitmaps images onto this memory DC then blit them to DC...???
Do I make sense???
I've been cranking away at this problem all day...sorry if I sound confused...
How do I print my voice mail?
|
|
|
|
|
I think I found the problem:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;131279
Hopefully this saves someone headaches
Cheers
How do I print my voice mail?
|
|
|
|
|
When I saw your problem I looked up SelectObject...
"An application can select a bitmap into memory device contexts only and into only one memory device context at a time. The format of the bitmap must either be monochrome or compatible with the device context; if it is not, SelectObject returns an error."
I figured, I can't see it being because of the single dc at a time rule, must be a compatibility problem. Wrong again!
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Hi Guys,
Not sure if this is the best place to post this question, but I gotta start somewhere.
Here at work, we are using an ActiveX Spreadsheet control, but I cannot seem to find any information on its interfaces and the like. Can someone point me in the direction of where I can get some information about this control. We are using C++/MFC on the VC++ 7.1 system. So, what ever version of the control comes with that setup.
Much appericated.
Larry J. Siddens
|
|
|
|
|
Hi,
I am doing an image processing project. I have downloaded CxImage, I wanted to append the *.h files of CxImage to the external dependecies. When I tried adding them by going to Project | Add files and then selecting a particular *.h files, it adds the *.h files to the Header folder. Can any one tell me how to work with CxImage and add the *.h files to the external dependencies.
Thanks
|
|
|
|
|
"External dependencies" lists headers that you include that are not part of the project, that's what the "external" part means. Having the files in "External dependencies" doesn't make a difference when you build, since that is just a IDE feature.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
|
|
|
|
|
DnsQuery works great if dns server listing on port 53. How to specify a port number other that 53?
|
|
|
|
|
Hello,
I have ATL DLL Project with MFC support in VS2003. During one of build I got the next error: ‘error LNK2005: _DllMain@12 already defined in MSVCRT.lib’. I’ve figured out the same information was founded in mfcs71.lib. How to fix this problem? Please help!
Regards,
Leonid
|
|
|
|
|
I want to know (programatically, of course: I am not blind!) if my application is displaying a MessageBox() or otherwise engaged in a modal dialog.
The context of the question is this: I am in a CView* and I want to do something to the user interface. I need to know if my application is "busy" waiting for a modal dialog before I can proceed with my changes ???
I have tried GetActiveView() and it tells me if "this" view is the current "top" view. (I run modal loops in my views) so this is coverd.
I am about to try GetFocus() then GetOwnerWnd()...
Maybe someone already has the answer??
|
|
|
|
|
I got it, I think!
GetLastActivePopup()
I wonder where I was for the last XX years, I tought I knew WIN32.
It goes to show, you learn something every day!
|
|
|
|
|
OOps. this is not good: GetLastActivePopup() still returns my VIEW's HWND instead of that of the MessageBox()
I guess I can either (a) keep looking or (b) find someone smarter than me to give me the answer!
|
|
|
|
|
ummmmm
why dont u set a variable in the calling view or doc class when the dialog pops up and clear it when it goes away?
"there is no spoon" biz stuff about me
|
|
|
|
|
I tapught about that. The problem is that ma application has maybe 100 views or screens, and I want beautiful code, not a quick hack.
Whatever would force me to spend lots of time working like a robot is not a great idea. I may capture all invokation of message boxes and dialog boxes, but as I (or someone else) maintain my applicatio, I am scared to "forget" about it.
If I could use WIN32 to tell me is a messagebox is up and running, I write once and can rely on that no matter how my stuff is written, putting the logic in a base-class somewhere.
|
|
|
|
|
What did they do to VC++? All my VC++ 6 MFC program doesn't work properly. I tried to create a simple Hello World console program in VC++ .net and it gives cout not define.(Got stdio to work but I can't seem to get iostream or iostream.h to work)
|
|
|
|