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.

Tuesday, September 23, 2008

small annoying bugs :-(

Sometimes when you debug a code, You don't espect a bug in project settings and spand a lot of time to correct program


some suggestion that may help with it. All this is very important and actual for mobile development


1. All resources line memory allocation, files, etc., you need to put in a wrapper
for example


2. All unexpected behavior line "low memory" should raise exception and exit


class MyDataBlock
{
   MyDataBlock():mData(NULL){}
   MyDataBlock():mData(int size)
   {
      ASSERT(size>0,"wrong size");
      mData = new char[size];
      ASSERT(mData,"low memory");
   }

   ~MyDataBlock()
   {
      delete[] mData;
   }
}

3. Logs

About logs I have two things :
  • developers logs - you ,ust have it when there is no debug mode. For example when you create driver or something very specific and all that you can is to print a message to file or to screen
  • log stack. When application crashes it is very useful to have functions call stack. It gives you information about case when error (crash bug) happened

Thursday, July 31, 2008

Factorial calculation

Hello!
Yestarday I have implemented program that calculates 2347! = 1*2*...*2347
It is  really big number that holds 10000 digits
I will public it in the next posts. One thing I observed is: I like to create a really small programs..

Tuesday, July 22, 2008

User activity

I'd like to create a user activity driver

It will have two modes:

-in the first mode it collect data drom user (mouse and keyboard) and store them to local file

-in the second mode it reproduce data from the file, so we could have a very small sized video demonstration.

Thursday, July 17, 2008

Folder monitor

I'd like to implement folder monitor. I think it should be easy because in win32 there is a API for this. Also I could do this via driver...

Wednesday, July 16, 2008

Internet browser

I am going to use internet Browser in
my own application

In this case I'll have different GUI with minor changes in the code

Thursday, July 10, 2008

TimerLogger

I'd like to implement TimeLogger. It's a program to log your working time

Compiler for STOLL

Actually now I can explain only excpression analizer but I am working to understand whole compilation process