|
LoadImage() has a LR_MONOCHROME flag
-Jack
To an optimist the glass is half full.
To a pessimist the glass is half empty.
To a programmer the glass is twice as big as it needs to be.
|
|
|
|
|
LR_MONOCHROME "loads the image in black and white", according to MSDN. May not work for grayscale.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
It is a gray image not B/W.
|
|
|
|
|
What kind of file it is? .bmp?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
|
LoadImage will work. In fact, it should work with all .bmp files - just use LR_LOADFROMFILE flag.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
What is specific to grey images is they do not have more than 256 colours because all the grey colours have the same r g and b values. But as has been said, there is not reason the computer will even realise an image is grey when it loads it, using any standard method, such as loadimage.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
The best way of being sure that the image you load is greyscale, would be to greyscale it yourself upon loading. Do this by setting r,g,b each to the same value, (r+g+b)/3.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
class A
{
public:
A()
{
}
virtual ~A()
{
}
void (A::*ptFunc)();
};
class B:public A
{
public:
B()
{
ptFunc = &(B::b_func);
}
virtual ~B()
{
}
void b_func()
{
cout<<"B::b_func"<
|
|
|
|
|
I have think it out, thank you
#include <iostream.h>
template <class T>
class A
{
public:
A()
{
}
virtual ~A()
{
}
void (T::*ptFunc)();
};
class B:public A<B>
{
public:
B()
{
ptFunc = &(B::b_func);
}
virtual ~B()
{
}
void b_func()
{
cout<<"B::b_func"<<endl;
}
};
int main()
{
B b;
(b.*(b.ptFunc))();
return 0;
}
I'm amumu, and you?
|
|
|
|
|
But now I meet another question:
I want to define a array whose item is pointer of A<t>, which may be store B or C or D ( any classes inherited from A<t> ), how to write it?
I'm amumu, and you?
|
|
|
|
|
By creating an array of pointers to A. OR even better, a std::vector of pointers to A, but if you use a vector, remember to call delete on items before removing them.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Christian Graus wrote:
if you use a vector, remember to call delete on items before removing them.
The same thing applies to plain array...
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Tomasz Sowinski wrote:
Christian Graus wrote:
if you use a vector, remember to call delete on items before removing them.
The same thing applies to plain array...
Yes, and no. A plain array does not offer an erase method, which a beginner would probably assume will clean up after them, therefore it's probably more obvious with a plain array that you need to delete your pointers.
But you're right, I should have clarified, lest I give the impression that I was saying that somehow a vector makes it necessary to call delete
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
No,no,no, my meaning is how to write like the following code:
A<T>* ptA;
B b;
C c;
ptA=&b; //upcast here
ptA->xxx();
ptA=&c; //upcast here
ptA->xxx();
But the "A<T>* ptA" is invalid, because it need instantiation here, I must fill the T with B or C, but if I write A<B>* ptA, then ptA=&c is invalid, the same as writing A<C>* ptA.
Now I want to know, how to define a pointer can pointer b or c?
I'm amumu, and you?
|
|
|
|
|
By definition, a pointer to A can be set to be a new B or C, if B and C derive from A. I don't know that passing an address should work any different. Why can't the B and C instances be stored as pointers ?
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Because I need dynamic load B or C or D, from the viewpoint of main program, it only know A, (B C D)is developed later and loaded later.
I'm amumu, and you?
|
|
|
|
|
Hi guys,
I have implemented the code that dinamically change my toolbar's tooltips in CMainFrame. I found the code in WinFrm.cpp.
The problem is that I cannot access CMainFrame thru the Wizard anymore. Meaning that I cannot add anymore handlers.
Any advice is appreciated.
The code is :
CMainFrame.Cpp
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXT, ...., ..., ...)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, ...., ..., ...)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, ...., ..., ...)
CMainFrame.h
afxmsg BOOL OnToolTipText (..., ..., ..., ...)
Thanks.
Louis
|
|
|
|
|
Try to delete the .clw file - ClassWizard will rebuild it from sources.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Thanks.
Sorry for my late reply. Easter and family holidays here in S.A.
But I found my mistake.
Firstly, ClassWizard does not handle ON_NOTIFY_EX_RANGE. If one wants to use it, one must edit the message map oneself.
Also, I moved ON_NOTIFY_EX_RANGE outside the //{{AFX_MSG_MAP.
All is OK.
Cheers.
Louis
|
|
|
|
|
Hi,
I have an ActiveX component showing two buttons.
When you press the buttons a pop up message appears.
When I add the following in an HTML doc:
<OBJECT classid="clsid:56C19B8A-3BD8-11D6-8F9C-0006294E85D7"></OBJECT>
<OBJECT classid="clsid:56C19B8A-3BD8-11D6-8F9C-0006294E85D7"></OBJECT>
In IE see the object twice. When I click on a button the pop up message appears.
I want to program this behaviour myself.
I took the 'oclient' sample project from MSDN, compiled it and made a new document
in which I inserted my OCX twice. Saved it.
Now, I changed the function CMainView::OnLButtonDown() to this:
[I know I can't move any objects, but it's for ease]
void CMainView::OnLButtonDown(UINT /*nFlags*/, CPoint point)
{
CRectItem* pItemHit = GetHitItem(point);
if (!pItemHit) return;
pItemHit->DoVerb(OLEIVERB_UIACTIVATE, this);
}
Now, when I click the item it is first activated.
It's only when I click for a second time on the button, that the pop up message appears.
I want the pop up message appearing from the first mouse click (like in IE).
How do I implement this behaviour?
Thanks in advance.
|
|
|
|
|
Hello every body
I am using a CRecordset object but I want to make my own connection string, not defult,so how can i make this? is it don by using CDatabase Object and how?
Best Regards
|
|
|
|
|
If you are using access you can just give file path or if you use ODBC driver this is another example:
CDatabase aDB;
try
{
aDB.OpenEx("DSN=MyDSN");
CRecordset aRS(&aDB);
aRS.Open(CRecordset::forwardOnly,
"SELECT DISTINCT state FROM authors");
.
.
.
.
or another example for SQLServer(without ODBC) this is a connection string:
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=NorthWind;Data Source=MAZY;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=MAZY;Use Encryption for Data=False;Tag with column collation when possible=False
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I am currently playing with the concept of designing a custom toolbar from CControlBar, this is actually a lot more difficult than I thought.
I'm thinking i'll probably go with just deriving from CWnd and include some controlbar repositioning code (I don't need docking).
Shog9 pointed out that doing this is pointless because the short life expectancy of MFC(VS.NET and all) and the time required to design a toolbar isn't worth it. However I don't want to derive from CToolBar I wanna start from scartch. I'm an anus...no really my face looks like a colon(spelling).
Anyways...if i do derive from CWnd(although the fact MFC is dying slowly has no effect on me) what is the C# (probably the direction i'd go in, it's closer related to C++???) equivelant...? Or is there one...?
I'm dead set on starting from either CControlBar, but will probably end up deriving from CWnd, cuz I can't get nothing from CControlBar. Stupid thing is like my last girlfriend, so much work...so little profit...
Basically if I do this (even though it doesn't concern me really, yet anayway!) what is the probability of getting the same thing to work in later versions of VC++ 7.0+..?
Ciao!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
HockeyDude wrote:
Shog9 pointed out that doing this is pointless because the short life expectancy of MFC(VS.NET and all)
VS.NET has new version of MFC. What's the problem?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|