|
I'm having a strange problem that I'm hoping someone can shed some light on.
In my COM server (.exe) i invoke the CString method Format. The problem is execution goes to the wrong override! Then it blows up.
Here is the initial command:
[ccode]
strDiag.Format(("iTotalUnused * 100) / g_ThreadsArray.GetSize() = %d",iTotalUnused * 100) / g_ThreadsArray.GetSize());
[/ccode]
When this executes I trace it into:
[ccode]
void AFX_CDECL CString::Format(UINT nFormatID, ...){ CString strFormat; VERIFY(strFormat.LoadString(nFormatID) != 0); va_list argList; va_start(argList, nFormatID); FormatV(strFormat, argList); va_end(argList);}
[/ccode]
instead of
[ccode]
// formatting (using FormatMessage style formatting)void AFX_CDECL CString::FormatMessage(LPCTSTR lpszFormat, ...){
[/ccode]
The actual blowup occurs in the LoadString function (which I don't want called in the first place0. It calls AfxGetResourceHandle which asserts afxCurrentResourceHandle is NULL.
I don't believe this is a bug in the CString class (i've used it too many times in this program.) I don't see anything wrong in my code, unless its environmental:
This control is windowless, it launches some number of worker threads and assigns tasks to them as requested. This code runs in one of the worker threads. The threads are created by instantiating a CWinThread derived object and invoiking its CreateThread method.
Thanks for the help,
Bill
|
|
|
|
|
The problem was caused by a typo,the parentheses are off.
Thanks for the help,
Bill
|
|
|
|
|
Seems like the evil comma operator strikes back
Well I guess all the problem reduces to having your first quotation mark displaced to the right of the second parenthesis, instead than to the left. As it stands, your expression evaluates as follows:
strDiag.Format(
(
"iTotalUnused * 100) / g_ThreadsArray.GetSize() = %d",
iTotalUnused * 100
) / g_ThreadsArray.GetSize()); ==> (operator , evaluates to its second argument)
strDiag.Format(
(
iTotalUnused * 100
) / g_ThreadsArray.GetSize()); ==>
strDiag.Format(iTotalUnused * 100 / g_ThreadsArray.GetSize()); and this of course selects the Format(UINT,...) overload.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have an byte array that contains 24 bit image. I would like to be able to scale it using StrechDIBits or something similar before I save the "compatible bitmap" to a bmp file. The problem is that if my screen is 16bit then my compatible DC is also 16 bits when I want it to be 24 and my image turns out distorted. Is there anyway to make a DC that is 24 bits even if the screen is at another BPP?
Please Help,
Clint Singer
PS. I thought I would try CreateDC but it seems that DEVMODE is only good for printers.
|
|
|
|
|
I don't know, but I *do* know if you create a DIBSection you can make it 24 bit and stretchblt it in a DC of any bpp. You could create one the same size and copy the bitmap data into it, then viola.
If you find a way to create a DC with a different bpp, I'd sure be interested to hear about it.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Do you have any examples as how to do this as I haven't been able to work well with a CreateDIBSection. I also assume one wouldn't use CreateCompatibleBitmap but rather define the Bitmap and all it's attributes to be 24bpp.
Thanks,
Clint
|
|
|
|
|
I would if www.wdj.com would come up. If you download the code for Sept 2000, I had an article there in which I create DIBSections and copy bitmaps onto them.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
How do you make a program that is split up into two parts? Like this
-----------------------------------------------
///////////|
///////////|
///////////|
///////////|
///////////|
///////////|
1//////////|2
-----------------------------------------------
How do I make that?
If I put one line of text in 1 that is there forever how can I make it open a .txt file in number 2?
Can someone help me?
http://pcverden.topcities.com
|
|
|
|
|
Is It Another Home Work???
Cheers....
Carlos Antollini.
|
|
|
|
|
Homework? No. I am making a program for Operation Flashpoint. It is a game that I am a really big fan of. Check this page if you doubt me
http://www.ofpeditingcenter.com or
http://pcverden.topcities.com
http://pcverden.topcities.com
|
|
|
|
|
I'm sorry, This happens a tipical question of a guy that wants that us make his homework.
Your question is serious. I was confused by your graphic...
You need to use Splits.
For this you need to use two views, look for splits into codeproject you will can find a couple of good articles talking about splits.
I'm Sorry again....
Best Regards...
Carlos Antollini.
|
|
|
|
|
Where can I find the split articles? I can't find them.
http://pcverden.topcities.com
|
|
|
|
|
Nevermind that last post, but I don't understand how to make them in Visual C++. Can anyone help? If you help can you make a step by step "tutorial"?
Also I am sorry for asking this. It is just that I am a complete rookie and my english isn't that great.
http://pcverden.topcities.com
|
|
|
|
|
You can find articles on Splitter Windows here. I think this is what you're looking for.
Also, I recommend buying a reference book if you're serious about programming. While not entirely necessary, books can be quite helpful. Click here for a list of useful reference books.
Good luck!
Jon Sagara
"Ninety percent of baseball is mental, the other half is physical." -- Yogi Bera
|
|
|
|
|
|
|
You don't have to apologize. I can understand that you would think that way. I would have thought that way if I was good at C++ and a 15 year old boy asked you to help him with a program.
Now the problem. I can't understand which one I should use. What would be the easiest one for me to use to make the diagram I want?
I am sorry if I am bugging you.
http://pcverden.topcities.com
|
|
|
|
|
Okey:
I think that this article is very good for start.
As soon as you understood that article, you will can continue with this Article.
At the finish you will be an expert in Splitter window.
I Hope to see an article about splitter window written by you in the future
Best Regards!!!
Carlos Antollini.
|
|
|
|
|
Ok. Thank you for your help. I will start reading it thourly now so I hope I understand it. If not I have this forum don't I.
Also you might see it, but at the moment I am doing way too much work on the OFP editing center so at the moment that option is not available, but I will keep it in mind.
Thank you again for your help.
http://pcverden.topcities.com
|
|
|
|
|
Sorry it is me again. I have still no idea how to make it. Can anyone help? I know that I shouldn't even do this (making the program), but I want to have just this one program to work and I can't. Plz help or I am getting the gun.
http://pcverden.topcities.com
|
|
|
|
|
You can use Project>Add To Project>Components And Controls>Visual C++ Components>Splitter Bar.
This option will add you a spliter in your project....
You need to Know that after that you will must to have two views, the left view and the right view.
Best Regars
Carlos Antollini.
|
|
|
|
|
I know you might what to kill me now, but I get the message:
Cannot find any classes derived from CFrameWnd. Your project must have a CFrameWnd-derived class on order to insert splitter bars.
What does that mean? Also what I am trying to make it in is MFC dialog based. Is that wrong?
http://pcverden.topcities.com
|
|
|
|
|
I need to say you that I'm sorry, that is the problem.
You need to do your application SDI or MDI, but you are working with a Dialog Application.
I think that the best you can make is build your own spplit for a dialog, I think that if you work with a couple of lines, the mouse, drawing and sizing some controls and a little of pattience you can emulate the spplit control over a Dialog....
For example.
You can work with a listbox and a Edit box, one a side of the other, if you do a meke control of the mouse you can resize the Controls and you will be emulating the spplit control....
Best Regards!!!
Carlos Antollini.
|
|
|
|
|
Thanks anyway.
I know this is a lot to ask from you or anyone, but can you make the program for me with some examples? I don't expect it, but it is worth a shot isn't it.
http://pcverden.topcities.com
|
|
|
|
|
Carlos Antollini wrote:
I Hope to see an article about splitter window written by you in the future
Poor Carlos !
Stll feeling sorry for having wrongly accused the guy of trying to do homework for free
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|