here, p is a pointer to int*.that means p can point to an int pointer and that pointer will point an int type of data.
when you do this , (int**) new int (5) ; you are actually forcing (casting) p to point to an int pointer (memory address) with value 5 ..(It actually should not be done because you don't know anything about memory address 0x5 )... however and as you made p to store something(a memory address with value 5) you also allocated memory for that purpose ......
and the typecasting was necessary as first case is very different than the second case....
in the second case --- ap is an int pointer and with new command you allocated 4 bytes of memory for ap .. and ap is now pointing to that memory location and as you passed 20 in the constructor so now that memory address is storing 20....
But, p is not an int pointer ..it's a pointer to int pointer ...so it should be passed a valid memory address in the constructor call .. not an int(what you did -- by passing 5)..that's why you had to cast...
and the answer to your last question is ... p is just a pointer (it maybe a pointer to another pointer but it still is a pointer)..and when we want to know what value a pointer is pointing to we put * (deference op.) before that pointer (only once)!
Hope,you got that
I am a beginner in programming and have to write a solitaire program(C++) just like what we play in windows. I have no idea where or how I should start my program. I never write a game in any computer language and I have already stuck at the beginning for 2 weeks. Can you help??
btw I just need to finish the game logic and give it to my teammate to work on graphic(GUI).
now I just write a few line about checking whether the move in those 7 piles are valid or not and create 52 cards in a class by using array but cannot generate each card uniquely.
That is not a simple question to answer in a forum like this. You should start with a couple of classes:
Card - contains properties such as value and suit.
Player - contains a List of cards.
Some general methods:
A randomiser that deals the cards around.
Play that selects a card and figures out where it can be placed
Quite a lot to think about before you start coding, or worrying about the UI.
Dear all. I am using kinect SDK2.0. Kinect sensor 2.0; visual studio 2012 & openCV 2.4.10 installed in my system.\
I am new to this kinect platform.I am looking for c++ code test some simple code. I have tested code with SDK2.0 . those are working fine. But i didnt find the code where they add images features resources . code to track object
I would like to detect object like in youtube video <a href="https://www.youtube.com/watch?v=bSeFrPrqZ2A">object tracking using opencv</a>[<a href="https://www.youtube.com/watch?v=bSeFrPrqZ2A" target="_blank" title="New Window">^</a>]
Hooking is about capturing messages that are sent ot other applications. If you want to send a message then you just need to use the SendMessage function[^]. Although you will first need to get the handle to the Window via FindWindow[^].
I used the SendMessage() function many and many times, what it did is only close the handled application!!
I used also, PostMessage() and it did the same!
I used sendInput() and there is no response at all..
that's why I went to hook..
otherwise If there is a reliable way I will not go to hooking at all..
could you help in this please,,
if you need some code i will post, but if you provide me with a reliable code that can really send the mouse event to the application without moving the cursor, I will be thankful for you really
MOUSEEVENTF_MOVE is not a valid Windows message; you are just sending nonsense values.
The debugger message is just telling you that the Handle's value does not point to a valid portion of memory. This is expected since handles are arbitrary values used by the Windows OS.
You need to understand the use of all the windows messages which all have names beginning WM_, and are documented in MSDN. The links I gave you earlier will lead you to some of them. You can also look at the SendInput function[^] which may make it easier to achieve what you want.
Sorry, this site does not provide a service like this. You need to use your debugger to identify where the crash occurs and why. You can then come back here with the details, and people will try to help you.
I'm not sure that this is anything to do with managed C++/CLI, however ...
If you have a problem with some code that you downloaded from the internet, then you need to go back and talk to the person or people who provided it. But something called workingbutcrap is not very inspiring. And if you have issues with an article here on CodeProject then you should use the forum at the end of the article.
I'm facing the following strange problem using MFC Grid Control (by Chris Maunder) in my VS2010 MFC application:
I've included the CGridCtrl control in a dialog in order to let the user to edit data. It works fine but sometime when I open the dialog the cells content is not displayed but it's covered by the cell background color.
Unfortunately I can't solve the problem because it only happens randomly. I tried to call Invalidate() to both the CGridCtrl control and the dialog but it doesn't solve.