|
Thanks for your reply, actually I didn't know that it won't work except for applications with a message bump, and that it probably won't for console applications. That's a valuable piece of information I didn't actually know
Regarding the library licensing, I only used it for the college project - not a commercial application - so I didn't need to buy it.
--
Wessam Fathi
|
|
|
|
|
|
The text will be displayed in the center of rectangleArea. So, how is this rectangle initialized ?
|
|
|
|
|
The problem is when you calculate the rectangleArea by DrawText and DT_CALCRECT the right member of the rectangleArea will be reduced to the width of the text.
Then you show it using the same rectangleArea, how will it come to centre? Think...
- NS -
|
|
|
|
|
:-DI write code such as following in Visual C++ 6.0:
#include "stdafx.h"
int main(int argc, char* argv[])
{
char c0;
double d0;
char c1;
char c2;
printf("%p\n%p\n%p\n%p\n",&c0,&d0,&c1,&c2);
return 0;
}
In Debug build mode, output:
0012FF7C
0012FF6C
0012FF78
0012FF74
Why VC6 put variable d0 on the stack top?
Your sincerely
REMY
|
|
|
|
|
Probably because it is a double.
~RaGE();
|
|
|
|
|
This is probably because the VC++ compiler is trying to optimize memory allocations, by automatically choosing the ordering and layout of variables in memory in order to minimize memory usage.
--
Wessam Fathi
|
|
|
|
|
I migrated my project to VC2005 and found a pretty strange problem. The code tries to dynamic cast an object and the result is NULL even the objet type is valid. E.g.
I have a following code:
class A;<br />
<br />
A* ptr = new A;<br />
...<br />
A* pTest = dynamic_cast<A*>(ptr);
pTest is NULL but in the debugger I can see that "ptr" is A.
The project has RTTI enabled.
Any idea what could be the problem?
Thanks, Abyss
|
|
|
|
|
Try this: pTest = ptr; - it might work just fine for you. Good luck!
|
|
|
|
|
try this
A* pTest = dynamic_cast<a*>(ptr);
but in ur case it is not required as suggested by Mihai Moga
never say die
-- modified at 7:37 Wednesday 12th April, 2006
|
|
|
|
|
sunit5 wrote: A* pTest = dynamic_cast(ptr);
what is your suggestion ?
exactly what he wrote...
|
|
|
|
|
This is my suggestion
A* pTest = dynamic_cast<A*>(ptr);
i didnot put <> (as in formatting )so <A*> was not visible
never say die
-- modified at 7:40 Wednesday 12th April, 2006
|
|
|
|
|
Finally, I found the problem. Well I simplified my problem so much. In my case the problem is somewhere else:
A* ptr = new A;
Then I incorrectly static casted the pointer to a C object:
C* pObj = static_cast<C*>(ptr);
because of this the dynamic cast failed in VC8, however in VC7 it works fine. pTest will be NULL in VC8 and in VC7 it will be ptr.
A* pTest = dynamic_cast<A*>(pObj);
I know the given approach is incorrect - why to cast to C object?!
Just want to point out that VC8 is less tolerant... and this is good. On the other side in case of big projects the code migration to VC8 can cause big pains
Thanks, Abyss
|
|
|
|
|
Abyss wrote: A* pTest = dynamic_cast(ptr);
What language is this ? In C++, it would be :
A *pTest = dynamic_cast<A*>(ptr);
You are not giving the target pointer, thus getting a void*, e.g. NULL .
Anyway, in this example, as others said, this works without problem:
A *pTest=ptr;
~RaGE();
-- modified at 7:31 Wednesday 12th April, 2006
|
|
|
|
|
The "<" and ">” characters and what's in between is not showing up on your post.
Steve
|
|
|
|
|
hi all,
i can encrypt/dicrypt a plane message text by CryptEncrypt(...) and CryptDecrypt(...) Api. but how to create Digitial Signatures and send over the wire using Tripple DES. any suggestions.
thanks,
uday.
uday kiran
|
|
|
|
|
Don't know exactly if a c++ or com expert can help so I posted this in the com section, too.
I fill a pointer to a com object via CoCreateInstance. Now I use this one and must "get rid of" the connection and reinstanciate this object. Tried this via
Release() method, but this seems not to be enough. Any one an idea?
|
|
|
|
|
When you say its not enough, what exactly is happening.
I'm assuming the sequence you are going through is something like:
<br />
IMyInterface* pI = NULL;<br />
<br />
<font color=green>
HRESULT hr = ::CoCreateInstance(CLS_MyInterface, NULL, CLSCTX_INPROC_SERVER, IID_IMyInterface, (void**)&pI);<br />
if(FAILED(hr))<br />
return false; <font color=green></font><br />
<br />
<font color=green></font><br />
<br />
pI->Release();<br />
pI = NULL;<br />
<br />
<font color=green>
HRESULT hr = ::CoCreateInstance(CLS_MyInterface, NULL, CLX_INPROC_SERVER, IID_IMyInterface, (void**)&pI);<br />
<font color=gray><br />
..<br />
..</font><br />
I Dream of Absolute Zero
|
|
|
|
|
Thanks for the fast answer. What exactly happening is that a process started by the com object is still active in task manager and so it seems that the "release" from the com object is not completely enough to make the object usable again. If I call methods within the new instantiated com object they didn't work as expected. Killing the started process solves the problem. Could it be that the implementation of the com object itself has bugs and doesn't shutdown as expected if I release from the object? The developer says that setting the pointer to nothing and make a new instantiation works in VB 2003. Sorry if I write something that seems nonsense in com understanding, because in this field I'm a newbie.
|
|
|
|
|
MarcoNedwig wrote: "release" from the com object is not completely enough to make the object usable again.
Hmmm. Well in that case it sounds as if your COM does not allow, or does not work well with multiple instances. Maybe it is using a unique resource (the threading method used), that cannot be shared across several instances.
If that is the case, then you will need to ensure that all active processes are done before the component can be reused. If it is a feature then it should have been documented; if its a bug, then I hope you find a workaround
I Dream of Absolute Zero
|
|
|
|
|
I think so. Have a work-around killing a process and then it works but this can't be the correct thing. Thanks for showing me that it seems that I dont't made a mistake using the com object.
|
|
|
|
|
I have to write a module in VC++ which will enumerate all submenus within a menu.
I have successfully been able to enumerate all submenu items within each menu e.g WordPad. i get each submenu string using GetMenuString().
Now having got the submenu string i want to be able to launch each submenu window, e.g in Wordpad 'File' menu i need to launch the "Open" submenu which has the name "Open... Ctrl+O", i want to be able to launch it using the shortcut keys 'Ctrl+O' programatically. How do i do this?
This is a test application to enumerate all submenus and launch each submenu window using the short cut keys only.
Kindly suggest me a way to do, if a sample code exists kindly update.
Awaiting a response.
Sincerely
Giftsana
|
|
|
|
|
this is very simple. go to the Menu options and give "&" apersand at the beginning of the menu item which will be your required info.
cheers.
uday.
uday kiran
|
|
|
|
|
Hello Uday
Yes am aware of giving an '&' before the menu item for the shortcut key.
My problem is i need to launch e.g the 'Open' submenu window within 'File' menu which contains the string'Open... Ctrl+O' using only the shortcut key in this case 'Ctrl+O'.
I need to be able to launch the 'File' submenu window 'Open' using the shortcut key only.
Do u have an idea??
Giftsana
|
|
|
|
|
U need to add an accelerator for the menu item
go to resource view, open Accelerator folder, open IDR_MAINFRAME
accl. table there u specify id of ur menu item & the short cut key u want
& it's type should be VIRTKEY
|
|
|
|