|
See MSDN Article
http://support.microsoft.com/support/kb/articles/Q127/1/90.asp
for answer
|
|
|
|
|
Hi,all
Is the OnPaint function in MFC just the same as the content between BeginPaint and EndPaint in SDK????
Does the system create WM_PAINT after it receive WM_SETCURSOR?
Now there are some problems in my application.I describe
it simply just as below.
Firstly:
OnPaint()
{
LoadBigBitmap(); //can fill the whole client view
if(m_flag)
LoadSmallBitmap();
}
OnLButtonDown()
{
m_flag=TRUE;
Invalidate(FALSE);
UpdateWindow();
}
OnSetCursor()
{
// set my own Cursor and return TRUE
}
Then, when I run this application, errors occurrs.
First, it display the BigBitmap .
After I click down on the client view, then it would display
the SmallBitmap,although,just for a while. then when I move
the cursor the SmallBitmap will disappear.
It disturbs me for long time, who can help me???
All your help will be appreciated!
Regards.
|
|
|
|
|
some extracts from the mfc-sources:
CPaintDC::CPaintDC(CWnd* pWnd)
{
...
::BeginPaint(m_hWnd = pWnd->m_hWnd, &m_ps);
...
}
CPaintDC::~CPaintDC()
{
...
::EndPaint(m_hWnd, &m_ps);
...
}
void CView::OnPaint()
{
// standard paint routine
CPaintDC dc(this);
OnPrepareDC(&dc);
OnDraw(&dc);
}
So you are right: BeginPaint begins within the constructor CPaintDC dc(this), EndPaint is called from within the destructor; it's called when the local CPaintDC goes out of scope and that's at the end of CView::OnPaint.
If you look more precise at the sources, you'll find out that some extra work is done by MFC (OnPrepareDC, ...)
Markus
|
|
|
|
|
When I insert the picture with the Dialog Editor and select type as a icon,I get the icon with size as 32x32!
How can I select size of icon?
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Hello Eugene,
Double Click the icon-name from the Resource View to open it. Now press "Insert" on your keyboard. This will bring up the "New icon image" dialog. Select "Custom". Type in your width/height and press OK
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
I simply imported an icon, the size only 16õ16. On mine this same!
But the icon in dialog has all the same increased till the size 32õ32.
Any ideas!
|
|
|
|
|
Hi, i need some help with detecting when a CD is inserted or ejected from a drive. I've tried to override get the message handler...
afx_msg BOOL CWnd::OnDeviceChange( UINT nEventType, DWORD dwData );
but it doesn't seem to be called? The docs say that the WM_DEVICECHANGED message is sent to all top level windows? so shouldn't all the apps get this message.
If anyone has any code for this it would be really helpful
Thanks.
Jared Allen.
|
|
|
|
|
hi, all.
i have a variable(named: "void vp" or "int vp"), it contains a function's address, now i plan to assign it to an function pointer(named: "void (*pFunc)()"), what can i do?(can't be like: "pFunc = vp", right?
thanks all.
|
|
|
|
|
See this short program :-
#include <iostream.h>
void abc()
{
cout << "hello world\r\n";
}
void (*xyz)();
void main()
{
xyz=abc;
(*xyz)();
}
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
but actually i don't know the function name, and i just know its arguments, return type, and address.
|
|
|
|
|
okay,no probs
do this then
pFunction=(void(near*)())address;
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
it happens: "error C4226: nonstandard extension used : 'near' is an obsolete keyword"
|
|
|
|
|
use "far" instead.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
hehehe
sorry
I still have memory-left-overs from the DOS days
try the following instead :-
#include "stdafx.h"
void (*pFunc)();
int main(int argc, char* argv[])
{
pFunc=(void(__cdecl*)())0xffff0000;
return 0;
}
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Oooooook, just "pFunc = (void(*)())address" is ok.
thank you very very much, thank you all, especially thank you Busterboy.
|
|
|
|
|
I am doing some jobs as to store records like information into files. I've try the Compound File implementation of the Structured Storage, but the result files seems always too big for me, even one empty file costs about 2.5k! I like the way that the Compound File acts but the file size also means a lot to me. What should I do then?
|
|
|
|
|
Avoid structured storage - not only are the files big, but the performance is terrible. I tried using SS for an app that needed to store lots of small files in a single large file and the performance really sucked!
|
|
|
|
|
when the users maximized my window,i want the window cover the Windows' taskbar,how to do it?thanks
|
|
|
|
|
Try this code out :-
HWND hTBar=::FindWindow("Shell_traywnd","");
::ShowWindow(hTBar,SW_HIDE);
AfxMessageBox("hidden");
::ShowWindow(hTBar,SW_SHOW);
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
thanks,i really appreciate it.
but just hide the taskbar seems a little terrible.my users would be surprised if they couldn't find the taskbar when minimized the window.
what i want is just to hide the taskbar behind the window when users maximized the window,i mean just let the window cover the taskbar,but not really disappear the taskbar from the screen.
can you help me?
|
|
|
|
|
ON_WM_ACTIVATE:
if (activate & fullsize)
hide_taskbar
else
show taskbar
think this should work..
bernhard
"There are three roads to ruin: women, gambling and technicians. The most pleasant is with women, the quickest is with gambling, but the surest is with technicians." Georges Pompidou
|
|
|
|
|
Hello,
I am trying to read the last 128 bytes of a compressed file(MP3)... How can I extract the last 128 bytes and display this information in a CString.. I am using CFile to open the mp3 and dumping the entire contents into a char.. I then dump that into a CString.. but the format is all wrong. Can anyone give me some pointers on how to dump the last 128 bytes of a file into a CString? If I open the file in notepad and scroll to the bottom.. I can see the information I'm trying to extract.
Thanks,
Rob
|
|
|
|
|
A CString is the wrong thing to use. I assume you're looking for an ID3v1 tag? The tag can have embedded 0 bytes, or the tag might not even be present. Use an array of 128 BYTEs instead and parse it manually. See this shell extension article where I do exactly this.
--Mike--
http://home.inreach.com/mdunn/
While I can't be correct on all matters, I can make the reassuring claim that where I am inaccurate, I am at least definitively inaccurate.
your with and
Sonork - 100.10414 AcidHelm
|
|
|
|
|
Thanks Mike!! Thats exactly what I'm trying to do. I'll give it a look in the morning.
Thanks again
Rob
|
|
|
|
|
I am converting a class to unicode and got all of it but a single instance of strlen. What should I use instead?
-Matt Newman
-Matt Newman
|
|
|
|