Hi all,
i want to lock the screen orientation in portrait mode.
how can i do it in programming??
Thank you
try this, is not too clean sorry:
Code:
Public Class display
'DEVICEMODE
<Runtime.InteropServices.DllImport("coredll.dll")> _
Friend Shared Function ChangeDisplaySettingsEx(ByVal lpszDeviceName As String, ByVal lpDevMode As Byte(), ByVal hwnd As IntPtr, ByVal dwflags As CDSFlags, ByVal lParam As IntPtr) As CDSRet
End Function
'Declare Function ChangeDisplaySettingsEx Lib "coredll.dll" (ByVal lpszDeviceName As String, ByVal lpDevMode As Byte(), ByVal hwnd As IntPtr, ByVal dwflags As CDSFlags, ByVal lParam As IntPtr) As CDSRet
Public Shared Function ChangeDisplayOrientation(ByVal degree As Integer) As String
Dim devMode As New devicemodeW()
devMode.dmFields = DM_Fields.DM_DISPLAYORIENTATION
If degree = 0 Then
devMode.dmDisplayOrientation = DMD.DMDO_0
ElseIf degree = 90 Then
devMode.dmDisplayOrientation = DMD.DMDO_90
ElseIf degree = 180 Then
devMode.dmDisplayOrientation = DMD.DMDO_180
ElseIf degree = 270 Then
devMode.dmDisplayOrientation = DMD.DMDO_270
End If
Dim ret As CDSRet = ChangeDisplaySettingsEx(Nothing, devMode.Data, IntPtr.Zero, 0, IntPtr.Zero)
Return (ret.ToString())
End Function
' from pinvoke.net
Public Enum DMD
DMDO_0 = 0
DMDO_90 = 1
DMDO_180 = 2
DMDO_270 = 4
End Enum
Public Enum DM_Fields
DM_DISPLAYORIENTATION = 8388608
DM_DISPLAYQUERYORIENTATION = 16777216
End Enum
Public Enum DM_Orient
DMORIENT_PORTRAIT = 1
DMORIENT_LANDSCAPE = 2
End Enum
' Flags for ChangeDisplaySettings
Enum CDSFlags
CDS_VIDEOPARAMETERS = &H20
CDS_RESET = &H40000000
End Enum
' Return values for ChangeDisplaySettings
Enum CDSRet
DISP_CHANGE_SUCCESSFUL = 0
DISP_CHANGE_RESTART = 1
DISP_CHANGE_FAILED = -1
DISP_CHANGE_BADMODE = -2
DISP_CHANGE_NOTUPDATED = -3
DISP_CHANGE_BADFLAGS = -4
DISP_CHANGE_BADPARAM = -5
End Enum
Public Class devicemodeW
Inherits SelfMarshalledStruct
Private _DM_Orient As DM_Orient
Private _DM_Fields As DM_Fields
Private _DMD As DMD
Public Sub New()
MyBase.New(192)
dmSize = CUShort(Data.Length)
End Sub
Public Property dmDeviceName() As String
Get
Return GetStringUni(0, 64)
End Get
Set(ByVal value As String)
SetStringUni(value, 0, 64)
End Set
End Property
Public Property dmSpecVersion() As UShort
Get
Return GetUInt16(64)
End Get
Set(ByVal value As UShort)
SetUInt16(64, value)
End Set
End Property
Public Property dmDriverVersion() As UShort
Get
Return GetUInt16(66)
End Get
Set(ByVal value As UShort)
SetUInt16(66, value)
End Set
End Property
Public Property dmSize() As UShort
Get
Return GetUInt16(68)
End Get
Set(ByVal value As UShort)
SetUInt16(68, value)
End Set
End Property
Public Property dmDriverExtra() As UShort
Get
Return GetUInt16(70)
End Get
Set(ByVal value As UShort)
SetUInt16(70, value)
End Set
End Property
Public Property dmFields() As DM_Fields
Get
'Return DirectCast(GetUInt32(72), DM_Fields)
Return _DM_Fields
End Get
Set(ByVal value As DM_Fields)
_DM_Fields = value
SetUInt32(72, CInt(value))
End Set
End Property
Public Property dmOrientation() As DM_Orient
Get
'Return DirectCast(GetInt16(76), DM_Orient)
Return _DM_Orient
End Get
Set(ByVal value As DM_Orient)
SetInt16(76, CShort(value))
End Set
End Property
Public Property dmPaperSize() As Short
Get
Return GetInt16(78)
End Get
Set(ByVal value As Short)
SetInt16(78, value)
End Set
End Property
Public Property dmPaperLength() As Short
Get
Return GetInt16(80)
End Get
Set(ByVal value As Short)
SetInt16(80, value)
End Set
End Property
Public Property dmPaperWidth() As Short
Get
Return GetInt16(82)
End Get
Set(ByVal value As Short)
SetInt16(82, value)
End Set
End Property
Public Property dmScale() As Short
Get
Return GetInt16(84)
End Get
Set(ByVal value As Short)
SetInt16(84, value)
End Set
End Property
Public Property dmCopies() As Short
Get
Return GetInt16(86)
End Get
Set(ByVal value As Short)
SetInt16(86, value)
End Set
End Property
Public Property dmDefaultSource() As Short
Get
Return GetInt16(88)
End Get
Set(ByVal value As Short)
SetInt16(88, value)
End Set
End Property
Public Property dmPrintQuality() As Short
Get
Return GetInt16(90)
End Get
Set(ByVal value As Short)
SetInt16(90, value)
End Set
End Property
Public Property dmColor() As Short
Get
Return GetInt16(92)
End Get
Set(ByVal value As Short)
SetInt16(92, value)
End Set
End Property
Public Property dmDuplex() As Short
Get
Return GetInt16(94)
End Get
Set(ByVal value As Short)
SetInt16(94, value)
End Set
End Property
Public Property dmYResolution() As Short
Get
Return GetInt16(96)
End Get
Set(ByVal value As Short)
SetInt16(96, value)
End Set
End Property
Public Property dmTTOption() As Short
Get
Return GetInt16(98)
End Get
Set(ByVal value As Short)
SetInt16(98, value)
End Set
End Property
Public Property dmCollate() As Short
Get
Return GetInt16(100)
End Get
Set(ByVal value As Short)
SetInt16(100, value)
End Set
End Property
Public Property dmFormName() As String
Get
Return GetStringUni(102, 64)
End Get
Set(ByVal value As String)
SetStringUni(value, 102, 64)
End Set
End Property
Public Property dmLogPixels() As UShort
Get
Return GetUInt16(166)
End Get
Set(ByVal value As UShort)
SetUInt16(166, value)
End Set
End Property
Public Property dmBitsPerPel() As UInteger
Get
Return GetUInt32(168)
End Get
Set(ByVal value As UInteger)
SetUInt32(168, value)
End Set
End Property
Public Property dmPelsWidth() As UInteger
Get
Return GetUInt32(172)
End Get
Set(ByVal value As UInteger)
SetUInt32(172, value)
End Set
End Property
Public Property dmPelsHeight() As UInteger
Get
Return GetUInt32(176)
End Get
Set(ByVal value As UInteger)
SetUInt32(176, value)
End Set
End Property
Public Property dmDisplayFlags() As UInteger
Get
Return GetUInt32(180)
End Get
Set(ByVal value As UInteger)
SetUInt32(180, value)
End Set
End Property
Public Property dmDisplayFrequency() As UInteger
Get
Return GetUInt32(184)
End Get
Set(ByVal value As UInteger)
SetUInt32(184, value)
End Set
End Property
Public Property dmDisplayOrientation() As DMD
Get
'Return DirectCast(GetUInt32(188), DMD)
Return _DMD
End Get
Set(ByVal value As DMD)
_DMD = value
SetUInt32(188, CInt(value))
End Set
End Property
End Class
Public Class ScreenMode
'DEVICEMODE
<Runtime.InteropServices.DllImport("coredll.dll")> _
Friend Shared Function ChangeDisplaySettingsEx(ByVal lpszDeviceName As String, ByVal lpDevMode As Byte(), ByVal hwnd As IntPtr, ByVal dwflags As CDSFlags, ByVal lParam As IntPtr) As CDSRet
End Function
'Declare Function ChangeDisplaySettingsEx Lib "coredll.dll" (ByVal lpszDeviceName As String, ByVal lpDevMode As Byte(), ByVal hwnd As IntPtr, ByVal dwflags As CDSFlags, ByVal lParam As IntPtr) As CDSRet
Public Function ChangeMode(ByVal degree As Integer) As String
Dim devMode As New devicemodeW()
devMode.dmFields = DM_Fields.DM_DISPLAYORIENTATION
If degree = 0 Then
devMode.dmDisplayOrientation = DMD.DMDO_0
ElseIf degree = 90 Then
devMode.dmDisplayOrientation = DMD.DMDO_90
ElseIf degree = 180 Then
devMode.dmDisplayOrientation = DMD.DMDO_180
ElseIf degree = 270 Then
devMode.dmDisplayOrientation = DMD.DMDO_270
End If
Dim ret As CDSRet = ChangeDisplaySettingsEx(Nothing, devMode.Data, IntPtr.Zero, 0, IntPtr.Zero)
Return (ret.ToString())
End Function
Public Sub SetLandscape()
Try
ChangeMode(90)
Catch ex As Exception
'MsgBox(ex.ToString)
End Try
End Sub
Public Sub SetPortrait()
Try
ChangeMode(0)
Catch ex As Exception
'MsgBox(ex.ToString)
End Try
End Sub
End Class
End Class
usage:
Code:
display.ChangeMode(angle)
i use Win32API to write my app. But , your code is VB.
i will try my best to understand it.
Thank alessandroame so much =]
Is there a way to easily remove the facebook tags on contacts in outlook? it's the stuff that says :
<HTCData><!-- Please do not modify -->
<Facebook>id:xxxxxx/friendof:xxxxxxxxxxx</Facebook>
</HTCData>
Thanks!
Yes PLEASE? I don't use a Sense ROM anymore and this is annoying!
I don't even have this phone anymore. Maybe I will write something to do this for us.
HTC tag removal in contact notes!
I just sat down on my break and created this code to strip out the HTC tags from the contact notes:
Code:
Sub HTCbGone()
Dim objContactsFolder As Outlook.MAPIFolder
Dim objContacts As Outlook.Items
Dim objContact As Object
Dim StartPos As Integer
Dim EndPos As Integer
Dim iCount As Integer
' Specify with which contact folder to work
Set objContactsFolder = _
Session.GetDefaultFolder(olFolderContacts)
Set objContacts = objContactsFolder.Items
iCount = 0
' Process the changes
For Each objContact In objContacts
If TypeName(objContact) = "ContactItem" Then
StartPos = InStr(objContact.Body, "<HTCData>")
EndPos = InStr(objContact.Body, "</HTCData>") + 10
If StartPos > 0 Then
If StartPos = 1 Then
If Len(EndPos) > EndPos + 1 Then
objContact.Body = Mid(objContact.Body, EndPos + 1)
Else
objContact.Body = ""
End If
Else
If Len(EndPos) > EndPos + 1 Then
objContact.Body = Left(objContact.Body, StartPos = 1)
Else
objContact.Body = Left(objContact.Body, StartPos - 1) & Mid(objContact.Body, EndPos + 1)
End If
End If
iCount = iCount + 1
objContact.Save
End If
End If
Next
' Display the results
MsgBox "Number of contacts updated:" & Str$(iCount), , _
"HTCbGone Finished"
' Clean up
Set objContact = Nothing
Set objContacts = Nothing
Set objContactsFolder = Nothing
End Sub
To run this, I opened Outlook. Selected Macro(s) from the Tools pull-down menu (or press [ALT+F8]). Created a new Macro called HTCbGone and pasted this code over everything. Then I just ran it.
Use at your own risk.
Happy scripting,
GinoRP
THANK YOU!!!! (I only type in all caps 2 or 3 times a year) If HTC was a person I would kick him in the teeth because of what they have done to my 500+ contacts in my Microsoft Exchange account.
How could the people at HTC justify code that puts notes on contacts only invisible to a HTC device and visible everywhere else?? How could they think that would annoy no one? Blows my effing mind.
Kinda thanks but for me it did not work.
I made and run the macro.
Then I noticed some things got lost though!
Before I began I made a copy of the contacts folder in Outlook (recommended!).
I used the "modified" tab to see what contacts where changed when.
There was an extra URL in the note position for a contact which I put there earlier today.
After running the macro the Facebook data was gone but so was the URL.
Because it changed many contacts I did not bother to look further if other things gotten lost but rather just emptied the folder and restored from backup folder.
I am do work with DB and such but did not find anything special in the script which could explain my output.
Sorry to bring up a dead thread, but is there a way to do this without outlook?
i am still interested as well- can anyone come up with a better way not using outlook?
Remove HTC Notes Using CSV
DeMiNe0 said:
Sorry to bring up a dead thread, but is there a way to do this without outlook?
Click to expand...
Click to collapse
I was trying to figure out this very same thing and came across this thread in my searching. I also don't look Outlook, but I found a really simple, quick, and effective way to manually get rid of all those pesky HTC notes in under five minutes, for those that don't use Outlook:
1) Go into the contacts view in Gmail
2) Click the "More" dropdown box and select "Export"
3) Ensure that the "All Contacts" option is selected, choose the "Outlook CSV format," and export
4) After the file downloads, open it up in Excel (or your choice spreadsheet program)
5) Find the column labeled "Notes," and then just scroll down and clear all the cells with HTC data in them
6) Save the file, ensuring it is still in CSV format
7) Back in your Google Contact Manager, delete all your contacts
NOTE: Before deleting your contacts you will want to export a Google CSV file of all your contacts for backup. You can also the "More > Restore" feature to go back to a previous point in time if something goes wrong.8) Import the CSV file you saved in step 6
That's it! Your contact book should be restored to the exact way it was, minus the obnoxious HTC data. With 1,000+ contacts, I was able to do this in about two minutes. Again, be sure you have backups of your contacts or know how to use Google's Restore contacts feature in case something goes wrong, but this should work simply enough. Also, I just selected all the cells in the Notes column and cleared all their data, but if you have any notes saved for any of your contacts, you'll want to scroll through the spreadsheet file and be sure you only delete cells with HTC data.
I hope this helps!
---------- Post added at 01:09 AM ---------- Previous post was at 12:52 AM ----------
You should also be aware that this method may cause you to lose your contacts photos, as well as any joined contacts you have in your Android address book. However, if you want to attach your contacts Facebook photos permanently to their Google contact entry (something HTC's method did not do), you should check out this tool; in just a couple clicks, you can have all those photos matched up again and restored:
[I can't post links yet, but just Google "Facebook Google Contact Sync" and click on the first return. It is a great little tool made by a dev called "Heart of Angel."]
mredmond2012 said:
I was trying to figure out this very same thing and came across this thread in my searching. I also don't look Outlook, but I found a really simple, quick, and effective way to manually get rid of all those pesky HTC notes in under five minutes, for those that don't use Outlook:
1) Go into the contacts view in Gmail
2) Click the "More" dropdown box and select "Export"
3) Ensure that the "All Contacts" option is selected, choose the "Outlook CSV format," and export
4) After the file downloads, open it up in Excel (or your choice spreadsheet program)
5) Find the column labeled "Notes," and then just scroll down and clear all the cells with HTC data in them
6) Save the file, ensuring it is still in CSV format
7) Back in your Google Contact Manager, delete all your contacts
NOTE: Before deleting your contacts you will want to export a Google CSV file of all your contacts for backup. You can also the "More > Restore" feature to go back to a previous point in time if something goes wrong.8) Import the CSV file you saved in step 6
That's it! Your contact book should be restored to the exact way it was, minus the obnoxious HTC data. With 1,000+ contacts, I was able to do this in about two minutes. Again, be sure you have backups of your contacts or know how to use Google's Restore contacts feature in case something goes wrong, but this should work simply enough. Also, I just selected all the cells in the Notes column and cleared all their data, but if you have any notes saved for any of your contacts, you'll want to scroll through the spreadsheet file and be sure you only delete cells with HTC data.
I hope this helps!
---------- Post added at 01:09 AM ---------- Previous post was at 12:52 AM ----------
You should also be aware that this method may cause you to lose your contacts photos, as well as any joined contacts you have in your Android address book. However, if you want to attach your contacts Facebook photos permanently to their Google contact entry (something HTC's method did not do), you should check out this tool; in just a couple clicks, you can have all those photos matched up again and restored:
[I can't post links yet, but just Google "Facebook Google Contact Sync" and click on the first return. It is a great little tool made by a dev called "Heart of Angel."]
Click to expand...
Click to collapse
In addition to the thanks button, I think you deserve a "thanks" post. This was so useful and in addition to removing that HTC garbage, I removed all the other data I found unnecessary.
Remove With a Simple Java Program, If you know Java
Ozark_8125 said:
Is there a way to easily remove the facebook tags on contacts in outlook? it's the stuff that says :
<HTCData><!-- Please do not modify -->
<Facebook>id:xxxxxx/friendof:xxxxxxxxxxx</Facebook>
</HTCData>
Thanks!
Click to expand...
Click to collapse
I know I am too late to reply this post but I actually searched a solution today and found this post where some one also had same issue.
Using gdata java api I wrote a small program to remove notes from all of your contacts. Maximum 800 (Congifurable) Here is the Java Program :
Code:
import java.net.URL;
import com.google.gdata.client.Query;
import com.google.gdata.client.contacts.ContactsService;
import com.google.gdata.data.PlainTextConstruct;
import com.google.gdata.data.TextContent;
import com.google.gdata.data.contacts.ContactEntry;
import com.google.gdata.data.contacts.ContactFeed;
/**
* This is a test template
*/
public class ContactNotesCleaner {
public static String feedUrlString = "https COLON SLASH SLASH www DOT google DOT com SLASH m8 SLASH feeds SLASH contacts SLASH default SLASH full";
public static void main(String[] args) throws Exception {
// Create a new Contacts service
ContactsService myService = new ContactsService(<Any App Name>);
myService.setUserCredentials(<Your Gmail Id>, <Your Password>);
updateAllContacts(myService);
}
public static void updateAllContacts(ContactsService myService) throws Exception {
URL feedUrl = new URL(feedUrlString);
Query myQuery = new Query(feedUrl);
myQuery.setMaxResults(800);
ContactFeed resultFeed = myService.query(myQuery, ContactFeed.class);
// Print the results
System.out.println(resultFeed.getTitle().getPlainText());
for (ContactEntry entry : resultFeed.getEntries()) {
if (entry.getContent() != null) {
updateNotesContent(myService, entry);
}
}
}
private static void updateNotesContent(ContactsService myService, ContactEntry entry) throws Exception {
TextContent textContent = (TextContent) entry.getContent();
if (textContent.getContent() != null) {
String plainText = textContent.getContent().getPlainText();
if (plainText != null && plainText.startsWith("<HTCData>")) {
String newPlainText = "";
textContent.setContent(new PlainTextConstruct(newPlainText.trim()));
entry.setContent(textContent);
URL editUrl = new URL(entry.getEditLink().getHref());
ContactEntry contactEntry = myService.update(editUrl, entry);
System.out.println(entry.getName().getFullName().getValue() + " " + "Updated: " + contactEntry.getUpdated().toString());
}
}
}
}
I have executed the above program and tested it. You need gdata lib files:
gdata-media-1.0.jar
gdata-client-meta-1.0.jar
gdata-contacts-3.0.jar
gdata-client-1.0.jar
gdata-contacts-meta-3.0.jar
gdata-core-1.0.jar
guava-14.0.1.jar
gdataplugin.jar -- I am not sure what this jar does, even if it is required or not.
This is a bit complex for some users to run a java program, this way you will not loose the chat invites and other important information of your contact.
Note: Even if I have tested above program 10 times, I would not give any guaranty it will work for you.
- CAM
cmehta82 said:
I know I am too late to reply this post but I actually searched a solution today and found this post where some one also had same issue.
Using gdata java api I wrote a small program to remove notes from all of your contacts. Maximum 800 (Congifurable) Here is the Java Program
Click to expand...
Click to collapse
Your Java program worked!
I attached all the required libraries in a .zip-file. Include them in your Java project and copy the code from cmehta82 post above.
Replace <Your Gmail Id> with your emailadress:
Replace <Your Password> with your application specific password, generated at https://accounts.google.com/b/0/IssuedAuthSubTokens#accesscodes
Replace the feed URL string with https://www.google.com/m8/feeds/contacts/default/full
Can't JOIN contacts if HTCData exists in notes field
I wrote up my solution to this problem a little bit here thanks to the this forum thread above.
http://androidforums.com/samsung-ga...tcdata-exists-in-notes-field.html#post5968115
Python script to remove HTCData
Used to be a HTC phone user and it really messed up my contacts with the XML data. I am using a Mac and have written a Python script to get rid of the HTCData tag.
I posted the script here: http://kongjinjie.wordpress.com/2013/10/29/remove-htcdata-from-apple-contacts/
I don't know if this works on other OS, only tested on my Mac. I hope it helps!
EDIT:
Do not use this for those who setup Sync to Google. After running this script, it doesn't seeem to initiate a sync to Google. Anyone knows how to force a sync to Google? Is there a timestamp I can change to identify the latest version?
cmehta82 said:
I know I am too late to reply this post but I actually searched a solution today and found this post where some one also had same issue.
Using gdata java api I wrote a small program to remove notes from all of your contacts. Maximum 800 (Congifurable) Here is the Java Program :
Code:
import java.net.URL;
import com.google.gdata.client.Query;
import com.google.gdata.client.contacts.ContactsService;
import com.google.gdata.data.PlainTextConstruct;
import com.google.gdata.data.TextContent;
import com.google.gdata.data.contacts.ContactEntry;
import com.google.gdata.data.contacts.ContactFeed;
/**
* This is a test template
*/
public class ContactNotesCleaner {
public static String feedUrlString = "https COLON SLASH SLASH www DOT google DOT com SLASH m8 SLASH feeds SLASH contacts SLASH default SLASH full";
public static void main(String[] args) throws Exception {
// Create a new Contacts service
ContactsService myService = new ContactsService(<Any App Name>);
myService.setUserCredentials(<Your Gmail Id>, <Your Password>);
updateAllContacts(myService);
}
public static void updateAllContacts(ContactsService myService) throws Exception {
URL feedUrl = new URL(feedUrlString);
Query myQuery = new Query(feedUrl);
myQuery.setMaxResults(800);
ContactFeed resultFeed = myService.query(myQuery, ContactFeed.class);
// Print the results
System.out.println(resultFeed.getTitle().getPlainText());
for (ContactEntry entry : resultFeed.getEntries()) {
if (entry.getContent() != null) {
updateNotesContent(myService, entry);
}
}
}
private static void updateNotesContent(ContactsService myService, ContactEntry entry) throws Exception {
TextContent textContent = (TextContent) entry.getContent();
if (textContent.getContent() != null) {
String plainText = textContent.getContent().getPlainText();
if (plainText != null && plainText.startsWith("<HTCData>")) {
String newPlainText = "";
textContent.setContent(new PlainTextConstruct(newPlainText.trim()));
entry.setContent(textContent);
URL editUrl = new URL(entry.getEditLink().getHref());
ContactEntry contactEntry = myService.update(editUrl, entry);
System.out.println(entry.getName().getFullName().getValue() + " " + "Updated: " + contactEntry.getUpdated().toString());
}
}
}
}
I have executed the above program and tested it. You need gdata lib files:
gdata-media-1.0.jar
gdata-client-meta-1.0.jar
gdata-contacts-3.0.jar
gdata-client-1.0.jar
gdata-contacts-meta-3.0.jar
gdata-core-1.0.jar
guava-14.0.1.jar
gdataplugin.jar -- I am not sure what this jar does, even if it is required or not.
This is a bit complex for some users to run a java program, this way you will not loose the chat invites and other important information of your contact.
Note: Even if I have tested above program 10 times, I would not give any guaranty it will work for you.
- CAM
Click to expand...
Click to collapse
P1nGu1n_ said:
Your Java program worked!
I attached all the required libraries in a .zip-file. Include them in your Java project and copy the code from cmehta82 post above.
Replace <Your Gmail Id> with your emailadress:
Replace <Your Password> with your application specific password, generated at https://accounts.google.com/b/0/IssuedAuthSubTokens#accesscodes
Replace the feed URL string with https://www.google.com/m8/feeds/contacts/default/full
Click to expand...
Click to collapse
Where do you configure the app name and password?>
ginorp said:
I just sat down on my break and created this code to strip out the HTC tags from the contact notes:
Code:
Sub HTCbGone()
Dim objContactsFolder As Outlook.MAPIFolder
Dim objContacts As Outlook.Items
Dim objContact As Object
Dim StartPos As Integer
Dim EndPos As Integer
Dim iCount As Integer
' Specify with which contact folder to work
Set objContactsFolder = _
Session.GetDefaultFolder(olFolderContacts)
Set objContacts = objContactsFolder.Items
iCount = 0
' Process the changes
For Each objContact In objContacts
If TypeName(objContact) = "ContactItem" Then
StartPos = InStr(objContact.Body, "<HTCData>")
EndPos = InStr(objContact.Body, "</HTCData>") + 10
If StartPos > 0 Then
If StartPos = 1 Then
If Len(EndPos) > EndPos + 1 Then
objContact.Body = Mid(objContact.Body, EndPos + 1)
Else
objContact.Body = ""
End If
Else
If Len(EndPos) > EndPos + 1 Then
objContact.Body = Left(objContact.Body, StartPos = 1)
Else
objContact.Body = Left(objContact.Body, StartPos - 1) & Mid(objContact.Body, EndPos + 1)
End If
End If
iCount = iCount + 1
objContact.Save
End If
End If
Next
' Display the results
MsgBox "Number of contacts updated:" & Str$(iCount), , _
"HTCbGone Finished"
' Clean up
Set objContact = Nothing
Set objContacts = Nothing
Set objContactsFolder = Nothing
End Sub
To run this, I opened Outlook. Selected Macro(s) from the Tools pull-down menu (or press [ALT+F8]). Created a new Macro called HTCbGone and pasted this code over everything. Then I just ran it.
Use at your own risk.
Happy scripting,
GinoRP
Click to expand...
Click to collapse
Sorry for this reply in this old thread, but you might lose data running the VBA code from GinoRP. I found a lot of small mistakes.
Here is the corrected code. You can run it multiple times if there is more than one <HTCData> tag in a specific contact.
Code:
Sub HTCbGone()
Dim objContactsFolder As Outlook.MAPIFolder
Dim objContacts As Outlook.Items
Dim objContact As Object
Dim StartPos As Integer
Dim EndPos As Integer
Dim iCount As Integer
' Specify with which contact folder to work
Set objContactsFolder = _
Session.GetDefaultFolder(olFolderContacts)
Set objContacts = objContactsFolder.Items
iCount = 0
' Process the changes
For Each objContact In objContacts
If TypeName(objContact) = "ContactItem" Then
StartPos = InStr(objContact.Body, "<HTCData>")
EndPos = InStr(objContact.Body, "</HTCData>") + 10
If StartPos > 0 Then
If StartPos = 1 Then
If Len(objContact.Body) > EndPos + 1 Then
objContact.Body = Mid(objContact.Body, EndPos)
Else
objContact.Body = ""
End If
Else
If Len(objContact.Body) = EndPos - 1 Then
objContact.Body = Left(objContact.Body, StartPos - 1)
Else
objContact.Body = Left(objContact.Body, StartPos - 1) & Mid(objContact.Body, EndPos)
End If
End If
iCount = iCount + 1
objContact.Save
End If
End If
Next
' Display the results
MsgBox "Number of contacts updated:" & Str$(iCount), , _
"HTCbGone Finished"
' Clean up
Set objContact = Nothing
Set objContacts = Nothing
Set objContactsFolder = Nothing
End Sub
Hi,
I'm having a hard time for, what I guess, is a simple question...
Here is the code I'm using to render the amChart
In short, my situation is tha the chart always renders the same datapoints...and there is no way I can change them!
Code:
Dim Y_Value_0 As Double = 0.0
Dim Y_Value_1 As Double = 0.0
Dim Y_Value_2 As Double = 0.0
Dim Y_Value_3 As Double = 0.0
Dim Y_Value_4 As Double = 0.0
Public Class ItemValues
Public Property Range() As String
Public Property Value() As Double
End Class
Private DataPoints As New ObservableCollection(Of ItemValues)() From
{New ItemValues() With {.Range = "200", .Value = Y_Value_0}, _
New ItemValues() With {.Range = "400", .Value = Y_Value_1}, _
New ItemValues() With {.Range = "600", .Value = Y_Value_2}, _
New ItemValues() With {.Range = "800", .Value = Y_Value_3}}
Public ReadOnly Property Data() As ObservableCollection(Of ItemValues)
Get
Return DataPoints
End Get
End Property
Private Sub Page_Graphs_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
Me.Fill_Graph()
End Sub
Private Sub Fill_Graph()
Y_Value_0 = -5
Y_Value_1 = -10
Y_Value_2 = -20
Y_Value_3 = -50
Me.DataContext = Me
End Sub
However, there is no way, that when the chart is rendered it takes the new values...
In short, how to make the graph to take my data points?
Thanks in advance for any help!
You need to use INotifyPropertyChanged interface so the databound control knows when to update itself.
http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx
Check out the "Windows Phone Databound Application" template installed by default if you want to see a working project. It uses a listbox but it's the same concept.
I have developped 2 Android applications. The first one, to write into an NFC tag, and the second to read the contents I have written .
This is what i did in the first application (WriteNFC)
private NdefRecord createRecord1(String data)
{
byte[] payload = data.getBytes(Charset.forName("UTF-8"));
byte[] empty = new byte[] {};
return new NdefRecord(NdefRecord.TNF_ABSOLUTE_URI, empty, empty, payload);
}
private NdefRecord createRecord2(String data)
{
byte[] payload = data.getBytes(Charset.forName("UTF-8"));
byte[] empty = new byte[] {};
return new NdefRecord(NdefRecord.TNF_ABSOLUTE_URI, payload, empty, empty);
}
And for in the second application (ReadNFC)
NdefRecord cardRecord = msg.getRecords()[1];//Extract the second Record
String url_data = new String(cardRecord.getType());//Read data type
Result:
When I read with my own application (ReadNFC), of course I had on screen only the payload of the second Record, which I stored through "Record Type". But with a third-party application, especially that natively installed ("tag"), It display correctly the first record, and for the second it's an empty field. How can I hide this field. Otherwise, how can I force the other third-party applications to not read the second record?