|
I use bitmaps for some toolbar buttons.
Ex.
In my .rc file I have:
<br />
FLDWZOOM BITMAP MOVEABLE PURE "fldwzoom.bmp"<br />
I my .cpp file I load the bitmaps for the buttons
<br />
case IDM_ZOOM:hBitmap=LoadBitmap((HINSTANCEhResource, "FLDWZOOM"); <br />
break;<br />
Can I load gif images instead of bitmaps?
If I can, what function must I use?
danginkgo
|
|
|
|
|
It's going to take some work. You can use OldLoadPicture to load a gif, which will give you an IPicture object. But you'll still need to show it on a button.
The windows BUTTON class only takes HBITMAPs, so you'd need to do some owner draw.
Luckily there's a whole bunch of owner-draw-buttons of all sorts here on codeproject. Look under desktop development / button controls. Even if you don't use one exactly (which would be a shock), you can still get good ideas on how to do your button.
Good luck,
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
Thank you, but I still have a problem.
I have the GIFs that I have to load for the buttons. The GIFs have transparent background. I must have transparent background images on my toolbar buttons.
I can't obtain transparent background BMPs from those GIFs.
I was hopping that I can use the GIFs.
So, I can use only BMP and ICO for windows BUTTON class?
danginkgo
|
|
|
|
|
danginkgo wrote: Thank you, but I still have a problem.
Luckily, I gave you a good answer - go have a proper read of the button section on codeproject. There you will find all sorts of owner-draw buttons.
Using the normal button class without doing extra work? Tough.
danginkgo wrote: So, I can use only BMP and ICO for windows BUTTON class?
Exactly.
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
|
danginkgo wrote: I have the GIFs that I have to load for the buttons. The GIFs have transparent background. I must have transparent background images on my toolbar buttons.
Just to follow up on what Iain said, here[^] is some sample code on OleLoadPicture .
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
OK, thanks, I'll try
danginkgo
|
|
|
|
|
hi all
Can you please help me with this basic pb
I have a structure
struct NameAndCode
{
char fName[10] ;
long fCode ;
} ;
after an sql query I get a list of NameAndCode NameAndCode **list
How can I add a new NameAndCode in the end of the list ?
Thanks for help
|
|
|
|
|
do you use any STL containers by any chance ?
also, why do you use a pointer of pointer if you have a simple "list" ?
see if you can use std::vector<NameAndCode> instead
|
|
|
|
|
Hi
STL seems more familar for me
but does it mean, it's impossible to add a structure at the end of a pointer of pointer ?
hope you see my pb
thx for help
|
|
|
|
|
there are several points I don't get.
first, you didn't answered my previous question : why do you use a pointer of pointer if you have a simple "list" ?
also, if you're familiar with STL, why not using it ?
and to answer your question (which I don't think is the good design to follow though), no it's impossible to litteraly "add a structure at the end of a pointer to pointer". for that, you'll have to allocate a new area with a size of "last array"+1, then copy every old pointers address into the new "list", and add the pointer to your new struct at the end of the list. at last, don't forget to delete the old array.
but I still think you'd better use a vector. the std::vector::push_back() function will do this transparently for you...
|
|
|
|
|
Can you tell us what "list" are you using?
-Saurabh
|
|
|
|
|
Hi
it's a pointer of pointer (NameAndCode **list)
|
|
|
|
|
That's not a list. It might be a pointer to an array of pointers. You need to see the documentation of whatever API that gives you that pointer to ponter.
|
|
|
|
|
Hello everyone,
Suppose I am executing in a function, how to print values for input parameters (binary memory value is ok) using WinDbg?
(suppose I am executing in a system API, and I do not know the exact input parameter name in source code?)
thanks in advance,
George
|
|
|
|
|
I am not sure I get your question right, but you are probably looking for OutputDebugString()[^].
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Sorry Rajesh!
My bad English. I am asking if we are executing inside a function, how to print the values for input parameters for this function -- under WinDbg tool?
regards,
George
|
|
|
|
|
I still am not getting your question correctly. I am presuming that you want to print the value of certain variables on a debug window during program execution. If I am right, then the API I linked you to will do the job.
TCHAR *szVal = _T("Hello world");
TCHAR szDbg[100];
int nVal = 100;
sprintf(szDbg, _T("szVal is [%s] nVal is [%d]"), szVal, nVal);
OutputDebugString(szDbg);
szVal = _T("Modified string");
nVal = 299;
sprintf(szDbg, _T("szVal is [%s] nVal is [%d]"), szVal, nVal);
OutputDebugString(szDbg);
The output must be visible in WinDbg window.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Thanks Rajesh,
I understand your code and what you are trying to solve. But I have not made myself understood again.
I think an example clarifies everything.
1. Suppose we are executing in function CoInitializeEx or any function which is not written by you but provided by system SDK, in which you do not know the code, only the function prototype;
2. You set a breakpoint to such system function, say CoInitializeEx, say using WinDbg tool;
3. The program debugs at CoInitializeEx, the you step into the function;
4. It is not your code which calls CoInitializeEx, but some other system functions with long call stack;
5. Now, since you are executing in function CoInitializeEx, you want to print out the input parameter value of function CoInitializeEx, how could you perform this job in WinDbg?
(you can not add code like you showed above, since you can modify code of CoInitializeEx or any sytem API function which calls CoInitializEx)
regards,
George
|
|
|
|
|
I see your concern now. I don't know an awful lot of this, but I think that you'll need to have your own mechanism which will intercept the calls at kernel level. I *might* be totally wrong, but this[^] could get you started.
George_George wrote: (you can not add code like you showed above, since you can modify code of CoInitializeEx or any sytem API function which calls CoInitializEx)
You probably wanted to say "cannot".
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Thanks Rajesh,
The article describes a comprehensive solution. But I think there should be a simple solution in debugging tool.
Here are my points,
1. We can enter into any assemly language code, and see the assembly language code and watch for register and memory values;
2. If I remember correctly, if the parameter of function is small enough, the input parameters' values are stored in some specific registers, and we can print them out?
3. I roughly remember the input parameter is put around frame base pointer and we could dump the memory address aronud the frame base pointer?
I think there should be some handful commands to do such work manually -- and my purpose is just to work on it manually.
But after some search, I can not find exact answers.
Any comments or replies to my further description? :-P
BTW: yes, I should say can not.
regards,
George
|
|
|
|
|
George_George wrote: The article describes a comprehensive solution. But I think there should be a simple solution in debugging tool.
If we do it on our own, I think that it is not going to be simple. But neither am I able to think of a debugging tool or mechanism which will let you do this on a "ready-made" basis.
George_George wrote: 2. If I remember correctly, if the parameter of function is small enough, the input parameters' values are stored in some specific registers, and we can print them out?
Even if the function parameter is small enough, the location where the parameters would be stored will be dependent on the calling convention used. If it is __stdcall (WINAPI), then the function parameters would be simply pushed onto the stack (not on the registers). There is a chance that the parameters (and yes, if being small enough) will be placed on registers if the calling convention is __fastcall. But there's no guarentee, as it might depend upon availability of registers at the time of call as well.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Hi Rajesh,
Basically I agree with you. Have you tried the dv command in WinDbg? Looks it works pretty good.
regards,
George
|
|
|
|
|
Do you want to print prototype of functions that you are using?
|
|
|
|
|
No, Hamid!
I want to print out input parameters' value. Any ideas?
regards,
George
|
|
|
|