Friday, October 31, 2008

Windows Mobile API ToolBar

Today I'd like to make some suggestion about CCommandBar class for Windows Mobile 5.0.
Actually when you need a menu in MFC application you should use it or native WINAPI function to have access to the ToolBar


CCommandBar class has no API to access to menu items and don't know how to operate to them so after brief investigation and experiments with menu I have got working code:
 TBBUTTON tbb;
 ::SendMessage(      m_oCommandBar.GetSafeHwnd(),     TB_GETBUTTON, 1, (LPARAM)&tbb);
 HMENU hMenu=HMENU(tbb.dwData);
 if(hMenu)
 {
     ::DeleteMenu(hMenu,0,MF_BYPOSITION);     ::InsertMenu(hMenu,0,MF_BYPOSITION, ID_MENU_FR_SHOWDETAILS, L"Show Details");
 }


Here m_oCommandBar is an instance of CCommandBar.With this trick you can access to WINAPI menu to create dynamic menus :-)

Thursday, October 9, 2008

WMI database

Hi there !
I'd like to tell you about WMI

It's a pretty huge database with common API to access to the hardware/software information

It contains different information about operating system and hardware. For example computer name, tcp/ip address, dns and dhcp information and many other keys that are nessesary for normal working.

Also I notice that it builds as a COM service and it is available from different langualges C++, C, Pascal, Visula Basic and scripts such as VBSctipt. 

According to C++ to invoke a method we need to do alot of work. So I show you how to use:

I have created two classes: first is for read properties, second to invoke methods.

WMI devided to several groups and each group contain classes:

For example Network group contains of NetworkAdapter, NetworkAdapterConfigurator

It's not a c++ classes. actually it is description to the class wich you can use with not C++ languages.