|
dear Mr Alan
thanks a lot for your great help
but since i am a beginner to this..i am not too sure of the docu template pointer u refer to.
when i compile, how should i declare my pTemplate as?
is this pTemplate u refer to as the docu Template pointer?
wat should i put for the variable type for pTemplate?
would appreciate if u haf a copy of source code to refer to me. (kiplier@hotmail.com)
thousand thanks
|
|
|
|
|
OK, the code you should refer to is in the InitInstance function of your CYourApp class (where CYourApp is the class that encapsulates your whole application and its name depends on what you set it too), and it looks like this :
CMultiDocTemplate* pDocTemplate;
pTemplate = new CMultiDocTemplate(
IDR_YOUR_MENU,
RUNTIME_CLASS(CYourDoc),
RUNTIME_CLASS(CYourFrame),
RUNTIME_CLASS(CYourView));
AddDocTemplate(pTemplate);
CMainFrame* pMainWnd = new CMainFrame;
...
m_pMainFrame = pMainFrame;
m_pMainFrame->m_pTemplate = pTemplate;
when i compile, how should i declare my pTemplate as?
you declare your pTemplate as a CMultiDocTemplate*.
is this pTemplate u refer to as the docu Template pointer?
Yes.
wat should i put for the variable type for pTemplate?
the variable type is a CMultiDocTemplate*
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
how to change the keyboard's Num Lock status programmatically?
|
|
|
|
|
take a look at SetKeyboardState
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
The documentation for SetKeyboardState() correctly says that you cannot use this API to toggle the NUM LOCK, CAPS LOCK, and SCROLL LOCK keys.
|
|
|
|
|
You read it wrong friend.
What the documentation says is that the indicator lights won't get turned on/off, but the states DO CHANGE for the calling thread.
[snip]
Because the SetKeyboardState function alters the input state of the calling thread and not the global input state of the system, an application cannot use SetKeyboardState to set the num lock, caps lock, or scroll lock indicator lights on the keyboard
[/snip]
Regards
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
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
|
|
|
|