|
|
I have been trying to place a background image on a CListCtrl using the SetBkImage(..) function, but have run into a problem. If I use a URL for the image on my local hard drive, then I am able to display the image with no problem, however, If I try to use a bitmap loaded from a resource ( via the CBitmap HBITMAP operator) then I am unable to get the CListCtrl to display the image. For example, the following code works fine:
m_ctrlList.SetBkImage(TEXT("file://c:\\temp\\image.bmp"));
But code such as :
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BITMAP1);
m_ctrlList.SetBkImage((HBITMAP)bitmap);
Will not work at all. Am I simply missing something here, or has anyone else experienced this problem as well. Any information is greatly appreciated!!
|
|
|
|
|
Look at the docs for the LVBKIMAGE struct and you'll see that the hbm member is "Not currently used" which I infer to mean that supplying an HBITMAP for the background isn't supported yet.
|
|
|
|
|
The includes should read
#include <stdio.h>
#include <vector>
sorry about that
|
|
|
|
|
How on earth does one get stuff to compile with VC++ with the language extensions turned off ( compiler switch /Za)?
The following simple program won't compile and generates 102 error - almost all relating to the utility and xstring headers
#include <stdio.h>
#include <vector>
int main(int argc, char* argv[])
{
std::vector<int> m;
printf("Hello World!\n");
return 0;
}
I am running Win2000 pro, VC++ 6.0 (no VC service packs)
Any help will be greatly appreciated !!
|
|
|
|
|
You don't. It cannot be done.
|
|
|
|
|
I'm using GetCapture() to notice when the mouse leaves a CWnd-area. The problem is that this approach seems to block the F-Key events: While the mouse is over such a window, no F-Key events are not delievered. It's MFC...
|
|
|
|
|
There is a library to read ICQ 99a/99b/2000a/2000b database in www.icqroaming.com.
It is very interesting and useful.
|
|
|
|
|
|
It is an ATL component that fire events. I have asked their vb and vc++ examples on how to use the component.
|
|
|
|
|
Hi,
I am working on a MFC app that basically draws its own controls etc on a view that is maximized.
I am having quite some trouble, it seems, with device contexts. I have drawing code in lots of functions all over the place, e.g. when a mouse click comes in, the OnLButtonUp calls a function in my code that does drawing, and sometimes things do not appear on the screen or appear delayed, weird effect.
I am sure I am making a big mistake drawing things directly in reaction to OnLButtonUp() but I have no clue how to do it better.
If someone could give me a set of just the basic pointers how to organize a program like that, I'd be very grateful. The main problem I am having is drawing my GUI elements (Text, Lines, Rectangles).
TIA
Lutz
|
|
|
|
|
Would you be able to use one of the flicker-free drawing classes (here at CP) instead? That will significantly speed up screen updates, since the screen DC only gets written to once; everything else happens in memory.
|
|
|
|
|
You are right, you shouldn't be drawing in response to any event other than a WM_PAINT message.
Generally speaking, you should draw only in the OnDraw() or OnPaint() methods. If it's a view, the OnDraw() method is provided for you. If it's a dialog, then you need to add a WM_PAINT handler and then draw in the OnPaint() method provided by the handler (and the DC that it provides).
Generally speaking, when you click something and want to update, then you invalidate your window (if possible, only the portions of the window you need to update).
The Scribble tutorial that comes with VC++ should be enough to illustrate this for you. Use the Totorials Luke!
|
|
|
|
|
I recvently split my program into two modules (to save computer memory for unneeded components), but this the code in this dll file for some reason can't load Bitmap resource, the command simply doesn't work.
HELP
Joel
|
|
|
|
|
Hi Joel,
We need details if you want to be helped...
Is the bitmap resource in the same DLL or in the EXE?
What function are you using to load the bitmap?
Paolo.
|
|
|
|
|
Hi,
I think maybe I can help you..
But, I needs more information about your problem..
Could you reply to this thead with detail description?
Regardz
-Ryan
|
|
|
|
|
You need to call AfxSetResourceHandle() and pass the HMODULE
of the dll that has the resources in it, before you attempt
to get any data from the resources in the DLL.
Remember to set the resource handle back to the original
afterwards - so that you can load resources from the original .exe file (the default).
Stephen
|
|
|
|
|
I need to use the BROWSE... button to get just the location path.
Should I user CFileDialog for this?
What parameters do I user to get just the location path?
Thank you.
|
|
|
|
|
I have been meaning to write an article on this. I have some sample code that uses the browse button, and a checkbox to switch between the Browse for folder, and browse for file dialogs.
If you like, I can email that to you later on tonight. (As it is at home, and I'm currently at work). Let me know.
Frank
|
|
|
|
|
You use the SHBrowseForFolder() API. If you need help using it, there are some folder-browsing articles here at CodeProject you can read.
|
|
|
|
|
Hi,
How do I make a FormView window not sizeable, just fixed?
Thanks,
Pedro.
|
|
|
|
|
I'm assuming that you mean that you don't want the MainFrame window sizable. If that's correct, you can check out this page:
http://support.microsoft.com/support/kb/articles/Q133/2/56.asp
Hope that helps,
Frank
|
|
|
|
|
Hi
I have client-server functionlaity set up
I can send normal text strings properly,
BUT
I CANNOT send a class thgough the socket! it is a pointer to a class, and when i say... sizeof(*myclass) it gives 82 which is smaller than an IP packet (i think).
It comes through as gibberish... How can I fix this?
Why does it work for strings, but not custom classes??
Thanks!
|
|
|
|
|
Noite that when I send it, it is of the form:
mp_sConnectSocket->Send(mp_pdu, sizeof(*mp_pdu))
where
mp_sConnectSocket is the connecting socket
mp_pdu a pointer to the class Im trying to send
sizeof(*mp_pdu) gives the size of the object being pointed to
|
|
|
|
|
I have an app where I have decided to use a wave file. I call the wave with...
sndPlaySound("WaveName.wav", SND_SYNC);
I have included the Windows Multimedia Component in
StaAfx.h...
#include MMSystem.h
#pragma comment(lib, "winmm.lib")
Problem: Release build!
The release Build only finds the wav file if it is in the same folder. What I would like to do is make the wave a part of the app just like any other resource, instead of a separate file. I have experimented with the .rc and .rc2 files to no avail. I know it can be done (for example the SpeakN sample app in VC++6.0). Perhaps I'm going about it the wrong way. Any help or suggestions would be appreciated.
|
|
|
|