|
delete it from menu "image" in resource edit
includeh10
|
|
|
|
|
I don't follow...
What do I delete and how do I delete it? I'm using VS6 if that makes a difference.
I assume you mean to delete the 16x16 version that VS generated? If so, after I do that, how do I tell VS to use my 16x16 version? How do I tie it in?
Thanks,
Ian
|
|
|
|
|
do you want to use 16x16 image for icon?
includeh10
|
|
|
|
|
I want my application to use the 32x32 icon when applicable, and the 16x16 icon where applicable. But when Windows needs to show the 16x16 version, I want it to use my 16x16 version, not the one generated by VS.
-Ian
|
|
|
|
|
i think u don't know how to edit the 16x16 image?
when u edit the icon, go to menu image/open-device-image then select 16x16 one from dialog box of "open icon image".
includeh10
|
|
|
|
|
The 16x16 that I want shows up in the resource editor but that is not the one that is being used. Windows is still displaying the one VS generated. I don't know where it's coming from or how to get rid of it and force the 16x16 icon I created to get used.
|
|
|
|
|
Ian Bowler wrote:
I don't know where it's coming from or how to get rid of it...
Each icon resource generally has 1-3 resolutions (16x16, 32x32, and 48x48). To edit a particular resolution, open the icon in the resource editor and select the desired resolution from the Device: combobox.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
CWinApp::LoadIcon loads only the 32x32 icon. What you have to do is use the LoadImage() function, specifing the size of the icon you want (16x16) and use that icon in the CWnd::SetIcon() function.
Check out CWinApp::LoadIcon, LoadImage, and CWnd::SetIcon in MSDN for more information.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
As it turns out, the problem was that the 16x16 had a lower color depth than the 32x32. I modified the color depth of the 16x16 version to that of the 32x32 version and that fixed the problem. I'm guessing Windows (I'm on XP) defaults to it's own 16x16 version if the one supplied has less color depth than the 32x32 version?
Strange...
Thank you all for your help. I really appreciate it.
-Ian
|
|
|
|
|
How would I go about setting up a class with dynamic array?
class CMyArray : public CObject
{
private:
int array[MAXSIZE]; //MAXSIZE is dynamic
public:
CMyArray();
virtual ~CMyArray();
};
I tried using template but when I am getting invalid use of local variable ' ' as non-type argument
int main(){
int size=30;
CMyArray<size> *pMyArray;
pMyArray = new CMyArray<size>;
return 0;
}
|
|
|
|
|
try to copy code from MFC class "CArray", then modify it.
do not inherited CObject, it is useless at your stage.
includeh10
|
|
|
|
|
You can use template< class T> class yourClass{
...
Array[T]
...
}
After that you replace class T by interger value
Good luck
Bye.
|
|
|
|
|
I thought template <class t=""> is used for changing int/char/BOOL etc.
Now I am getting invalid template argument for 'size' type expected
|
|
|
|
|
template <int size=""> class A
{
char name[size] ;
} ;
when you new a object A you must put extractly number ( real value)
don't put variant . because template is transfer to code at compiler-time
thanks
|
|
|
|
|
Anonymous wrote:
int array[MAXSIZE]; //MAXSIZE is dynamic
This array has a static, not dynamic, size. To make it dynamic:
class CMyArray : public CObject
{
private:
int *array;
public:
CMyArray()
{
array = new int[MAXSIZE];
}
virtual ~CMyArray()
{
delete [] array;
}
};
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
It is static but it should be dynamically changing everytime the class constructor is called.
Something like
A1 X X X X
A2 X X X
A3 X X X X X X
A4 X X X X
I guess I could do it that way. I thought maybe I could use template.
|
|
|
|
|
poiut wrote:
...it should be dynamically changing everytime the class constructor is called.
What's wrong with:
class CMyArray : public CObject
{
private:
int *array;
public:
CMyArray( const int size )
{
array = new int[size];
}
virtual ~CMyArray()
{
delete [] array;
}
};
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Nothing wrong with it. I just wanted to practice using template and see how it works.
Thanks for the help
|
|
|
|
|
Are you sure your class IS A array, instead of HAS A array ? Don't use CArray, it's crap. Contain a vector, and if you want your class to be an array, expose the methods you need to.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I'm trying to implement a timer in my UI thread, with a call back. I need 3 timers setup. In order for my timer to work I need to pass a hwnd as part of the settimer function.
Is there a way to convert my m_hThread HANDLE to a HWND so that my timer will work?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Check out GetGUIThreadInfo() , maybe it helps you.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
A thread and a window are totally distinct objects.
If you don't have a window handy, pass a NULL HWND and a non-NULL function pointer to SetTimer() and it will call that function.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Tom Wright wrote:
Is there a way to convert my m_hThread HANDLE to a HWND so that my timer will work?
Short answer: No.
Long answer: The SetTimer function is used to tell the system to call a given function (in your process), at set time intervals. You can use the SetTimer function, even if there is no associated window (hWnd=NULL), in which case the nIDEvent has no meaning. What you would use it for, I have no ideas (at this time).
If your timers are all used in just one window, then you can call the SetTimer function once for each event that is required with different event IDs. Then switch on the ID passed to the TimerProc, to determine which timer event has occured. This also applies if you do not provide a TimerProc, in which case you need to handle the WM_TIMER message.
Of cource you could roll your own timer thread that takes the handle to a window and post message back to the window at given intervals. But why bother, when it is built in.
Good Luck!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
My problem is that my threads do not have windows. So I do not have a HWND to pass to settimer. The problem with that is that each thread has 3 timers in order for the 3 timers to work I need an nIDEvent to be passed. But this is ignored if I do not have a HWND. So my...hence my delemia. If I pass the HWND of my main app then if one thread kills a timer, then it's killed for all threads....why...I'm thinking that since the HWND and the nIDEvent are the same the message systems does not know which one to effect so it effects them all.
John R. Shaw wrote:
If your timers are all used in just one window, then you can call the SetTimer function once for each event that is required with different event IDs. Then switch on the ID passed to the TimerProc, to determine which timer event has occured. This also applies if you do not provide a TimerProc, in which case you need to handle the WM_TIMER message.
I'm not sure what you mean by this...can you explain some more?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom Wright wrote:
I'm not sure what you mean by this...can you explain some more?
When you are using a timer in a window, you use the nIDEvent parameter to set the event ID. The event ID is passed to the the TimerProc, so that you can determine which timer event caused the TimerProc to be called. For instants you may have an event that occurs every 1 second and anouther event that occurs every 5 seconds. By checking the event ID that is passed to the TimerProc, you can decide what your programm needs to do.
Now as for running a non-windowed thread that needs timer events, well you will probably have to insert code in that thread to check when the individule time periods have passed (manual time interval monitoring). Or you could roll your own timer thread and use one of the WaitFor... functions to check when a times up event to occur.
I know there is an article out there somewhere on rolling your own timer, but I have not looked at it in years, so I do not know where it is.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|