|
this is a code I used to load a PNG image stored in the resources using Bitmap class and IStream, hope it could help you
HGLOBAL hGlb = NULL;
HRSRC hRs =
FindResource(AfxGetInstanceHandle(), MAKEINTRESOURCE(nID), "RT_PNG");
if(hRs)
{
ULONG size = SizeofResource(AfxGetInstanceHandle(), hRs);
hGlb = LoadResource(AfxGetInstanceHandle(), hRs);
HGLOBAL hStream;
void * pData, *pData2;
pData = LockResource(hGlb);
hStream = GlobalAlloc(GMEM_NODISCARD | GMEM_MOVEABLE, size);
IStream *ptrStream;
hr = CreateStreamOnHGlobal(hStream, true, &ptrStream);
ULONG dummy;
ptrStream->Write(pData, size, &dumm);
UnlockResource(hGlb);
m_ptrBm = Bitmap::FromStream(ptrStream);
ptrStream->Release();
}
else
{
int i = GetLastError();
return;
}
the PNG image resource is a full PNG image file just stored in the memory.
|
|
|
|
|
Hi,
I am trying to manipulate a List Control at the cell level, trying to have let's say different cell width and heights in the same row.
Can this be done, or does anyone know how to do it?
THanks in advance.
|
|
|
|
|
I encountered same prob a year ago. I don't think there's a way. I also needed to use different fonts for each cell. Best bet is to use third party windows, i.e. grid controls etc.
You can easily modify the width of each cell independently of each other though.
|
|
|
|
|
Yes, you can control all aspects of the painting of each "cell" in a list view (reportmode). You need to use the LVS_OWNERDRAWFIXED style when creating it. Then, in your DrawItem handler, either call the default method for cells you are not interested in custom drawing, and paint the cell yourself for those that you want to control. See LVS_OWNERDRAWFIXED in the doc.
|
|
|
|
|
For example, there are typically 3 buttons on a window's title bar: "minimize", "maximize" and "close". Now if I hate the rectangular image of the "maximize" button and want to change it to, say, a circle, or simply I want to add an additional button to the title bar, is that possible? Thanks a lot.
|
|
|
|
|
The only way that I know of to do this is to trap the WM_NCPAINT and do one of two things:
1) call the default handler and then paint over the [X] button with your own widget
2) take total control over painting the window frame yourself.
|
|
|
|
|
1) Very easy for Dialogs
2) Pain in the a** for SDI/MDI apps.
I wasted two weeks to implement skining SDI(MDI), custom buttons + var size caption. Trouble is MFC 4x paint those buttons outside of NC_PAINT. If your buttons smaller than standard buy some preparetionH.
Brian
|
|
|
|
|
Could you please post some details on how to do so on a CDialog? Thanks.
|
|
|
|
|
Hi,
how did you solve the problem with maximized MDI childs ? I'm trying to add another button to the title bar but I don't know how to do it when it's maximized.
Ciao Matthias Mann
|
|
|
|
|
I beleive I saw an article on codeproject about adding anouther button to the title bar, sorry I do not remeber what it for. If you can find it then you may have most of your solution.
Trust in the code Luke. Yea right!
|
|
|
|
|
Here is a error throw out when debug my program.
I know this question was asked for many times!
And I have search it and seen it.
I use several method which I get from web .
I select Edit==>Breakpoints And find none breakpoint there!
And I ReSetup a new project with same name .
copy all .h .cpp .rc files into the new project.
but the error throwed out yet!
I don't know why!
each time when the error occured,it stoped at
NTDLL! 77f9180c()
there are a part of code as follow:
<br />
m_pStillImage=new CxImage();<br />
if(m_pStillImage==NULL)<br />
return false;<br />
if(!m_pStillImage->Load(strFilePathName,ExtType))<br />
{<br />
return false;<br />
}<br />
........
if((m_TotalFrame=m_pStillImage->GetNumFrames())>1)<br />
{<br />
m_MoviePicDelay=m_pStillImage->GetFrameDelay();<br />
m_pMovieImage=new CxImage[m_TotalFrame];<br />
for(int i=0;i<m_TotalFrame;i++)<br />
{ <br />
m_pMovieImage[i].SetFrame(i);<br />
m_pMovieImage[i].Load(strFilePathName,ExtType);<br />
}<br />
if(m_pStillImage)<br />
{<br />
delete m_pStillImage;<br />
<big>
m_pStillImage=NULL;<br />
} <br />
}<br />
anybody!please help me!
Don't look at me in that way!
|
|
|
|
|
Try:-
1. looking at the call stack when the error occurs
2. m_pStillImage->Destroy() before delete m_pStillImage
3. CxImage m_StillImage instead, if this fails then you probably have something like a memory overwrite, use of an invalid pointer etc. in some part of your code
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
Hi
Can anyone explain to me how to define and implement callbacks in C? Just briefly. I'll get along from there
Thanks
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
OK i figured it out myself
Just one question, how do I define the callback properly, as both the folowwing gives the same results:
typedef int (SCCB)(char** suggest, int size);
or
typedef int (*SCCB)(char** suggest, int size);
Help appreciated
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
You are declaring a POINTER to a FUNCTION, so the correct syntax is:
typedef int (*SCCB)(char** suggest, int size);
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Hi:
How to show the tooltip for the menu? You can see this feature in IE's favorites menu. How could it do?
thanks
benben
|
|
|
|
|
you can try capturing menu messages (im too lazy to look up how) and consequently creating tooltip windows using the common control API
it's a big involved because it's probably not standard with windows
Roman Nurik
|
|
|
|
|
Hi, everyone!
I want to know what means "typo"? I often see it in
the reply of others. Who can you show me an example?
Thanks in advance,
George
|
|
|
|
|
A typo is simply when you type something wrong, e.g. you want to type if(pPointer == NULL) , but instead type if(pPointer = NULL) , which has a very different meaning.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks, Greg buddy!
Any type error can be called a typo?
regards,
George
|
|
|
|
|
Yep, "typo" is an abbreviation of "typographical error", as far as I know.
reagrds
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks, Greg buddy!
How interesting it is!
Have a nice weekend,
George
|
|
|
|
|
George2 wrote:
I want to know what means "typo"?
A mistake when typing.
-Nick Parker
|
|
|
|
|
Thanks, Nick buddy!
George
|
|
|
|
|