|
Thank you
Thank you
Thank you
Thank you
camasmartin
hobby programmer
|
|
|
|
|
Hi,
I'm programming with eVC++ 4 and have the following problem:
My program should use an INI file to read and write several values. To read/write I will use the functions GetProfileString and WriteProfileString (class CWinApp). But each call of this functions failed.
I use the following code (exactly like MSDN and eVC++ helpfile) :
BOOL CMyApp::InitInstance()
{
free((void*) m_pszProfileName );
m_pszProfileName = _tcsdup(_T("/Temp/COMConn.ini"));
...
}
void CDlgClass::ReadIniFile()
{
CString csValue;
...
AfxGetApp()->WriteProfileString(_T("Connect"), // Section
_T("Name"), // Key
_T("MyConnect") ); // Value to write
csValue = AfxGetApp()->GetProfileString(_T("Connect"), // Section
_T("Name"), // Key
_T("Error") ); // Default
...
}
The ini file /Temp/COMConn.ini exists, but each call of WriteProfileString() returns FALSE and each call of GetProfileString() returns "Error".
Why failed every access ?
Please help me (fast).
Thank You
Rico
|
|
|
|
|
These methods only work with the registry. To use an ini file, you will have to roll your own (like I did).
Regards,
João Paulo
|
|
|
|
|
Hi
I know embedded Visual C++ compiler do not accept return statements in this __try and __finally. but i need to return different conditions(values) at different parts of the __try / __finally block, how shall i go about doing it?
Need this help urgently.
Thanx
|
|
|
|
|
Hi ,
On the PDA's calendar, I want to add a new item in the menu(when I hold the Stylus for a brief time).
Where can I found its entry in the registry? Or is there any other way with which I can achieve this?
Regards
Ankukr
|
|
|
|
|
Check the online help file under Extending Pocket Outlook Menus.
Quote:
The Calendar, Tasks, and Contacts applications support menu add-ins for external applications. If you provide an add-in for one of these applications, your menu item appears on the Tools menu. When the user selects your menu item, Pocket Outlook calls a function in a registered DLL, which passes the object identifiers of the currently selected items in the application.
To register your application, create a registry key under the following key:
Software\Microsoft\PimApps\PimExtensions\pim_app\AddIns
You can use any name that you want for the key. To avoid conflicts with other add-ins, we suggest that the key contain the name of your company. Replace pim_app with Contacts, Tasks, or Calendar, depending on which application’s menu you want your add-in to appear on.
After you create this key, you need to create two values for the key. The first value is DLL, which you set to the name of your DLL. The second value is Menu, which you set to the name that you want displayed on the Tools menu. Others may add tools items, so you should try to create a unique, descriptive, and mnemonic name that will distinguish your application.
For example, the following registry key would register a phone-dialer application in the Contacts application:
Software\Microsoft\PimApps\PimExtensions\Contacts\AddIns\MicrosoftDialer<br />
DLL: dialer.dll<br />
Menu: "Dial Contact"
The registered DLL must expose the CePimCommand function, which is called automatically when the user chooses the menu command.
Regards,
João Paulo
|
|
|
|
|
For Pocket PC 2003, look under Adding Menu Commands for External Applications.
Quote:
The Calendar, Tasks, and Contacts applications support menu add-ins for external applications. If you provide an add-in to one of these applications, your command will appear on the Tools menu. When the user selects your command, a function in a registered DLL will be called, passing in the object identifiers of items that were selected in the application at the time the menu item was selected.
To register your application, you need to create a registry key under the HKEY_LOCAL_MACHINE root. To avoid conflicting with other add-ins, it is suggested that the key you choose contain your company's name. PIMAPP should be replaced with Contacts, Tasks, or Calendar depending on which application you want your menu to appear in.
To create a menu add-in
Register your application by creating a registry. The registry will exist in the following key, and can be named whatever you want:
HKEY_LOCAL_MACHINE\Software\Microsoft\PimApps\PimExtensions\PIMAPP\AddIns
Create an entry under this key, DLL, where the value of the entry is the name of your DLL.
Create a second entry, Menu, in which the value of the entry is the menu name you want displayed from the Tools menu.
The DLL that you register must expose the CePimCommand function, which will be called when the user selects your command. The following code sample shows the exposed function:
void CePimCommand (HWND hWnd, PIMTYPE ptData, UINT uDataCount,
*rghData, void *pReserved);
PIMTYPE is an enumeration, defined as follows:
typedef enum tagPIMTYPE
{
PT_CALENDAR = 0,
PT_TASKS,
PT_CONTACT
} PIMTYPE;
The following table shows parameters associated with the CePimCommand function.
Parameter Comments
HWND hWnd Application window handle
PIMTYPE ptData The application that is calling this function
UINT uDataCount The number of items in the array rghData
HANDLE *rghData An array of Microsoft Windows CE object identifiers indicating which items are currently selected
void *pReserved Reserved parameter
You can manipulate items from their object identifiers by calling the GetItemFromOid method in the Application object. You can use GetOidFromRef for menu extensibility.
Regards,
João Paulo
|
|
|
|
|
Another noob question, I'm afraid.
What's the typical color depth of a PPC 2002 or 2003 PDA or Smartphone display ? I'm curious - I don't have access to hardware, just the emulator, and I'm wondering how to handle graphics code.
|
|
|
|
|
The typical color depth for displays is 16 bit (actually 15: 5 bits per basic color). You can also find some equipments with 12 bit color.
You should only concern yourself with this if you are using direct screen access (GAPI).
Regards,
João Paulo
|
|
|
|
|
João Paulo Figueira wrote:
You should only concern yourself with this if you are using direct screen access (GAPI).
I was wondering whether GDI code should be written to accomodate 8bpp displays; ie, whether or not it should support a palette.
Thanks for the response.
|
|
|
|
|
I have to be able to open and display the text of pocket word, pocket excel files in my app.
I know there is no Pocket Automation available.
Is there any other suggestion to go about it?
Any help is very much appreciated.
I am using evc++ 3/4 and Pocket PC 2002/2003 for my development.
thanks for you time
|
|
|
|
|
Hi,
Do you want to create a pocket excel file from your application? or you just want to display it ?
Mahesh Varma
|
|
|
|
|
I want to be able to display only.....
Thanks!
|
|
|
|
|
Hi, I'm using EVC++ 3.0 to develop an iPaq using PocketPC 2002 Premium.
I have a problem with my menu on my single dialog application. I have a Menu with two selections on it: 15 Seconds and 30 Seconds.
I want to place a checkmark next to the item the user selects but I want '15 Seconds' to be checked initially. It's not working though.
Here's my OnInitDialog(). (Note: Extranious garbage removed)
BOOL CMyDialogDlg::OnInitDialog()
{
...
// TODO: Add extra initialization here
CCeCommandBar *pCommandBar = (CCeCommandBar*)m_pWndEmptyCB;
pCommandBar->InsertMenuBar(IDR_CHIPMENU);
// if( pCommandBar->IsDlgButtonChecked( ID_TIMEOUT_15SECONDS ) )
pCommandBar->CheckDlgButton( ID_TIMEOUT_15SECONDS, BST_CHECKED);
...
return TRUE; // return TRUE unless you set the focus to a control
}
The menu is there and works but I can not set a check mark next to any of the items. The IDs are correctly spelled, too. I've set a message up for clicking on '15 Seconds' and it correctly reports the state the label is in (Ie: checked or unchecked). Here:
void CMyDialogDlg::OnTimeout15seconds()
{
CCeCommandBar *pCommandBar = (CCeCommandBar*)m_pWndEmptyCB;
if( pCommandBar->IsDlgButtonChecked( ID_TIMEOUT_15SECONDS ) )
{
pCommandBar->CheckDlgButton( ID_TIMEOUT_15SECONDS, BST_UNCHECKED);
AfxMessageBox(_T("Unchecked"));
}
else
{
pCommandBar->CheckDlgButton( ID_TIMEOUT_15SECONDS, BST_CHECKED);
AfxMessageBox(_T("Checked"));
}
/**/
}
What am I doing wrong/missing?
Thanks.
|
|
|
|
|
Well, just so everyone knows...
I got it. Finally. (Stupid MSDN Docs!)
Here's what I did.
After creating my menu and giving appropriate IDs and such... (ID_TIMEOUT_blah, etc)
I created a member var in my dialog class: CMenu* m_menu; //private, of course.
In my OnInitDialog():
CCeCommandBar *pCommandBar = (CCeCommandBar*)m_pWndEmptyCB;
m_menu = pCommandBar->InsertMenuBar(IDR_CHIPMENU);
m_menu->CheckMenuRadioItem( ID_TIMEOUT_15SECONDS, ID_TIMEOUT_5MINUTES, ID_TIMEOUT_15SECONDS, MF_BYCOMMAND);
Then, I created Message Handlers. In OnTimeout15Seconds, I placed:
//SELECT THE APPROPRIATE MENU ITEM
m_menu->CheckMenuRadioItem( ID_TIMEOUT_15SECONDS, ID_TIMEOUT_5MINUTES, ID_TIMEOUT_15SECONDS, MF_BYCOMMAND);
If you look in the documentation(when you can get it to show every-fn-thing related to CMenu (Initially, MSDN only showed 4 methods. There is about 20)), you'll see what CheckMenuRadioItem does.
InsertMenuBar returns a CMenu*. Given the range of IDs and the one to select, CheckMenuRadioItem Deselects the non-clicked ones and sets a checkmark next to the clicked menu item.
Enjoy!
|
|
|
|
|
Anyone have any experience with a licensing/copy protection system that works with PDA apps? Looking for a recommendation.
|
|
|
|
|
strange things happen....
i wrote a PPC02-C++-MFC app that reads html-files and shows them (including images and links). I used a lib called CSHTMLDialog by Vassili Philippov, which is based on the htmlview-lib.
Every now and them, mostly when i click on a part of the screen where the html is shown, my app just disappears. it seems that it is closed and even with a task-manager (DTSysView), there is nothing left from my app.
I cannot simulate the error, it usually doesn't happen the next time i do the same.
In general, has anybody ever had that kind of problem? what could be the potential reason?
thx for any hints...
thx, Daniel
|
|
|
|
|
I tried to edit data by calling this query:
CString Query = "Update Points SET X = 12 WHERE PointID = 1";
CADORecordset rs(&g_db);
rs.Open(Query,CADORecordset::openQuery);
And I Got nothing changed.
|
|
|
|
|
No, it doesn't work like that. If you look ath the online help you will see that the only DML statements that are accepted are DELETE , INSERT and SELECT .
To achieve what you want, open recordset using something like:
CString Query = "SELECT X FROM Points WHERE PointID=1";
CADORecordset rs(&g_db);
rs.Open(Query,CADORecordset::openQuery);
rs.SetFieldValue(_T("X"), 12);
Regards,
João Paulo
|
|
|
|
|
I am in the process of creating an activex control for PocketPC. I am having problem in getting a focus rectangle when a button in the control gets focus.
Any help?
|
|
|
|
|
The Pocket PC does not show a focus rectangle like you see on the desktop.
Regards,
João Paulo
|
|
|
|
|
If PocketPC doesnot show FocusRect, then is there any way we change the control appearance to show th euser that control has got the focus? Any idea on this ?
|
|
|
|
|
When you click a button, it retains its focused state (unless you change it). This is visually shown as a double border (even if you tab through a series of buttons).
Regards,
João Paulo
|
|
|
|
|
João Paulo Figueira wrote:
When you click a button, it retains its focused state (unless you change it). This is visually shown as a double border (even if you tab through a series of buttons).
Hi,
Thanks for the reply.
But when I create BUTTON control in eVC++ , it does not reflect the border when it is in focus( particularly when I test the ocx in eVB). The objective is to use the button ocx in eVB, so that when the user navigates through keyboard in PocketPC, the focus status is shown.
The following code draws the focus rect when in focus, but the application crashes after the focus is lost.
void CMfcnewCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC *pdc;
CPen* pOldPen;
CRect rcSrcBounds;
RECT rect;
SHORT inflate;
pdc = CDC::FromHandle(lpDrawItemStruct->hDC);
switch (lpDrawItemStruct->itemAction)
{
case ODA_DRAWENTIRE:
case ODA_SELECT:
case ODA_FOCUS:
// Just draw focus rect
pOldPen = (CPen*)pdc->SelectStockObject(BLACK_PEN);
if (lpDrawItemStruct->itemState & ODS_FOCUS)
{
CopyRect((LPRECT)&rect, (LPRECT)&lpDrawItemStruct->rcItem);
inflate = (SHORT)min(3,min(rect.right - rect.left + 1,
rect.bottom - rect.top + 1) / 5);
InflateRect(&rect, -inflate, -inflate);
pdc->DrawFocusRect(&rect);
}
pdc->SelectObject(pOldPen);
break;
}
}
|
|
|
|
|
Why My pocket PC makes new columns with counter???
For example i have the table with columns:
PointID - counter;
X int;
Y int;
and when i copy this database to pocket and get it back to Desktop PC i got this:
Point ID - int;
X -int;
Y -int;
ID1 - counter;
Where is the problem???
|
|
|
|
|