If you run this in debug mode you can notice considerable lag because it runs over the debugger. The video here shows the application running normally, i.e. I select the program to "Start Without Debugging" (ctrl + F5).
If you run this in debug mode you can notice considerable lag because it runs over the debugger. The video here shows the application running normally, i.e. I select the program to "Start Without Debugging" (ctrl + F5).
Recap
Solution
MinDistance = ball1->radius + ball2->radius;
dxx = ball1->xPos – ball2->xPos;
dyy = ball1->yPos – ball2->yPos;
//calculate new distance between marbles
distance = sqrt(dxx*dxx + dyy*dyy);
printf("COLLISION: New Distance:%d \r\n", (int)distance);
//this part makes sure that the new positions of the marbles are not overlapping
//sometimes the new position itself overlaps and that leads to weird behaviour
//check if the marbles are overlapping
if ((int)distance <= MinDistance)
{
//adjust their positions
do
{
if (ball1->xPos > ball2->xPos)
{
ball1->xPos += 1;
ball2->xPos -= 1;
}
else
{
ball1->xPos -= 1;
ball2->xPos += 1;
}
if (ball1->yPos > ball2->yPos)
{
ball1->yPos += 1;
ball2->yPos -= 1;
}
else
{
ball1->yPos -= 1;
ball2->yPos += 1;
}
dxx = ball1->xPos – ball2->xPos;
dyy = ball1->yPos – ball2->yPos;
distance = sqrt(dxx*dxx + dyy*dyy);
}while((int)distance <= MinDistance);
}
Cellular emulator is very well documented so I don’t want to repeat the same things here, for more information visit the following link:
http://msdn.microsoft.com/en-us/library/bb158495.aspx
In short, you can simulate MO/MT calls, send and receive sms’s and do data sessions as well.
And that is when I came across Fake RIL. Well, I had heard about fake ril before and had a fairly good idea about what it was but never truly had the chance to play with it. I dug down a little deeper today and found it amazing. Basically, as the name suggests, it is a fake ril driver which simulates the network too. It is so well documented (it ships with AKU so I cannot shell out the docs here bacause of the NDA) and I really appreciate the idea and the brains that went behind designing it. Fake ril simulates the network and all the clients above can work as is, well, that was the whole idea in the first place (:
I had a windows mobile professional device so I thought I might try to make the device use Fake RIL instead of our customised ril which it was using. I built it into a dll and made the device load fakeril instead of the OEM ril driver that it was loading before. When the device booted up it came up with full signal strength and that is when I noticed that there was no SIM in the device! It worked. I tried making calls and sending a few sms’s and it worked perfectly. When you make a call the call is automatically answered, and there are some special numbers which simulate busy, unanswered, reject etc. If you’ve read the above link you know already.This is a great way for some of our sibling teams to test their applications as there is no dependency on the radio hardware, waiting for the radio code to stabilize et al. I couldn’t try data session though. Will try it out next week.
So I thought why not add the filename label, could anything else be simpler!
I edited the dialog to include another static text control and added the code in AllignComponents() to beautify the control. But a small hiccup, when I ran the program just to test if it was displayed correctly, it wasn’t to be seen. And then I remembered that the group box hides it. Darn, not again! So I went back removed the group control, added the static text and then added the group control back on. The control displayed correctly. Use GetModuleFileName() api to get the filename associated with the process.
WINAPI DWORD GetModuleFileName(HMODULE hModule, LPWSTR lpFileName, DWORD nSize);
The api takes the module handle for which the filename is requested, a buffer to hold the filename and finally the size of the buffer.
For hModule, you can pass the th32ProcessID member of the PROCESSENTRY32 structure after casting it to HMODULE.
Here is how I called the function in ShowProcInfo():
TCHAR filename[256] = TEXT("Unknown");
if(GetModuleFileName((HMODULE)pProcess->th32ProcessID, filename, sizeof(filename)/sizeof(TCHAR)))
{..}
Here are a few screen shots:
Update: Next post.
It wasn’t random, the same set of controls showed up every time and others didn’t. The UI was divided into three sections each contained within a group box. I could imagine how strange he must have thought it to be. But it had already happened to me before. And when he asked me for help, I couldn’t help a smile (: If you had read
this post carefully enough, you would have noticed a small remark on the group box that I had made. "Add these three static controls into a group box, name the group box "Process Info". Remember to create the three static text controls before creating the group box. I was trying the other way around, by creating the group box first, the text controls would not show up, they were hidden behind the group box." And that was the exact problem in this case too. He had added controls to the UI in a particular order, or rather, in no particular order. So all the controls added before the group box showed up correctly and others didn’t.
Update:
As Gato pointed out, this problem occurs because of the Tab order (also called z-order) of the individual controls. See the ‘Comments’ section below.
More details about the changes I made to DDEX1 and other stuff about DirectDraw, coming soon.