|
First, I want to be honest with you, I do not know what is going one. Therefore, what
I am going to suggest is probably wrong. One possibility is that your code makes heavy
use of dynamic memory allocation and that the heap is not in the best of shape. Therefore, later runs take more time.
Another possibility is that the times you are seeing are not quite right. That is, they are only accurate with a second. I am also wondering if it could be machine specific. Does it exhibit this behavior on more than one machine?
By the way, if it was my program, I would not worry about this variation in time. I hope this helps.
Bob
|
|
|
|
|
|
|
|
May i know why only constant static integral types are allowed to be initialised inside struct....
struct A
{
static int x=0;
};
the above code throws error...
but
struct A
{
const static int x=0;
};
works fine...
Please explain...
|
|
|
|
|
|
hi,everyone recent i was study how to use ffmpeg to make a media player,but now i miss a question that how to show a bitmap on dc.
CRect rt;
GetClientRect(&rt);
CClientDC dc(this);
CDC mem;
mem.CreateCompatibleDC(&dc);
CBitmap bp;
bp.CreateBitmap(width,height,1,24,lpbits);
mem.SelectObject(&bp);
dc.StretchBlt(0,0,rt.Width(),rt.Height(),&mem,0,0,width,height,SRCCOPY);
but the code not work
lpbits is pointer to the data of bitmap,"height" is the height of bitmap "width" is the width of bitmap
and the size of one pixel's color is three byte
lpbits height width 24 is the all data we know about this bitmap
can you help me to show the data on DC
|
|
|
|
|
may be lpbits has a bad data.
Try to write it to a file on disk(with .bmp), then open it with Paint, see if it can load it or not.
Hope this can help you
www.logicsims.ir
|
|
|
|
|
thanks,but when i try to write it to a bitmap file i find it is normal,some friends told me this bitmap is not a compatible bitmap .
|
|
|
|
|
try it with CImage class.
IStream* pImageStream;
CreateStreamOnHGlobal(NULL, TRUE, &pImageStream);
...
CImage image;
image.Load(pImageStream);
...
www.logicsims.ir
|
|
|
|
|
oh,i am sorry ,i was work on visual C++ 6.0 and is not have CImage calss
and never used gdi+ before, so can you give me some code
|
|
|
|
|
|
I advise you to use gdal library which is a powerful tool supporting almost all kinds of image formats! You at most spend 2 hour to get acquainted with this library! good luck!
|
|
|
|
|
Okay so long story short I'm doing some string manipulation in order to determine the file format the user would like to save an image as in DirectX. Simple enough.
bool saveToFile(const std::tstring &path)
{
size_t pos = path.find_last_of(_T('.'));
std::tstring extension = path.substr(pos + 1);
D3DXIMAGE_FILEFORMAT fmt;
if(extension == _T("bmp"))
{
fmt = D3DXIFF_BMP;
}
else if(extension == _T("png"))
{
fmt = D3DXIFF_PNG;
}
else if(extension == _T("tga"))
{
fmt = D3DXIFF_TGA;
}
else
{
return false;
}
return true;
}
Problem is, upon debugging this code (scratching my head at why no image is being saved!) I come to the realisation that the test for the extension being "bmp" falls through every time. I've checked the contents of extension and sure enough, it's "bmp" - so why is the test falling through?
I'm fairly certain it's got something to do with std::tstring, which is simply defined like so:
namespace std
{
typedef basic_string< TCHAR > tstring;
}
Any ideas?
|
|
|
|
|
The default comparison of a string class is case sensitive.
You will need to write a traits class for case insensitive comparison.
You might as well use _tcsicmp to do the case insensitive comparison.
And you should be using _splitpath_s to get to the file extension.
|
|
|
|
|
I don't need case-insensitive comparison - the contents of extension is literally the lower case string "bmp" - furthermore, shouldn't the default char_traits be fine? TCHAR is either defined as char or wchar_t , and std::string implements a char_traits specialisation for both of these.
|
|
|
|
|
Hi,
I want to display vertical text.
pDC->DrawText("SV",svRect,DT_TOP|DT_LEFT);
Here i want to display "SV" vertically.
Not Like
S
V
It should display as it as but vertically..We have to turn our head to read the text.
Pls help me
Anu
|
|
|
|
|
You must create a vertical font, and then use it in DrawText():
CFont fontVert;
fontVert.CreateFont(12,
0,
900,
0,
FW_NORMAL,
FALSE,
FALSE,
0,
ARABIC_CHARSET,
OUT_TT_PRECIS,
CLIP_DEFAULT_PRECIS,
CLEARTYPE_QUALITY,
DEFAULT_PITCH | FF_ROMAN,
_T("Tahoma"));
www.logicsims.ir
|
|
|
|
|
Hello everybody !
We often see some Window Suspended Animation,then we can't click any Sub-Window,example the button,menu and more.
If I know the window handle ,When I try to use function PostMessage to send "WM_NULL" to the window,it doesn't Suspended Animation.Why is this so?
How can I send window message to suspend other window ?
|
|
|
|
|
Just hazarding a guess:
The WM_NULL message performs no operation. An application sends the WM_NULL message if it wants to post a message that the recipient window will ignore.
WM_NULL[^]
|
|
|
|
|
I have a web browser control inside MFC application
In case of the web server is down I need to show error message different then the usual 404 default error.
In order to do it I use put_innerHTML method, the problem is that in the control i see my content but right click and view source I see the original HTML text and I get javascript errors like 'goBackContainet is undefined'
Any ideas?
Also i want to disable javascript error's messages on this web control, independence on what was configure in the IE settings.
Thanks for any help.
|
|
|
|
|
I am trying to use libraries provided by IBM to write a program that controls the front end client of an AS/400 system. My problem is not with the code itself; I have tried various sample programs and they all do the same thing.
Using Microsoft Visual C++ 2008 Express, I get the error mentioned above in the title:
1>------ Build started: Project: testAS400, Configuration: Debug Win32 ------
1>Linking...
1> Creating library C:\Documents and Settings\seniorda\My Documents\Visual Studio 2008\Projects\testAS400\Debug\testAS400.lib and object C:\Documents and Settings\seniorda\My Documents\Visual Studio 2008\Projects\testAS400\Debug\testAS400.exp
1>ECLSAMPS.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ECLKeyNotify::NotifyError(class ECLPS *,class ECLErr)" (?NotifyError@ECLKeyNotify@@UAEXPAVECLPS@@VECLErr@@@Z)
1>ECLSAMPS.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ECLKeyNotify::NotifyStop(class ECLPS *,int)" (?NotifyStop@ECLKeyNotify@@UAEXPAVECLPS@@H@Z)
.
.
.
C:\Documents and Settings\seniorda\My Documents\Visual Studio 2008\Projects\testAS400\Debug\testAS400.exe : fatal error LNK1120: 168 unresolved externals
I have made sure I am using the /MT option, as the documentation says I should. I made sure the library was included in the linker path. I still get the same errors.
The IBM site was supposed to include .MDB files from MSVC 2003, but there are no .MDB files at all, just a makefile from IBM Visualage C++ 2003, which my compiler can not use.
Any ideas would be useful... all the library files I can find are old and I can't find any newer library files on IBM's site. Without working libraries, my program is useless, unless I can figure out Plan B, which is to control via Active X, which is illuded to in IBM's text but not explained or recommended.
Thank you.
-Dan
|
|
|
|
|
Dan Senior wrote: I made sure the library was included in the linker path
ok, but in your project you still need to tell it to link <whatever>.lib - under MSVC6 you would go Project -> Settings => [Link Tab] and add the required .lib to the Object/Library modules box
'Making Sure the library was included in the linker path' just ensures the linker knows where to find <whatever>.lib so it CAN link it ..
ok, there could be another issue here, they might be specifying what library/ies to link using a #pragma option. Best is to go through the docco and see what libraries they say, and use (one method or the other) and add them to the link - you might need to search the headers to see if they are using #pragma to link required libraries in and check the list of pragmas against the list they say you should have (from memory, the IBM docco is usually pretty good) ... Its been a long time since Ive used AS/400 client libs, I dont even have an install for them anymore
'g'
|
|
|
|
|
Thank you...
The wording in Express 2008 is "include directory", but I tried putting a filename there and it took it. Only thing is now I am basically down to one strange error stating it can't find /files/ibm/client.obj. There is no path on my computer called /files/ibm/, and there is no file called client.obj anywhere. So I will have to see if IBM has a forum where I can ask more specifically what I need to do, or if they have a newer library (since these files are quite old).
-Dan
|
|
|
|
|
as long as you have a support contract with IBM, these libraries should be easy to get updated ..
(if you dont then you may be 'stuck')
'g'
|
|
|
|