Weird Dialog Control Visibility Problem in Windows Mobile

Leave a comment


In Windows Mobile, I recently ran into the following problem.

I had a dialog box which has say about 8 fields. After sometime I wanted to add 1 more field which I duly inserted in between the existing controls using the dialog editor but when I executed the code much to my dismay I could only see a blank space in the place of the control I added.

With some .rc code tweaking I got it working. This is what I have done

1) Open the .rc code. Assume the following is the dialog code which represents the your dialog data

BEGIN

PUSHBUTTON “Button1”,IDC_BTN_1,4,21,73,14

PUSHBUTTON “Button2”,IDC_BTN_2,90,21,64,14

PUSHBUTTON “Button3”, IDC_BTN_3,4,107,64,14

LTEXT “Label1”,IDC_STATIC,4,59,24,8

LTEXT “Label2”,IDC_LBL_1,37,59,106,13

LTEXT “Label3”,IDC_LBL_2,4,82,146,23

CTEXT “Label4”,IDC_LBL_4,30,5,96,8

CONTROL “”,IDC_PRG_STATUS,“msctls_progress32”,PBS_SMOOTH | WS_BORDER,4,40,150,14

END

2) Assume you are adding a label called Label1_1 next to Label 1 but that part of code will get appended towards the end of the existing code as shown below.

BEGIN

PUSHBUTTON “Button1”,IDC_BTN_1,4,21,73,14

PUSHBUTTON “Button2”,IDC_BTN_2,90,21,64,14

PUSHBUTTON “Button3”, IDC_BTN_3,4,107,64,14

LTEXT “Label1”,IDC_STATIC,4,59,24,8

LTEXT “Label2”,IDC_LBL_1,37,59,106,13

LTEXT “Label3”,IDC_LBL_2,4,82,146,23

CTEXT “Label4”,IDC_LBL_4,30,5,96,8

CONTROL “”,IDC_PRG_STATUS,“msctls_progress32”,PBS_SMOOTH | WS_BORDER,4,40,150,14


LTEXT “Label1_1”,IDC_STATIC,4,72,41,8

END

3) Just move the newly added code (marked in green) to the relevant portion as shown below

BEGIN

PUSHBUTTON “Button1”,IDC_BTN_1,4,21,73,14

PUSHBUTTON “Button2”,IDC_BTN_2,90,21,64,14

PUSHBUTTON “Button3”, IDC_BTN_3,4,107,64,14

LTEXT “Label1”,IDC_STATIC,4,59,24,8


LTEXT “Label1_1”,IDC_STATIC,4,72,41,8

LTEXT “Label2”,IDC_LBL_1,37,59,106,13

LTEXT “Label3”,IDC_LBL_2,4,82,146,23

CTEXT “Label4”,IDC_LBL_4,30,5,96,8

CONTROL “”,IDC_PRG_STATUS,“msctls_progress32”,PBS_SMOOTH | WS_BORDER,4,40,150,14

END

Hurray, the control is now visible.

Advertisements

Setting HTTP POST Parameters in Windows Mobile

Leave a comment


Recently I was trying to make a HTTP POST query in Windows Mobile but the POST query was not successful. This is what I have been trying to do

Here sRequestHeaders is the headers which is in Unicode and the MSDN documentation says the following about “lpOptional” parameter which is used for POST parameters

pOptional [in]

Pointer to a buffer containing any optional data to be sent immediately after the request headers. This parameter is generally used for POST and PUT operations. The optional data can be the resource or information being posted to the server. This parameter can be NULL if there is no optional data to send.

dwOptionalLength [in]

Size of the optional data, in bytes. This parameter can be zero if there is no optional data to send.

It just says, pOptional is a buffer containing optional data and dwOptionalLength specifies the buffer in bytes, but when tried to send an Unicode buffer and its size in bytes to this call, the response was not 200 (HTTP_OK). After several attempts I found that the parameters had to be in ANSI buffer. All other parameters deal with LPCTSTR i.e TCHAR buffer, this one alone needs to be an ANSI buffer. Here is the code for that

if( FALSE == HttpSendRequest(hRequest, (LPCTSTR)sRequestHeaders, sRequestHeaders.GetLength(), LPVOID)(LPSTR)pszAnsiRequestParams, dwRequestParamsLen ) )

In the above call pszAnsiRequestParams is ANSI buffer and dwRequestParamsLen is the size of that buffer in bytes. Once I changed this, the response was 200. Is this how one will send the parameters always? If this is the case, how will I send Unicode POST parameters? Since in my case, I was dealing with ASCII characters for time being this is working fine but somehow I feel there should be a way out.

Can somebody post a solution what else am I missing here?

Top Windows Mobile Sites

Leave a comment


Top Windows Mobile Sites

http://www.smartphonemag.com/cms/bestoftheweb/bestsites – This lists down the popular windows mobile websites

1) http://www.microsoft.com/windowsmobile/en-us/default.mspx

2) http://www.windowsmobile7.com/

3) http://windowsphonethoughts.com/

4) http://www.wmexperts.com/

5) http://wmpoweruser.com/

6) http://windowsmobilelouisville.com/


As of now Windows Mobile comes under second tier applications but with the expected release of Windows Mobile Phone 7 it is fast catching up with rest of the platforms and as you can see from the list next to BlackBerry it is rated as the next popular platform to develop applications


First Tier App

1) iPhone

2) Android

3) iPad


Second Tier App

1) BlackBerry

2) Windows Mobile