Function to capture String message ? - Windows Mobile Development and Hacking General

Hi,
I'm develloping my first software on PocketPC but I would like to know the function to capture a string message as the GetDlgItem function.
Thanks for your help.
@@++

Related

Switch for cprog.exe

Does anyone know the switch for cprog.exe to get to the "Call History" or "Speed Dial" screen directly without having to start the dialer first?
Or can anyone help me reverse engineer the cprog.exe to find this switch?
Thanks!
To open the call log directly use the code
Code:
HWND hPhoneMainWnd=::FindWindow(_T("Dialog"),_T("Phone"));
if (!hPhoneMainWnd)
{
PROCESS_INFORMATION pi = {0};
DWORD dwRes = 0;
BOOL bret=CreateProcess(_T("\\Windows\\cprog.exe"), _T(""), NULL, NULL, NULL, 0, NULL, NULL, NULL, &pi);
if (!bret) dwRes=GetLastError();
Sleep(500);
hPhoneMainWnd=::FindWindow(_T("Dialog"),_T("Phone"));
}
if (hPhoneMainWnd)
{
::PostMessage(hPhoneMainWnd,WM_COMMAND,0x00002712 /*History button*/,0);
}
To open the speed dial change the ID value 0x00002712 to that of the speed dial (I dont now it right now, but it is easy to find it)
Enjoy :twisted:
Thanks very much mmalek!!!
It works fine under 2003 (SE) but unfortunately it doesn't work under WM 5.0 (Magneto). Does your code only work for the 2003 platform?
Thanks again!
For WM5, you have to find out correct resource IDs.
For cprog.exe, open tapres.dll in some resource editor and lookup IDs there.
buzz
How do you find out the correct ressource ID? When I open the tapres.dll of WM2003 and try to find the resource ID 0x00002712 mmalek used in his code, I can find it nowhere...
I open the DLL with PE Explorer... where exactly do I have to look for these ID's?
Thanks a lot guys!
@buzz_lightyear: Are you sure the correct resource IDs are inside tapres.dll? I dont know much about Windows programming and please correct me if I am wrong, but from my understanding inside tapres.dll are only the resource ID's of the "Menu" and not of the "Buttons" of the Dialer.
Please could anyone give me a hint to find a solution? I really need this!
Thanks
Hi, the IDs are in the tapres.dll, but this is not what I used.
The ID for the "Call History" button is 22303 or 571F Hex so you can also use this to send the WM_COMMAND massage. What I used to get the ID is the RemoteSpy++ i just spied on the cprog.exe messages and then clicked the button I need then the resource id is in the wParam of the message. you should succed using either method...
Enjoy ---- :twisted:
Hi!
Thanks a lot mmalek for your hint! But I am really wondering how you managed to make RemoteSpy++ work with a Magneto device! If I try to use RemoteSpy++ from EVC++ 4.0 I get always an error message. Unfortunately the RemoteSpy tool from Visual Studio 2005 Beta2 has still a bug and does not work either. So I have still no idea how to get the right Resource ID's to start directly the "Call History" and "Speed dial" screen.
(0x0000571F does not work on my Magneto devices (Wizard & WM5 2020))
So if anyone could provide me with the right Resource ID's for the "Call History" and "Speed dial" button for Magneto devices I would REALLY appreciate if he would post them
Cheers
mmalek said:
To open the call log directly use the code
Code:
HWND hPhoneMainWnd=::FindWindow(_T("Dialog"),_T("Phone"));
if (!hPhoneMainWnd)
{
PROCESS_INFORMATION pi = {0};
DWORD dwRes = 0;
BOOL bret=CreateProcess(_T("\\Windows\\cprog.exe"), _T(""), NULL, NULL, NULL, 0, NULL, NULL, NULL, &pi);
if (!bret) dwRes=GetLastError();
Sleep(500);
hPhoneMainWnd=::FindWindow(_T("Dialog"),_T("Phone"));
}
if (hPhoneMainWnd)
{
::PostMessage(hPhoneMainWnd,WM_COMMAND,0x00002712 /*History button*/,0);
}
To open the speed dial change the ID value 0x00002712 to that of the speed dial (I dont now it right now, but it is easy to find it)
Enjoy :twisted:
Click to expand...
Click to collapse
how to use this code?
Sorry to resurrect this thread, but did anyone get anywhere with this for WM5 / WM6? It would be *really* handy for today screen apps such as XMT or rlToday to be able to have a button that takes you to missed calls, and for this we need a command line switch for cprog or a .exe - we cannot put raw C in XMT / rlToday themes...
This would rock as an exe, especially if it worked for 2003, WM5 and WM6 - any takers?
You can use these .exe helpers:
ShowCalls.exe
ShowIncomingCalls.exe
ShowMissedCalls.exe
ShowOutgoingCalls.exe
Windows Mobile Phone edition based, are opensource GPL so you can use, and distribuite as you want.
These utilities can be found on the \Tools folder of XIAMultitheme binaries, or sources too
You can download XMT (Always download Snapshots!) from here:
Download XMT Binaries
Super Duper!
You rock stef!
evilc said:
Super Duper!
You rock stef!
Click to expand...
Click to collapse
Also XMT now support: File="missedcalls"

event handling in dynamically created control

Hi all,
I am using eVC++ 4.0, and i've dynamically created a CListView like this:
Code:
lv.Create(0,_T(""),WS_CHILD|WS_VISIBLE,r,this,5);
but I dont know how to handle the events of this control... any ideas??
Mohammad
To get events from a listview (win32) I normally subclass it. I use the subclassing routine to post a message back to the parent when the user is doing something like tapping on it, then the windows routine can check whats selected etc and act on it. Is subclassing possible in mfc ?( I don't use it).
Thank u
but can anybody post some code??
thnx
Ok, I am a bit lazy to look up code at the moment, but here's something:
Yes, subclassing is possible in MFC. You just derive your class from the basic class provided like this:
Code:
class MyListView : pubic CListView
Then you add message handlers in the normal matter.
EDIT: The following passage is incorrect:
But I think subclassing may not be necessary in you case. List box controls send WM_COMMAND messages with notifications of major events like selection change to the parent window. All you have to do is to create a WM_COMMAND handler in your parent class.
Sorry I was thinking of ListBox not list view when I wrote it.
To manually add message handlers you need to put macros like ON_MESAGE or ON_COMMAND in the DECLARE_MESSAGE_MAP section of the class cpp file. All the detaisl are available on MSDN.
Are you saying that a listview will send the same WM_COMMAND as a list box in mfc? Dose this also happen in win32 made listviews. I have always thought it was a bit too tedious to find out when the user taps an item in the listview.
After reading your post levenum I had a quick look and it says that a WM_NOTIFY gets sent to the parent with a LVN_ITEMCHANGED for example. I had not used the LVN_**** because when I looked at them there was none that seem to deal with selections. I would guess that LVN_ITEMACTIVATE or LVN_ODSTATECHANGED would be usefull for this but then a second tap would not be picked up still leaving me wanting subclassing in many situations to get the users tap.
Ok, I have read what u wrote guys and my problem is almost solved, I used the OnNotify() method to handle messages sent from child controls like this:
Code:
BOOL CTest2Dlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
// TODO: Add your specialized code here and/or call the base class
if(wParam ==5 ) //5 is control ID
{
NMHDR *ph =(NMHDR*)lParam;
if(ph->code==NM_CLICK)
MessageBox("Click");
else if(ph->code==HDN_ITEMCLICK)
MessageBox("Item Click");
else
{
CString str;
str.Format("%d",ph->code);
MessageBox(str);
}
}
return CDialog::OnNotify(wParam, lParam, pResult);
}
Now there still a very small prolem: what messages should I handle for 'Selected Item Changed' event ?? I know its easy but I couldnt find it
Regards
mohgdeisat: I am sorry, I made a mistake about WM_COMMAND.
OdeeanRDeathshead is right, I was thinking of a list box not list view.
To make up for this, here is some sample code from a win32 dialog app that uses list view control. I hope it will be of some help:
Code:
//this is from the dialog window function:
case WM_NOTIFY: //handle events:
nmhdr = (LPNMHDR)lParam;
switch (nmhdr->idFrom)
{
case IDC_LEDLIST: //list control ID.
return OnLEDListEvent(hwndDlg, (LPNMLISTVIEW)lParam);
break;
}
break;
BOOL OnLEDListEvent(HWND hwndDlg, LPNMLISTVIEW nmlv)
{
/////
// Handles list view control notification messages
switch (nmlv->hdr.code)
{
case LVN_ITEMCHANGED:
return OnLEDListItemChanged(hwndDlg, nmlv);
break;
}
return 0;
}
BOOL OnLEDListItemChanged(HWND hwndDlg, LPNMLISTVIEW nmlv)
{
if (ListView_GetSelectionMark(nmlv->hdr.hwndFrom) != nmlv->iItem) return 0;
/* do what you need here */
return 0;
}
Don't mind the fact that I used 3 different functions. This is part of a bigger program and I am trying to keep things well organized without resorting to classes.
As I understand it, LVN_ITEMCHANGE is received for different reasons so I try to handle only the one coming from selected item. LVN_ITEMACTIVATE is only sent when you double click the item so if you just want to catch selection change you need to use LVN_ITEMCHANGE.
Once again, sorry for confusing you before.
thanx pals, good job!!!
I think my problem is now solved with ur help :wink:
Mohammad
Ok guys, I said that my problem was solved, yet, another problem arises...
When the list view is in the report mode, how can I determine when a header button is clicked, and determine which one was clicked???????
thanx in advance
To identify a header column click, you need to handle the WM_NOTIFY/HDN_ITEMCLICK message. Normally this message will be received by the header's parent control (i.e. the listview) -- some frameworks may redirect the message to the header control itself. I haven't worked with MFC in 10 years so I can't really if it reflects notification messages back to the control.
If you're trying to implement column sort, do yourself a favor and check out the Windows Template Library (WTL) at sourceforge.net. It's a set of C++ template classes that provide a thin yet useful wrapper around the standard Windows UI components. One of the classes is a sortable listview control. I've been using WTL with big Windows for more than 5 years -- you couldn't pay me to go back to MFC.
hi,
I have seen the WTL library and it seems very useful and time-saver, but I have a couple of questions about it:
1. can WTL 8.0 be installed with VC++ 6.0, specifically the appwizard stuff??how?? I see only javascript files of vc7.0 and 7.1 and 8.0!!
2. is there a good documentation about those classes??
Mohammad
I don't know about WTL 8; I'm still using WTL 7.5 with VS .Net 2003 for all my Win32 development. My guess is that it wouldn't work too well, as WTL is based on ATL, which has substantially changed between VC 6 and 7.
Good references for WTL include www.codeproject.com/wtl, and the WTL group over at Yahoo groups (reflected at www.gmane.org).

Capture Camera Button WM5/6

Hi
I need to capture the camera shutter button on WM5/6 devices, so that I can control the camera with calls to SHCameraCapture. Despite trying to capture the event via WM_KEYDOWN, the camera app starts up.
Does anyone know of how to capture this event and prevent windows from handling it?
Cheers
Neil
not sure if any of this is working but have you tried "AllKeys" or "RegisterHotKey"?
Sorted!
Thanks for the suggestion. I have found that I can use:-
SHSetAppKeyWndAssoc(VK_APP4, m_hwnd);
to give exclusive event notification to my window. In the WinProc callback function message handler I get the event as follows:-
case WM_KEYDOWN:
switch( wParam) {
case VK_APP4 :
CaptureStillImage(m_hwnd);
break;
default:
break;
}
break;
When finished I call :-
SHSetAppKeyWndAssoc(VK_APP4, NULL);
to pass back the event to Windows.
Cheers
Neil

insert a variable into predifined string?

OK I've been looking for a while now. I'm trying to make a very simple app. what i want it to do is when i type a key word or phrase into a text box and hit the "GO" button i want the text that was typed to the text box to be inserted into a string which will be opened in the browser and search Google.
to clarify, basically taking the "Google Hacks" application for pc and writing it for android. i didn't think it was going to be that hard to do, but i cant find any examples of taking text from the text box and having it inserted in between the ""
-inurlhtm|html|php) intitle:"index of" +"last modified" +"parent directory" +description +size +(.mp3|.wma) ""
could anyone help me? i plan on later making it more like the pc app but right now just search for music, the apks and pics, etc...
may be
Intent intent = new Intent();
intent.setAction(Intent.ACTION_WEB_SEARCH);
intent.putExtra(SearchManager.QUERY,"searchString")
startActivity(intent);
search string can we get by TextView.getText().toString
thanks ill give it a try

[Q]To create android app for consuming OData services via Netweaver Gateway

Hi,
I need to develop an android application using Eclipse and Netweaver Gateway plugin. When I run my code as a console application, it works fine. However, I'm unable to consume the OData services from the android application. I need to call an OData service, which is hosted on an ECC on an organization's server and display the details and whatever on the application screen (in text-fields or whatever). The "android.permission.INTERNET" is defined in the AndroidManifest.xml, already. See the code below: (Url & credentials have been omitted)
private void readExample() throws RestClientException, ParserException
{
String reqUri = "http://<some url>";
IServerConnectionParameters gateway = new ServerConnectionParameters("<host name>","<port>","<client>",false);
IAuthentication credentials = new UsernamePasswordCredentials("<username>","<password>");
IRestClient restClient = RestClientFactory.createInstance(gateway, credentials,Representation.ATOM);
IRestRequest request = new RestRequest(reqUri);
IRestResponse response = restClient.execute(request);
// Convert the response body XML into an ODataCollection object
ODataEntry collection = ODataUtil.parseODataEntry(response.getBody());
ODataProperty[] properties = collection.getProperties();
for (ODataProperty oDataProperty : properties)
{
Context context = getApplicationContext();
CharSequence text = oDataProperty.getValue();
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
}
This is the function which gets called on a button click event and for example here, the details should be fetched from the service and shown as toast messages. This block works very fine using command line, but I'm unable to consume this via android. The debugger gets stuck on the "IRestResponse response = restClient.execute(request);" line and after a while returns an error of "Connection ETIMEDOUT" and could not connect to the host.
I'm using two reference libraries : com.sap.nw.gateway.odata.client_2.6.400.201211111531.jar, odata4j-0.7.0-clientbundle.jar.
Could somebody please shed some light on this?? I'm deeply stuck and need this urgently!! :crying:
Nobody ready to help, guys?? :'( :'(
bugnotch said:
Nobody ready to help, guys?? :'( :'(
Click to expand...
Click to collapse
Hi,
Please use Gateway Productivity Accelerator (tools.hana.ondemand.com/#gateway) instead of the Netweaver Gateway plugin for Eclipse.
Also, in general, make sure you don't call to a very large amount of data in a single request, but rather use paging or other.
Regards

Categories

Resources