|
Can anybody tell me why copying an unlocked block of global memory using memcpy() would cause the call stack to change. The code looked like this:
<br />
<br />
UINT size=GlobalSize(hGlobal);<br />
<br />
LPBYTE pBuffer=new BYTE[size];
<br />
memcpy(pBuffer,hGlobal,size);
<br />
I realised the problem was caused by not using GlobalLock() to get the actual address of the memory to copy but I have no idea why using the hGlobal handle as the source address would cause the call stack to change!
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
Hello!
GlobalAlloc() returns a "handle to the newly allocated memory object", and this does not mean pointer to allocated memory. So I suspect, that this handle is a pointer to structure, in which one of the field is pointer to memory (only suspission).
But: it did not overwrite my stack:
<br />
HANDLE hGlobal = GlobalAlloc( GMEM_ZEROINIT, 2048);<br />
UINT size=GlobalSize(hGlobal);<br />
LPBYTE pBuffer=new BYTE[size];
memcpy(pBuffer,hGlobal,size);
If you want to use memory pointer, take a look at the flag GMEM_FIXED in GlobalAlloc()
|
|
|
|
|
how did you get MDI windows to go out of status bar like in mIRC ?
http://flat.hypermart.net/mIRCstatusbar.gif
what is name of this class ?? extended status bar ?
is there a class or source code somewhere on this site or on any MFC sites.
|
|
|
|
|
ay ay ayy !!!!
that's not a status bar !!! that's a dynamic window.
TOXCCT alias Nicolas C.
|
|
|
|
|
ok thank you.. I am not even sure what name for it.
do you have source code or class for it ?
|
|
|
|
|
hemm, no, not at all.
what did you want it for exactly .??
TOXCCT alias Nicolas C.
|
|
|
|
|
I think it's called taskbar.
You can create it as a DialogBar initially docked to the bottom of the main window. And prohibit it from moving.
But I wonder, that there wouldn't be any sample code, which emulates taskbars. If you really don't find anything, I'll probably write one (and publish it on the CodeProject )
Robert-Antonio
"Love without sex is like a fish without antlers"
|
|
|
|
|
yea similar to taskbar......
I still do not find anything about it
go ahead and write project.
|
|
|
|
|
actually, in the case of mIRC, that taskBar is not even definitively docked, you can move it if you want !!!
but i'm waiting for your article Mr Robert A. T. Kaldy
TOXCCT alias Nicolas C.
|
|
|
|
|
im trying to make irc client.
i guess there none of articles or info on this thing.
|
|
|
|
|
When I design
CDialog , its size shown in editor in dialog units,
but I need to set it in pixels - precisely.
How to do it ?
Thanks
|
|
|
|
|
You cannot set the real size of a dialog in the resource editor. The units you see are
in Dialog Units. These are translated into real coordinates at run time by the CreateDialogXXXX
functions.
The translation depends on the font of the dialog, and various OS things (Large / Small Fonts,
accessibility settings etc).
To translate between dlg and reall units, look at ::MapDialogRect.
If you have to be pixel accurate, you need to write some code in your OnInitDialog routine.
You'll probably want the following functions...
GetClientRect, GetWindowRect, ClientToScreen, ScreenToClient, SetWindowPos, etc.
Iain.
|
|
|
|
|
hi,
i am trying to retrieve the text,ie the address from the address bar of the explorer. i have the handle to that edit box,how can i retrieve the text. i have tried GetWindowText, various options of SendMessage.
Thank You
|
|
|
|
|
Hello!
Spy retrieves correctly.
Maybe this is UNICODE window?
|
|
|
|
|
hi,
i know that. but i wanted to retrieve from my Win32 program.there are other edit boxes also there,so hw to seperate that from other edit boxes......
Thank You
|
|
|
|
|
Hello!
Check with Spy. Maybe this edit box has some unique ID?
|
|
|
|
|
Hi All,
After all the datas are insert to the MAP, is it is possible to re-sort the MAP using some other key ??
With Best Regards,
A.Ilamparithi
|
|
|
|
|
I have a std::list of objects and want to capture the object by reference by storing its address in a pointer to use it in other code. I am having problems pulling the object's address from the iterator. The sample code below shows what I am doing.
typedef list<MyObject> ObjList;
int main()
{
ObjList obList;
MyObject* pObj = 0;
for(int i = 0; i < 10; ++i)
{
pObj = new MyObject(i);
obList.push_back(*pObj);
}
pObj = 0;
ObjList::iterator it = obList.begin();
for(int i = 0; i < 3; ++i)
++it;
MyObject *pMy3rdObject = it; <<<<<---C2440 ERROR HERE
[work done with pMy3rdObject here]
return 0;
}
When I compile the code above, I get the following error:
error C2440: 'initializing' : cannot convert from 'std::allocator<_Ty>::value_type' to 'MyObject *'
with
[
_Ty=MyObject
]
Any ideas of how to successfully and safely do this?
Thanks in advance!
Happy Programming!
WWW::CodeProject::BNEACETP
|
|
|
|
|
It figures... I figure out how to do this after posting it. Anyway, maybe someone else may be wondering how to do this, so here's how I did it.
This was what I had:
MyObject *pMy3rdObject = it; <<<<<---C2440 ERROR HERE
This is how I fixed it:
MyObject *pMy3rdObject = &(*it); <<<<<---COMPILES AND WORKS!
Happy Programming!
WWW::CodeProject::BNEACETP
|
|
|
|
|
I am looking for a good Graphical User Interface tool that can interface with Visual C++ or Delphi(sorry).
Does anyone know any web sites or products which I can look at.
The GUI tool must be able to accept and process real-time data in short.
Thanks
LOUIS
|
|
|
|
|
Hi,
I wanted to develop a generic component to download files using URLDownloadToFile, just to make it even easier for VC++ and VBasic clients.
The problem that I found is that... using IBindStatusCallback it's more or less easy to handle in C++, but I think handle this in Visual Basic it's a bit complicated ( for Vb Programmers :P). I thought about pass the handle of the window and one Message ID to my component and make a post message to that window... but it's a bit crappy and again Visual Basic guys won't know how to do it... use connection points for this case it's a good idea ? or again Visual Basic guys...
thanks in advance
Braulio
|
|
|
|
|
Well, VB programmers always have trouble with even adding two numbers.
But VB maps connection points as events, so VBers can declare the variable WithEvents and handle the event, just like a button click.
Any average VBer will be able to accomplish this.
Trying to make bits uncopyable is like trying to make water not wet.
-- Bruce Schneier
By the way, dog_spawn isn't a nickname - it is my name with an underscore instead of a space. -- dog_spawn
|
|
|
|
|
Hi Daniel,
I have seen that if you develop an ActiveX control and place it with the designer you get for free the connection point in your "Event" combo, ... but how to do that if the COM component has no inteface at all ?
Thanks for your info
Braulio
|
|
|
|
|
I want to create DIBs using CreateDIBSection.
Are there any known (memory) size limitations if I use this function (maybe for some older OS like Windows 95/98/ME)?
When I use CreateCompatibleBitmap to create DIBs do I have the same 16 MB limitation if I use Window 95/98/ME like if I create DDBs with CreateCompatibleBitmap?
Has anyone some experience in creating large bitmaps (> 6000x6000 pixel (32bit))? What are good solutions to create and handle such large bitmaps in memory?
Would be nice if we can discuss this subject here, because I think it is very interesting and error-prone subject.
|
|
|
|
|
How can I displaying 2 dialogs in the same window ??
Are there any frame that can hold dialog ??
Or can one dialog hold more then one other dialog ??
Thank you very much!!
|
|
|
|