|
I have been using safe string library for a while, but one thing I find missing is I dont see a safe version of strstr which takes a length parameter(preferable for both the parameters). Is it not there or I did not look enough to find it? Thanks!
|
|
|
|
|
The safe versions are intended to avoid buffer overruns. Since strstr doesn't modify any of the strings it receives, there's actually no need for a safe version.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I thought safe strings are also to work on non-null-terminating strings.
So how do you do strstr on a non-null-terminating string?
I found strnstr in GNU lib, I am using that for now. I wish it was available in C library itself.
|
|
|
|
|
Hai ,
I created the dialog based dll file.Then i created the SDI application using Mfc wizard and i loaded the dll into this application.When i call the dll file from the sdi application,appcoer.cpp,app3d.cpp,wincore.cpp(line 884,883) debug assertion appear.After that the dialog application loaded when i gave ignore .How i solved this problem.Please Help me.
Thanks,
SUNSEN
|
|
|
|
|
I know this is pathetic, but I really need help.
I have a large CBitmap. I need to create a smaller CBitmap that is a copy of a portion of tha larger one.
I have looked in all my books, looked all over the web, and have not found anything that works.
So given bitmap1 and bitmap2 and a rectanglular area of bitmap1, I want to copy that area of bitmap1 to bitmap2. Why is this hard to do? I figure it must be hard, because none of the code I found that claimed to do this, actually did it!
|
|
|
|
|
Sea the BitBlt() function.
SkyWalker
|
|
|
|
|
int dst_width = <width>
int dst_height = <height>
CBitmap src_bitmap;
CBitmap dst_bitmap;
BITMAP src_info;
src_bitmap.GetBitmap(&src_info);
CDC src_DC,dst_DC,screen_DC;
screen_DC.Attach(::GetDC(NULL));
dst_bitmap.CreateCompatibleBitmap(&screen_DC,dst_width,dst_height);
src_DC.CreateCompatibleDC(NULL);
dst_DC.CreateCompatibleDC(NULL);
dst_DC.SetStretchBltMode(HALFTONE);
CBitmap *src_previous = src_DC.SelectObject(&src_bitmap);
CBitmap *dst_previous = dst_DC.SelectObject(&dst_bitmap);
dst_DC.StretchBlt(0,0,dst_width,dst_height,
&src_DC,0,0,src_info.bmWidth,src_info.bmHeight,
SRCCOPY);
src_DC.SelectObject(src_previous);
dst_DC.SelectObject(dst_previous);
I just typed this in, so it may have minor problems, but this should give you an idea of how to go about it.
Software Zen: delete this;
|
|
|
|
|
Here is the function I settled on. Unfortunately, I copied most of the code from another source on the internet, and lost my link to it. Therefore I cannot properly cite that source. If you recognize the code as yours, then please accept my thanks for it.
void CLabeledBitmap::CopyBitmapSection(CBitmap &bmpSrc, CBitmap &bmpDest, CRect &rectSection, CDC* pDC)
{
int nWidth = rectSection.Width();
int nHeight = rectSection.Height();
CDC destDC, srcDC;
CBitmap *pOldBmp = NULL;
CBitmap *pOldSrcBmp = NULL;
destDC.CreateCompatibleDC(pDC);
srcDC.CreateCompatibleDC(pDC);
bmpDest.DeleteObject();
bmpDest.CreateCompatibleBitmap(pDC, nWidth, nHeight);
pOldSrcBmp = srcDC.SelectObject(&bmpSrc);
pOldBmp = destDC.SelectObject(&bmpDest);
destDC.StretchBlt(0, 0, nWidth, nHeight, &srcDC, rectSection.left, rectSection.top,
rectSection.Width(), rectSection.Height(), SRCCOPY);
bmpDest.SetBitmapDimension(nWidth, nHeight);
destDC.SelectObject(pOldBmp);
srcDC.SelectObject(pOldSrcBmp);
}
-- modified at 1:38 Wednesday 5th October, 2005
|
|
|
|
|
Hi,
Can u suggest some links, related with info on packets sent by the yahoo messenger for its activities like OM, comference, File Transfer etc.
|
|
|
|
|
|
Hi,
I gone through this site, and is a nice one.But this site represent a packet sniffer tool.
I think I did not mention much in my query posted earlier.
what I needed is that after catching the packet, I want some info about the contents in those packet.As I am getting prob. in file transfer(for latest version 7) only, as some of field are not clear.
Can u suggest some more links.
Regs
-- modified at 1:34 Monday 3rd October, 2005
|
|
|
|
|
Hi
Can anybody help me. i am using ADO for the first time. i got examples on that. but they are using other than Oracle databse. i have to connect to Oracle using ADO and use stored procedures. I dont know how to use ConnectionString to connect to Oracle. Plz help me in this regard.
bye
|
|
|
|
|
snprani wrote:
I dont know how to use ConnectionString to connect to Oracle. Plz help me in this regard.
here is the list :-
http://www.codeproject.com/database/connectionstrings.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
hi
i used <new> in my dll and when loasing it i encountered some problems.
am i able to allocate memory in a dll??
|
|
|
|
|
Can you briefly explain how you are allocating the memory in the dll?
-prakash
|
|
|
|
|
it in my dll
USHORT * myfunc()
{
USHORT *pt = new USHORT[length];
return pt;
}
and i want to return pt to the application which uses the dll.
its in my app
USHORT *xx = myfunc();
|
|
|
|
|
There is nothing wrong with the allocation. What problem are you experiencing?
John
|
|
|
|
|
Be sure that the memory allocated in the dll is freed by the dll and not by the application ! If you try to delete this pointer inside your application, it will crash.
|
|
|
|
|
Hi,
I am busting my brain trying to get my parent dialog to have topmost priority over a child dialog. I have a fullscreen child dialog that I want to sit behind the parent dlg but the parent is continuously behind it. I have used MSDN and tried SetWindowPos.... however, in MSDN library there are 7 parameters for this function.... When I use SetWindowPos, I only have 6?
My SetWindowPos();
BOOL SetWindowPos(const *CWnd pWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags);
MSDN SetWindowPos();
BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags);
Its starting to really confuse me.... if anyone can help, it would be greatly appreciated.
Thanks
Ashman
I'm normally not a praying man, but if you're up there, please save me Superman.
|
|
|
|
|
BOOL SetWindowPos(const *CWnd pWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags) is a methode of CWnd class, so when calling it, it positions the object that is an instance of that class.
::SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags) needs a parameter to identify the window to be positioned (hWnd )
SkyWalker
|
|
|
|
|
Mircea Puiu wrote:
SkyWalker
SkyWalker getting very Fast ....
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
SkyWalker
|
|
|
|
|
Ashman wrote:
BOOL SetWindowPos(const *CWnd pWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags);
this MFC based version of SetWindowPos.. here the Detail of current Window Handle is hidden from user ... oops concept ..
Ashman wrote:
BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags);
this api version of SetWindowPos function.. now to access this function in mfc based application you have to use '::' scope resolution operator...
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi all..
I want to perform copy paste operations on the items of the tree Ctrl.Can any one provide me with the code.
|
|
|
|
|
|