|
Do you want to change size of image ?
|
|
|
|
|
no actually the image should be transparent with the button
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
|
|
If you create an masked image list from the bitmap and add that to the button you should be able
to get transparency.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I have a template function.
template <class T > void MyClass::DoSomething( int tag, T& value )
{
}
and it gets called like :
MyClass myClass;
double d = 0.0;
myClass.DoSomething <double >( 2, d );
When the function is in the C++ file it produces a link error (LNK2019).
If I place the function in the H file, all goes well.
any ideas ?
Thanks.
|
|
|
|
|
mmm,
an element type is a class? Because you are using the double "d" as the class in the second parameter of your template "T& value".
And the second thing is that the template expects a reference, and you are passing the "object" itself.
try with: double* d = 0.0;
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Nelek wrote: an element type is a class?
Nelek wrote: the template expects a reference, and you are passing the "object" itself.
Both seems perfectly right to me.
I am not sure if I got your first point right, but the second point is the proper way of calling a function with a reference-argument.
Failure is not an option - it's built right in.
|
|
|
|
|
an element type is a class? Because you are using the double "d" as the class in the second parameter of your template "T& value".
No. This is a template declaration and therefore the keyword class [or typename] stands for "some type".
And the second thing is that the template expects a reference, and you are passing the "object" itself.
try with: double* d = 0.0;
Again no. The terms you are using are messed up. First, double *d doesn't declare a reference but a pointer. Second, if it were, it would be wrong too; no need [even meaningless] to declare a reference to pass a function that takes its argument as a reference. You do provide a variable which is passed into the function by a reference value, and this is all.
--
=====
Arman
|
|
|
|
|
Maximilien wrote: When the function is in the C++ file it produces a link error (LNK2019).
If I place the function in the H file, all goes well.
This is the expected behaviour: At the time of instantiating a DoSomething -version with double as template-parameter, the compiler needs the full definition of DoSomething .
So it has to be in the .h -file.
The easiest part is to just live with it.
And possibly have DoSomething call type-specific worker-functions from some cpp.
Failure is not an option - it's built right in.
|
|
|
|
|
When the function is in the C++ file it produces a link error (LNK2019).
You mean source file?
Anyway, you would better to show the class declaration. I guess it is in a header file. Thus the linker cannot bind the definition with a [proper] declaration. The simpliest way to solve the problem is moving the function definition into the header file [make it inline if you would like to define it outside the class declaration].
--
=====
Arman
|
|
|
|
|
I may not be following your problem correctly, but I placed the following code in a .cpp file and it compiled and linked fine:
template <class T>
class MyClass
{
public:
void DoSomething( int tag, T& value );
};
template <class T>
void MyClass<T>::DoSomething( int tag, T& value )
{
}
void main( void )
{
MyClass<double> myClass;
double d = 0.0;
myClass.DoSomething(2, d);
}
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
This reminds me of the sorts of errors I got on older compilers (when I was learning about templates) if the definition was not in the header. I don't know what the situation is with newer compilers as I always put the code in the header.
The reason was that it was necessary for the compiler to have the function definition when it encountered a specific instance of the templated function in order to create the code. To create the code for a templated function definition the compiler needs both the function definition and an instance that specifies what template parameters are required.
So for example, when the compiler encountered DoSomething<double> that would trigger it to create the actual 'double' version of the code. This would work if the definition was available to the compiler at the time; either in the header or in the actual source file that the 'double' version was used in. If it couldn't find the definition no object code was created and unless the code for DoSomething<double> was created elsewhere, a linker error would result.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
Just as a class isn't an object,
a template isn't a class/function.
The instance of the template is the class.
The compiler needs to know how to generate the class.
For this it needs access to the template definition.
When you put template code in the C++ file the compiler has nothing to compile because the template isn't a class (it's not compilable source code).
When you use the template to create an instance (a class/function i.e. MyClass::DoSomething<double>) the compiler needs to know, at that point, how to construct the class/function. Because you've put the code in a C++ file it can't see it when it compiles the module that wants to create/use the template instance.
... granted, this is how things are now, people have been talking for a while about getting compilers to 'pre-compile' templates (some how).
...cmk
Save the whales - collect the whole set
|
|
|
|
|
|
|
Is is possible to have some string resources using the same ID in more versions depending on defined constans (in visual studio 6.0)? Or use more than one resource file?
I can have multiple versions dialogs/icons/bitmaps, but I cannot find this option for strings.
Thank you!
rrrado
|
|
|
|
|
rrrado wrote: string resources using the same ID in more versions
What this means?
Are you trying to store string in different language while keeping the ID same.
It is possible to keep the ID same and have string in different language.
Afterwards you can retrive any string depending upon the language using the same ID.
|
|
|
|
|
It is not for different languages, but I've solved this.
Thank you.
rrrado
|
|
|
|
|
Hello All,
In our project client need to lock all HotKeys.I have tried
SetWindowHookEx(Wh_KeyBoard,KeyProc,...);
But it lock all keys except hotkeys
LPRESULT WINAPI CALLBACK KeyProc(int nCode,WPARAM wParam,LPARAM lParam)
{
......
}
So I have tried
#define _WIN32_WINNT 0x0400
#include <windows.h>
SetWindowHookEx(Wh_KeyBoard_LL,LowLevelKeyBoardProc,...);
LPRESULT WINAPI CALLBACK LowLevelKeyBoardProc(int nCode,WPARAM wParam,LPARAM lParam)
{
......
PKDLLHOOKSTRUCT p=(PKDLLHOOKSTRUCT)lParam;
or
KDLLHOOKSTRUCT *p=(KDLLHOOKSTRUCT *)lParam;
}
But it doent work WH_KEYBOARD_LL doesnt call the LowLevelinputProc
even dll also not working
I have installed vc6.0 and Platform SDK Servoce Pack 2
Plese give me any information that how I can Lock the Hotkeys
|
|
|
|
|
Are KeyProc() and LowLevelKeyBoardProc() in a DLL?
abhiakude wrote: ...WH_KEYBOARD_LL doesnt call the LowLevelinputProc
How are you verifying this?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes KeyProc and LowLevelKeyBoardProc are in dll
First I am Loading the dll using LoadLibrary
and call both procedures using SetWindowHook in My main application
but WH_KEYBOARD for KeyProc work propely but not for LowLevelKeyProc
So I have used WH_KEYBOARD_LL but it cant call the LowLevelKeyProc
For verifying this i am displaying one Messagebox in both procedures in the dll.
|
|
|
|
|
What does your call to SetWindowHookEx() look like?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Now I am successfully locked all hotkeys using SetWindowHookEx(WH_KEYBOARD_LL,...) but it does not lock Ctrl+Alt+Del key.Is there any solution to lock using SetWindowHook or any other method for it.
|
|
|
|
|
You'll need to provide your own GINA DLL, thus replacing Microsoft's (MSGINA.DLL).
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|