[?] How to display over HTC Caller ID - HD2 Windows Mobile 6.5 Themes and Apps

Hi guys,
Any developer here that knows how to display a window over the HTC Caller ID?
i have tried of course with setting the form as topmost, but that doesnt seem to be effective as the window only shows for a split second when form is loading and then the HTC Caller display forces itself infront of it.
Anyone got a solution?

namiran said:
Hi guys,
Any developer here that knows how to display a window over the HTC Caller ID?
Anyone got a solution?
Click to expand...
Click to collapse
Only one solutions what i saw was: reorder self created window to topmost every ~500ms (or on windows deactivate message). In result we have swaping windows first 1-2 seconds and then self created window appers on top.
Also i have trying direct drawing on desktop - but this one is not very good solution too

hi!
thanx for the tip! I didn't manage to get it working anyway
I tried it by setting a timer on the form at 500 ms that brings to front on each tick. but nothing happens...
could you please give me a more detailed description?
thank you!

hWnd - handle of window.
On timer processing do this:
Code:
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
If you using .net, then you must declare:
Code:
[DllImport("coredll.dll", SetLastError=true)]
private static extern bool SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int cx, int cy, int uFlags);
public const int HWND_TOPMOST = -1;
public const int SWP_NOMOVE = 0x0002;
public const int SWP_NOSIZE = 0x0001;
public const int SWP_SHOWWINDOW = 0x0040;
and hWnd in call replace with this.Handle
hope this will help

exidler said:
hWnd - handle of window.
On timer processing do this:
Code:
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
If you using .net, then you must declare:
Code:
[DllImport("coredll.dll", SetLastError=true)]
private static extern bool SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int cx, int cy, int uFlags);
public const int HWND_TOPMOST = -1;
public const int SWP_NOMOVE = 0x0002;
public const int SWP_NOSIZE = 0x0001;
public const int SWP_SHOWWINDOW = 0x0040;
and hWnd in call replace with this.Handle
hope this will help
Click to expand...
Click to collapse
Thank you so much for your help!
This really helped, althought i still seem to experience a problem.
The window wont stay on top however much i try... is there a cure for this?
Maybe it is because i had to change the line with the ticker to:
SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
because to be honest i dont know much about working with handles so i just wrote this.handle...
the code is structured like this
form1 calls form2
form2 creates the ticker
on ticker event we run this line
SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);

namiran said:
SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
because to be honest i dont know much about working with handles so i just wrote this.handle...
the code is structured like this
form1 calls form2
form2 creates the ticker
on ticker event we run this line
SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
Click to expand...
Click to collapse
you must use handle of form which must be on top.
if form not behind the caller id, i don't know why.
i'm using this way in native code and this one work fine.
also you can try to add ex style WS_EX_TOPMOST to form handle
or check is it exists already in form exstyles.
for this, you need to use GetWindowLong and SetWindowLong with GWL_EXSTYLE as second parameter. Use google to find needed PInvoke's and constants. And MSDN which is describe this functions.

Related

Audio recording. Error in source code

When I'm trying initialize VoiceRecorder I have error:
error LNK2019: unresolved external symbol VoiceRecorder_Create referenced in function "public: void __cdecl test2Dlg.obj
Ctest2Dlg::OnBnClickedButton3(void)" ([email protected]@@QAAXXZ)
CM_VOICE_RECORDER cmvr;
memset( &(cmvr), 0, sizeof(cmvr));
cmvr.cb = sizeof (CM_VOICE_RECORDER);
cmvr.dwStyle = VRS_NO_MOVE;
cmvr.xPos = -1; //-1 means control is drawn centered to Parent window hwndMain
cmvr.yPos = -1;
cmvr.hwndParent = m_hWnd;
cmvr.id = NULL;
cmvr.lpszRecordFileName = TEXT("\\My Documents\\TestRec.wav");
DeleteFile(L"\\My Docuemnts\\TestRec.wav");
DeleteFile(L"\\My Documents\\~Rec_0.wav");
HWND hwndVoice = VoiceRecorder_Create (&cmvr); //Error in this line
::ShowWindow(hwndVoice, WS_VISIBLE);
::UpdateWindow(hwndVoice);
Help me please

[Q] Error getting cellid

I am trying to get the cellid from a windows phone 7 program and the code I am using gives me an error when I call the RIL_Initialize function. The code it the standard c# that I have found in several places that everyone seems to be using.
When I try to run this code, I get an exception on the RIL_Initialize.
{"Attempt to access the method failed: CellInfo.RIL.RIL_Initialize(System.UInt32, CellInfo.RIL+RILRESULTCALLBACK, CellInfo.RIL+RILNOTIFYCALLBACK, System.UInt32, System.UInt32, System.IntPtr&)"}
Code:
public static string GetCellTowerInfo()
{
// initialise handles
IntPtr hRil = IntPtr.Zero;
IntPtr hRes = IntPtr.Zero;
// initialise result
celltowerinfo = "";
// initialise RIL
hRes = RIL_Initialize(1, // RIL port 1
new RILRESULTCALLBACK(rilResultCallback), // function to call with result
null, // function to call with notify
0, // classes of notification to enable
0, // RIL parameters
out hRil); // RIL handle returned
....etc.

[Resolved] [Q][DEV]Android Development Question about Shared Preferences.

Hi, I'm trying to do a simple login with Facebook in my app but I'm having trouble with Shared Preferences.
The idea is to start the app, it opens Activity A, checks if it's logged, and if it isn't, it sends you to activity B, you login and then go back to A.
My problem is that I can't get the SharedPreferences. I can save it, but I can't get it in the other activity.
So, it gets in a loop: A can't get the SP, so thinks it's not logged in, so send you to B, but B is logged on, and sends you to A...
That's my code in B:
Code:
public void onComplete(Bundle values) {
// TODO Auto-generated method stub
Editor edit = fbSP.edit();
edit.putString("access_token", fb.getAccessToken());
edit.putLong("access_expires", fb.getAccessExpires());
edit.commit();
aIMG();
ir();
}
And that's my code in A, where the problem is:
Code:
private SharedPreferences prefs;
public static String TOKEN = null;
public static final String FACEBOOK_DATA = "FacebookStuff";
long EXPIRES = 0;
...
private void SharedP() {
// TODO Auto-generated method stub
prefs = getSharedPreferences(FACEBOOK_DATA, MODE_PRIVATE);
TOKEN = prefs.getString("access_token", null);
EXPIRES = prefs.getLong("access_expires", 0);
if (TOKEN == null && EXPIRES == 0) { //If it's not logged in...
Intent login = new Intent("android.intent.action.FACELOGIN");
startActivity(login);
}
}
Edit: I got it. I was iniciating fbSP with getPreferences, not getSharedPreferences.

non-static variable

Hello,
I got this error https://gerrit.omnirom.org/#/c/3918/11/packages/SystemUI/src/com/android/systemui/quicksettings/BatteryTile.java
frameworks/base/packages/SystemUI/src/com/android/systemui/quicksettings/BatteryTile.java:117: non-static variable SHOW_100_PERCENT cannot be referenced from a static context
boolean batteryHasPercent = BatteryMeterView.SHOW_100_PERCENT;
SOLUTION
int batteryStyle = Settings.System.getIntForUser(mContext.getContentResolver(),
Settings.System.STATUS_BAR_BATTERY, 0, UserHandle.USER_CURRENT);
boolean batteryHasPercent = batteryStyle == BatteryMeterView.BATTERY_STYLE_PERCENT;

SMS AT commands doesnt work on my android device C++ | Bluetooth | winsock

Hi there!
I'm creating windows application in C++, which connect's PC with mobile via bluetooth and winsock. Allow's you to call and send messages from mobile via computer.
I'm using AT command's to tell mobile what i want to do. Pair with mobile device and force a call with At command
ATD+420******;
works perfect, but all commands for handling SMS like
AT+CMGL, AT+CMGF, AT+CMGS etc.
return's ERROR.
Here is code which connects PC with mobile via bluetooth and socket:
SOCKADDR_BTH RemoteEndPoint;
RemoteEndPoint.port = 0;
RemoteEndPoint.addressFamily = AF_BTH;
RemoteEndPoint.btAddr = m_foundDevices[m_deviceIndex].Address.ullLong;
RemoteEndPoint.serviceClassId = HandsfreeServiceClass_UUID;
int BTHAddrLength = sizeof(RemoteEndPoint);
// Create the socket.
if ((m_localSocket = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM)) == INVALID_SOCKET)
{
// handle error.
}
// Connect the socket.
if ((iResult = connect(m_localSocket, (SOCKADDR *)&RemoteEndPoint, sizeof(RemoteEndPoint))) == INVALID_SOCKET)
{
// handle error.
}
Notice line
Hide Copy Code
RemoteEndPoint.serviceClassId = HandsfreeServiceClass_UUID
I think the problem is here, becouse u cant send sms from Handsfree, but when i use another UUID, it doesnt even pair with mobile.
=== Here is just for info, how am i sending and receiving data from mobile ===
char recvbuf[DEFAULT_BUFLEN] = "";
const char *sendbuf = "AT+CMGL\r";
int len = (int)strlen(sendbuf);
if ((iResult = send(m_localSocket, sendbuf, len, MSG_OOB)) == SOCKET_ERROR)
{
// handle error. return ~0
}
if ((iResult = recv(m_localSocket, recvbuf, recvbuflen, 0)) == SOCKET_ERROR)
{
// handle error. return ~0
}
// Here recvbuf == "\r\nERROR\r\n"
Thank you for any advices! If you have any question's about problem, i'll kindly explain.
Regards,
Ferina.

Categories

Resources