|
Hi! I'm new into drawing with Visual C++ MFC.
I've got an empty DIALOG where I load a floor layout (BMP resource) and I want to draw on it a dot indicating my position (using "SetDIBitsToDevice")
I call "Invalidate()" in another function when I get new coordinates to print on screen. Problem is that my PocketPC freezes every 3rd-4th time I run this function.
As I cannot borrow another PDA from anyone for now I would like to know if code is all right, or if there is any tricky command I'm using.
void CDisplayDlg::OnPaint()
{
CColoredDlg::OnPaint();
HBITMAP hBmpL1=::LoadBitmap(AfxGetResourceHandle(),
MAKEINTRESOURCE(IDB_DISPLAY_BITMAP));
CRect rc;
this->GetClientRect(&rc);
HDC hdc1 = ::GetDC(this->m_hWnd);
HDC hdcmem = ::CreateCompatibleDC(hdc1);
::SelectObject(hdcmem,hBmpL1);
::BitBlt(hdc1, rc.left, rc.top, rc.right, rc.bottom,
hdcmem,0,0,SRCCOPY);
BITMAPINFO BitmapInfo;
BitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
CWinCEUnsupportedFunctions::GetDIBits(hdcmem, hBmpL1, 0, 0,
NULL, &BitmapInfo, DIB_PAL_COLORS);
BYTE* pBitData = new BYTE[36];
for(int i=0;i<36;i++)
{
pBitData[i]=8;
}
scale=3.3;
if(numPositions==1)
{
::SetDIBitsToDevice(hdc1, (int)(xcoord1*scale), (int)(ycoord1*scale),
6, 6, 0, 0, 0, 6, pBitData, &BitmapInfo, DIB_PAL_COLORS);
}
delete pBitData;
}
Thanks!
|
|
|
|
|
maybe you have a memory leak! Change this line to free up the whole array!
delete [] pBitData
|
|
|
|
|
|
I made a "dot.bmp" in resources and I'm showing it with "LoadBitmap". ^^
Maybe there's something I have to call after SetDIBToDevice?
|
|
|
|
|
Hi
I have following issues while working with KSOAP2.
I don’t know whether I am posting my query at correct location or not
I have a Web service written in JAVA, developed using Netbeanns 6.5 deployed on Jboss5.0
I have a J2ME client which gives a call to WS using KSOAP
I want to do following things:
send byte[] which is part of custom VO
Handle exceptions sent from server
How do I send the byte array
I read the things on http://ksoap.objectweb.org/project/faq/index.html
But I don’t know how to use it
private void callWS1() throws IOException, XmlPullParserException {
String endPointURL = new String("http://172.16.3.184:8080/CitiBankOnline/LoginService");
String nameSpace = new String("http://service.partner.com/");
SoapObject method = new SoapObject(nameSpace, "getDevice1");
DeviceCurrentActivityVO oDcavo = new DeviceCurrentActivityVO();
KeySet oKeySet = new KeySet();
byte[] oBytesArr=new byte[]{(byte)0x01,(byte)0x01,(byte)0x01,(byte)0x01};
String bytes = Base64.encode(oBytesArr);
SoapPrimitive oPrimitive = new SoapPrimitive (SoapEnvelope.ENC, "base64", bytes);
String szbytes = oPrimitive.toString();
oDcavo.setProperty("id", new Integer(12));
oDcavo.setProperty("name", "geetanjali");
oDcavo.setProperty("encKey", bytes);
oDcavo.setProperty("keySet", oKeySet);
method.addProperty("param", oDcavo);
oForm.append("Created soap object");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = method;
envelope.setOutputSoapObject(method);
new MarshalBase64().register(envelope);
HttpTransport ht = new HttpTransport(endPointURL);
oForm.append("Created transport");
ht.call("", envelope);
oForm.append("Called transport");
SoapObject soapResult = (SoapObject) envelope.getResponse();
int totalProperty = soapResult.getPropertyCount();
oForm.append("\nid = " + soapResult.getProperty(0).toString() + "\n");
oForm.append("\nPriority = " + soapResult.getProperty(1).toString() + "\n");
SoapObject oString = (SoapObject) soapResult.getProperty(2);
Object s = oString.getProperty("version");
oForm.append("version = " + s.toString() + "\n");
oForm.append("id = " + oString.getProperty("id").toString() + "\n");
String szBytes = oString.getProperty("encKey").toString();
byte[] oBytes1= Base64.decode(szBytes);
oForm.append("ENc Key = " +oBytes1[0]+ "\n");
Display.getDisplay(this).setCurrent(oForm);
}
And Vo luks like
public class DeviceCurrentActivityVO extends SampleVO {
private int id;
private String name;
public Vector oVector = new Vector();
KeySet keySet = new KeySet();
byte[] oBytes = null;
public byte[] encKey;
public Object getProperty(int index) {
switch (index) {
case 0:
return new Integer(id);
case 1:
return name;
case 2:
return keySet;
case 3:
return encKey;
default:
return null;
}
}
public int getPropertyCount() {
return 4;
}
public void getPropertyInfo(int index, Hashtable properties, PropertyInfo info) {
switch (index) {
case 0:
info.name = "id";
info.type = PropertyInfo.INTEGER_CLASS;
break;
case 1:
info.name = "name";
info.type = PropertyInfo.STRING_CLASS;
break;
case 2:
info.name = "keySet";
info.type = PropertyInfo.OBJECT_CLASS;
break;
case 3:
info.name = "encKey";
info.type = new byte[0].getClass();
break;
default:
break;
}
}
public void setProperty(String name, Object value) {
{
if (name.equals("name")) {
setProperty(1, value);
} else if (name.equals("id")) {
setProperty(0, value);
}
else if (name.equals("keySet")) {
setProperty(2, value);
}
else if (name.equals("encKey")) {
setProperty(2, value);
}
}
}
public void setProperty(int index, Object value) {
switch (index) {
case 0:
id = ((Integer) value).intValue();
break;
case 1:
name = ((String) value).toString();
break;
case 2:
keySet = (KeySet) value;
case 3:
encKey = (byte[]) value;
default:
break;
}
}
}
public abstract class SampleVO implements KvmSerializable {
public static final String NAMESPACE = "http://172.16.3.184:8080/CitiBankOnline/LoginService";
public SampleVO() {
super();
}
}
Regards,
Geetanjali
|
|
|
|
|
When I show hep file in pocketpc, the result which I get as "af0apafapfashfafalfao.....", general is so. I attempted with chm file and doc file. The results are so. I think pocketpc do not support chm format and doc format. Please advise me how I have to do in order to show file hepl.Thanks
|
|
|
|
|
hi,
I try to use GetThreadTimes() to Get a thread's user time, the first parameter is thread's handle.
I know, the current thread's ID is same with it's handle, I can get correct user time of the current
thread.
GetThreadTimes((HANDLE)threadListStr.th32ThreadID,&fCreationTime,&fExitTime,&fKernelTime,&fUserTime);
But the fUserTime is 0 when the first parameter isn't current thread's ID,so I think I need get a thread's handle from it's ID for the first parameter.
Mobile platform don't support OpenThread() function,then how can I get a thread's handle?
Thank you for your reply.
|
|
|
|
|
I am writing a application in pocketpc and I conflicted with a problem. I want show a help file when user want, I use below code when user click on help button
Help.ShowHelp(null, "//ProgramFiles//Chess//Documents//help.chm");
In propertise of help.chm file, I chose "content" in build action and " Copy if newer" in copy to output directory. And when I run application. Program show me a messenger with content as "can not open help. The file can not be found"
Please advise me that how I have to do? Thanks
|
|
|
|
|
"//ProgramFiles//Chess//Documents//help.chm" <- incorrect
"\\Program Files\\Chess\\Documents\\help.chm" <- Correct
Note that there is a space between "Program" and "Files."
|
|
|
|
|
Thanks. I did do it follow your instructions and program showed file. But I think PocketPC is not support for chm file. Because programe show file with a content as "af0apafapfashfafalfao.....". General is so, I attempt with doc file and the its result is so. Please help me.
|
|
|
|
|
You can use plain HTML files to contain your help information.
|
|
|
|
|
Hi
How to use Datagrid in Right-to-left (Like Hebrew or Arabic language) ?
(WS2008,WinMobile2005,FW3.5)
thank's in advance
|
|
|
|
|
Hi all,
How to send SMS to multiple recipients including an award of their own? i can send SMS to one recipient by using API SmsSendMessage now?
|
|
|
|
|
The SmsMessage class has a property named "To." That property is a collection. You can keep adding recipients to it.
|
|
|
|
|
Thanks for your help,
I want to implement it in WIN32 SDK by C++, API SmsSendMessage can send SMS to one recipient successfully, but i do not konw how to send SMS to multiple recipients?
|
|
|
|
|
SmsMessage sms = new SmsMessage();
sms.Body = “Write your text here .”;
sms.To.Add( new Recipient( “”, “123123123” ) );
sms.To.Add( new Recipient( “”, “123123121” ) );
sms.To.Add( new Recipient( “”, “123123123” ) );
sms.To.Add( new Recipient( “”, “123123123” ) );
sms.To.Add( new Recipient( “”, “123132123” ) );
Msg.Send();
I think you can also try that way
Hope it will help you
|
|
|
|
|
Hello,
In my Win Mobile application written using Visual C# and Compact Framework I need to emit a sound (a beep would be fine) for a certain duration and a certain frequency.
I have tried OpenNETCF Community, alas the sound generated from its Tune function has a minimum duration of 1/100 of a second.
I need a more accurate timing, say I need to generate a sound with a 675 Hz pitch lasting for 0.215 seconds.
The duration and pitch can be changed by the user so playing a pre-recorded audio file is not an option.
Is there a way I can do that?
Thank you in advance.
steve
|
|
|
|
|
The .Net Compact Framework doesn't give you access to the sound buffer. It sounds like your next best options would be to either modify the OpenNETCF SDF or implement the functionality you need using the Wave API in a native DLL and then use that from your .Net program.
|
|
|
|
|
I'm writing a stop watch kind of application for mobile device. I added the System.Windows.Forms.Timer control to a Form of my Smart Device Project. But in the code behind I don't see the Start and Stop methods for this timer control.
Does the timer control donot support these methods for Smart Device Projects?
s.a.w.
|
|
|
|
|
Hi Sunit_82,
To Start timer you have to use
m_timer.Enable = true;
To Stop timer you have to use
m_timer.Enable = false;
Hope this may be help.
Pavan Pareta
|
|
|
|
|
You can use timer1.Enabled = true to start and for stop timer1.Enabled = false
And for yor stopwatch application, you can create this application using single timer control like.......
'-------------------------------------------------------------------------------
set the timer interval = 1000
Dim sec, min, mse, hr As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
timer1.Enabled = true
Timer1.Interval = 10
sec = 0
min = 0
mse = 0
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If mse = 100 Then
sec = sec + 1
mse = 0
End If
If sec = 60 Then
min = min + 1
sec = 0
End If
If min = 60 Then
hr = hr + 1
min = 0
End If
Label1.Text = hr
Label2.Text = min
Label3.Text = sec
Label4.Text = mse
mse = mse + 1
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
timer1.Enabled = false
End Sub
'-------------------------------------------------------------------------------
|
|
|
|
|
Hi,
I have to import data from .xls file to sqlCE.Pls guide me to do that.
|
|
|
|
|
When i use keybd_event to send "Tab"(VK_TAB 0x09) key, it doesn't work in mobile.
But other keys can work.
Thanks a lot.
|
|
|
|
|
You should be able to send the Tab key, but you will run into problems if you want to actually handle it with a KeyEventHandler. If you can't use another key for whatever application you are working on, see this MSDN magazine article (it specifically addresses the Tab key issue):
Add Keyboard Support to Compact Framework Apps by Trapping Windows Messages[^]
Disclaimer: the article is a few years old now and I have not tried out the code myself -- it looks to be fairly involved.
|
|
|
|
|
Actually, it looks like you can handle the Tab key if you are running on a device with .NET CF 2 or 3.5. In your Form constructor, set this.KeyPreview to true. You can now use the Form's KeyDown event to check for the Tab key. Of course, I am making a number of assumptions about what you are trying to do and what the problem is (besides it doesn't work).
|
|
|
|