|
Okay. Thanks everyone.
Kuphryn
|
|
|
|
|
I wanted to display 10 bitmaps using CImageList
but why all the bitmaps were black
1.first ,I created a project "Cards",Imported 1,2,...,10
2.and I added variable in CCardsView
CImageList* m_pImageList
and the function
BOOL CCardsView::AddBitmap(UINT nResourceID)
{
CBitmap m_bmp;
if(m_bmp.LoadBitmap(nResourceID))
{
m_pImageList->Add(&m_bmp,RGB(256,256,256));
m_bmp.DeleteObject();
return TRUE;
}
return FALSE;
}
3.CCardsView::CCardsView()
{
// TODO: add construction code here
m_pImageList=new CImageList;
m_pImageList->Create(71,96,ILC_COLORDDB,256,1);
for(int i=1;i<11;i++)
{
AddBitmap(i);
}
}
4.CCardsView::~CCardsView()
{
if(m_pImageList!=NULL)
{
delete m_pImageList;
}
}
5.void CCardsView::OnDraw(CDC* pDC)
{
CCardsDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CPoint pos(0,0);
// m_pImageList->SetBkColor(CLR_NONE);
// m_pImageList->SetOverlayImage(0,1);
for(int i=0;i<10;i++)
{
m_pImageList->Draw(pDC,i,pos,ILD_NORMAL);
pos.x+=50;
}
}
Why?
--oly--
|
|
|
|
|
<quote>
m_pImageList->Add(&m_bmp,RGB(256,256,256));
This might be a problem. Try to change it to RGB(0,0,0),
|
|
|
|
|
I have tryed
but it did not work
|
|
|
|
|
<br />
BOOL CCardsView::AddBitmap(UINT nResourceID)<br />
the above method take in ResourceID!! but you said
for(int i =1; i<11; i++)
AddBitmap(i)
check whether i is the appropriate resource name!!!!
|
|
|
|
|
yeah
I added 10 bitmaps with id 1 to 10
what is the matter?
|
|
|
|
|
if u want i can have look at your code!!! Send it to my email.!!
|
|
|
|
|
but I have wrote it down in my question
pls help me
It has puzzled me for 3 days
and no one could give me a correct answer
--oly--
|
|
|
|
|
You must pass the resource ID to AddBitmap , not the index of the bitmap. The resource ID will be found in resource.h .
Gary R. Wheeler
|
|
|
|
|
Hi
I'd like to get the user's input from the console, if the user put in some text, this information will be put in a buffer, if the user type in nothing in and press enter then the program is terminated. But how do i know if the user has type in something???
i've attempted to play around with this, first with cin.getline, cin.get ...and finally come up with gets(), however it still seem has not done the job.
this is the code that i've attempted
<br />
char input[MAX_PATH];<br />
char *pInput = input;<br />
<br />
cout << "Enter the text " << endl;
<br />
char delimeter =(char)gets(input);
<br />
while( delimeter != '\r' )<br />
{<br />
<br />
<br />
cout << "Enter the text " << endl;<br />
delimeter =(char)gets(input);<br />
}<br />
<br />
Any ideas, helps or suggestions are highly appreciated!!!
Regard,
|
|
|
|
|
getchar maybe what you need instead of gets .
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
Try something like this:
char input[MAX_PATH];
do {
cout << "Enter the text " << endl;
gets(input);
if (strlen(input) != 0) {
}
} while (strlen(input) != 0);
Gary R. Wheeler
|
|
|
|
|
You may have problems mixing cin /cout and gets /printf . For console hacks, I use gets /printf .
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I created a Win32 Console Application with MFC support. Everything was working fine until I decided to add ADOX. I have the code for access database interaction in a separate static library from the console application itself. I can build the library fine, but when I try to link it in with the console app, I get several linker errors that look something like this:
\PATH_TO_VC98\comutil.h(562) : error C2668 : 'memcpy' : ambiguous call to overloaded function
From what I understand, when you get this kind of error, it is from a naming collision of some sort. The only problem is that I haven't written my own 'memcpy'. I can only assume that the compiler sees two different versions on the system somewhere. The really strange part about the whole things is that the application builds fine when I am using the exact same code on a button handler in a GUI. I do have the Platform SDK installed (not sure if that matters). Anyone heard of this kind of thing? Please help!!!
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
In a listbox I want to handle the on LButtonDown so that I can quickly select items in a listbox. The default is the curent selection is only updated on LButtonUp. Any ideas?
|
|
|
|
|
I'm so use to a lot of quirks coming from ClassWizard, I'm beginning to wonder whether it's normal.
For example, I instructed ClassWizard to add a new class for me, chose "New" and continued to fill in the class name and its derived class name (etc.). Then I click OK and CW produced a message saying it couldn't open the file I had just asked it to add. I clicked OK again and it came back with a message about how it found remants of the class I had just asked it to add (that it earlier said it couldn't).
I checked the workspace, checked Explorer and even brought the newly created file into the Source Editor and made modifications to it (etc.), compiled and linked the program. Everything went well, 0 errors; 0 warnings.
Still, CW did not have the new class included in its list.
I deleted the ".ncb", the ".opt" (and some other files), compiled and linked the program again, and still the new class was not included in CW.
Finally, I deleted the ".clw" file, compiled and linked the program again, but this time CW asked if I wanted to create a new CW file. I clicked OK, and behold! the new CW file this time included the new class I had a few moments ago created.
Is this just another one of CW quirks that I'll have to live with, or did I do something wrong it didn't like?
Thanks.
William
|
|
|
|
|
do you have any anti-virus apps running? i've seen this kind of thing with Norton. it makes life exciting.
-c
Green's Law of Debate:
Anything is possible if you don't know what you're talking about.
|
|
|
|
|
Yes, I do have anti-virus software running continuously!
My machine is heavily equiped with anti-virus software, including Norton's enterprise edition.
Thanks for the tip.    I appreciate it.
William
|
|
|
|
|
According to MSDN, TransparentBlit is not supported in 95 (or i mis-read it ).
Anyone know of a way to support this under 95? ie updates, dll etc
Thanks
Robert Cannell
|
|
|
|
|
Not that I am aware of, you will need to implement your own version. As far as I can remember though, there is a sample implementation in MSDN that shows how you can implement this function for windows 95 and Windows NT 4.0.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thanks, I will have a look.
|
|
|
|
|
Hi,
I'm new using CWinThread, what I'm doing is to show a progress bar window, mean while the GUI of the main window is being updated.
All goes fine, but... when I have to finish the CWinThread I do it in this way:
pThread->m_pMainWnd->PostMessage(WM_CLOSE,0,0);
pThread->PostThreadMessage(WM_QUIT, 0, 0);
WaitForSingleObject(pThread->m_hThread, INFINITE);
To have this working, I have to set in the InitInstance of the CWinThread class, this flag to false:
m_bAutoDelete = FALSE;
Do you know why ?, Or what I'm doing wrong ?
Thanks in advance, Greetings
Braulio
|
|
|
|
|
Hola Braulio,
m_bAutoDelete=TRUE instructs the CWindThread object to delete itself upon exiting; that means that all member data of the thread (including m_hTread ) gets deleted, so it would be wrong to refer to it in a call to WaitForSingleObject . Having m_bAutoDelete==FALSE , the object remains in memory after the thread exits for you to inspect its data as you please. Remember that in this case you have the responsibility of disposing of the thread when no longer needed with delete pThread .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hola Joaquin !!, Qué tal ?
Yes, you are right, thanks for the info. Mmmm... I've seen there is not very clear info and samples about CWinThread in MSDN or here in Codeproject, I'm thinking about making a new article, with the Progress Bar Dialog stuff ( in a CWinThread), do you think it's a good idea ? Is there some article or thing about CWinthread that is interesting ?.
Gracias de nuevo Joaquin !, Un saludo
Braulio
|
|
|
|
|
There's a couple of articles in the threads section of CP dealing with worker and UI threads; I haven't looked at them in detail, so maybe you've got something new to add Besides, the progress bar stuff can be useful, and publishing in CP is a lot of fun. Regards.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|