2009年4月9日星期四

MSDN里关于WinMain的描述

WinMain Function
The WinMain function is called by the system as the initial entry point for a 视窗系统-based application.
Syntax
int WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
);
Parameters
hInstance
[in] Handle to the current instance of the application.
hPrevInstance
[in] Handle to the previous instance of the application. This parameter is always NULL. If you need to detect whether another instance already exists, create a uniquely named mutex using the CreateMutex function. CreateMutex will succeed even if the mutex already exists, but the function will return ERROR_ALREADY_EXISTS. This indicates that another instance of your application exists, because it created the mutex first.
lpCmdLine
[in] Pointer to a null-terminated string specifying the command line for the application, excluding the program name. To retrieve the entire command line, use the GetCommandLine function.
nCmdShow
[in] Specifies how the window is to be shown. This parameter can be one of the following values.
SW_HIDE
Hides the window and activates another window.
SW_MAXIMIZE
Maximizes the specified window.
SW_MINIMIZE
Minimizes the specified window and activates the next top-level window in the Z order.
SW_RESTORE
Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
SW_SHOW
Activates the window and displays it in its current size and position.
SW_SHOWMAXIMIZED
Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED
Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE
Displays the window as a minimized window. This value is similar to SW_SHOWMINIMIZED, except the window is not activated.
SW_SHOWNA
Displays the window in its current size and position. This value is similar to SW_SHOW, except the window is not activated.
SW_SHOWNOACTIVATE
Displays a window in its most recent size and position. This value is similar to SW_SHOWNORMAL, except the window is not actived.
SW_SHOWNORMAL
Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
Return Value
If the function succeeds, terminating when it receives a WM_QUIT message, it should return the exit value contained in that message’s wParam parameter. If the function terminates before entering the message loop, it should return zero.
Remarks
Your WinMain should initialize the application, display its main window, and enter a message retrieval-and-dispatch loop that is the top-level control structure for the remainder of the application’s execution. Terminate the message loop when it receives a WM_QUIT message. At that point, your WinMain should exit the application, returning the value passed in the WM_QUIT message’s wParam parameter. If WM_QUIT was received as a result of calling PostQuitMessage, the value of wParam is the value of the PostQuitMessage function’s nExitCode parameter. For more information, see Creating a Message Loop.
ANSI applications can use the lpCmdLine parameter of the WinMain function to access the command-line string, excluding the program name. The reason that WinMain cannot return Unicode strings is that lpCmdLine uses the LPSTR data type, not the LPTSTR data type. The GetCommandLine function can be used to access Unicode strings in the command line, because it uses the LPTSTR data type.
Function Information
Header
Declared in Winbase.h, include 视窗系统.h
Import library
None
Minimum operating systems
视窗系统 95, 视窗系统 NT 3.1
See Also
视窗系统 Overview, CreateMutex, DispatchMessage, GetCommandLine, GetMessage, PostQuitMessage, TranslateMessage

2009年1月24日星期六

链表倒转函数.

  code*   inverse(code*   head)     //逆向输出   
  {   
                  code*   p1;   
                  code*   p2;   
    
                  if(head   &&   head->next)   //超过2个结点   
                  {   
                                  p1=head;   
                                  p2=head->next;   
                  }   
                  else   
                                  exit(1);   
    
                  while(p2!=NULL)     //head   记录头结点,p1记录将处理的前一个结点,p2记录处理的结点   
                  {   
                                  p1->next=p2->next;   
                                  p2->next=head;   
                                  head=p2;   
                                  p2=p1->next;   
                  }   
    
                  return   head;   
  }   

2008年11月19日星期三

gdb中 自动按照虚方法调用的规则 显示输出的方法

set print object on --> 在C++中,如果一个对象指针指向其派生类,如果打开这个选项,GDB会自动按照虚方法调用的规则 显示输出,如果关闭这个选项的话,GDB就不管虚函数表了。这个选项默认是off。

2008年8月20日星期三

我写的按日期归类的哈希表

memset(pAppletData->fullpath,0,PHOTO_MAX_PATH);
sprintf(pAppletData->fullpath,"%s%s",pAppletData->selectpath,entry->d_name);

if(pAppletData->filepStat == ListHead)
{
//creat
pS =(FiledataNode *)OS_Malloc(sizeof(FiledataNode));
pS->next = NULL;
pS->index = index;
//get entry data
strcpy(pS->fullpath,pAppletData->fullpath);
// strcat(pS->fullpath,entry->d_name);
// OS_TaskDelay(10);
#ifdef WIN32
pS->datetime = i%8;
sprintf(pS->datetime_name, "%d-%d-%d",i%8,i%8,i%8);

#else

ufs_stat(pAppletData->fullpath, &f_stat);
filedate = f_stat.st_mtime;
AF_PRINTF("fullpath: %s, \r\nyear(%d), month(%d), date(%d) \r\n",pAppletData->fullpath,(1980 + filedate.year),filedate.month,filedate.day);
pS->datetime = 19800000 + filedate.year*10000 + filedate.month*100 + filedate.day;
AF_PRINTF("----------------------------name =%s index =%d\n",pS->fullpath,pS->index);
sprintf(pS->datetime_name, "%d-%d-%d",(1980 + filedate.year),filedate.month,filedate.day);
#endif

// strcpy(pS->datetime_name,pAppletData->pSVirtualDirArray->datetime_name);

pSVirtualDirArray = (VirtualDirArray *)OS_Malloc(sizeof(VirtualDirArray));
pSVirtualDirArray->next = NULL;
pHeadVirtualDirArray = pSVirtualDirArray;
pSVirtualDirArray->childNode = pS;
pSVirtualDirArray->datetime = pS->datetime;
strcpy(pSVirtualDirArray->datetime_name,pS->datetime_name);

pAppletData->nfilesCount++;
pAppletData->totalEntriesCount++;
pAppletData->filepStat = ListBody;

}
else //Body
{
pS =(FiledataNode *)OS_Malloc(sizeof(FiledataNode));
pS->next = NULL;
pS->index = index;

//get fullpath and Time data
strcpy(pS->fullpath,pAppletData->fullpath);
// strcat(pS->fullpath,entry->d_name);
//OS_TaskDelay(10);
// AF_PRINTF("----------------------------name =%s index =%d\n",pS->fullpath,pS->index);
#ifdef WIN32
pS->datetime = i%8;
sprintf(pS->datetime_name, "%d-%d-%d",i%8,i%8,i%8);
#else

ufs_stat(pAppletData->fullpath, &f_stat);
filedate = f_stat.st_mtime;
AF_PRINTF("fullpath: %s, \r\nyear(%d), month(%d), date(%d) \r\n",pAppletData->fullpath,(1980 + filedate.year),filedate.month,filedate.day);
pS->datetime = 19800000 + filedate.year*10000 + filedate.month*100 + filedate.day;
AF_PRINTF("----------------------------name =%s index =%d\n",pS->fullpath,pS->index);
sprintf(pS->datetime_name, "%d-%d-%d",(1980 + filedate.year),filedate.month,filedate.day);
#endif

pSVirtualDirArray = pHeadVirtualDirArray;
findout = FALSE;
while(pSVirtualDirArray->next != NULL)
{
//time same

if (pSVirtualDirArray->datetime == pS->datetime)

{
FiledataNode *temp;
temp = pSVirtualDirArray->childNode;
pSVirtualDirArray->childNode = pS;
pS->next = temp;
findout = TRUE;
break;
}
pSVirtualDirArray = pSVirtualDirArray->next;
}
//the last one
if(pSVirtualDirArray->next == NULL)
{
if (pSVirtualDirArray->datetime == pS->datetime)
{
FiledataNode *temp;
temp = pSVirtualDirArray->childNode;
pSVirtualDirArray->childNode = pS;
pS->next = temp;
findout = TRUE;
}
}
if(findout != TRUE)
{
pSVirtualDirArray->next = (VirtualDirArray *)OS_Malloc(sizeof(VirtualDirArray));
pSVirtualDirArray = pSVirtualDirArray->next;
pSVirtualDirArray->next = NULL;
pSVirtualDirArray->childNode = pS;
pSVirtualDirArray->datetime = pS->datetime;
strcpy(pSVirtualDirArray->datetime_name,pS->datetime_name);
AF_PRINTF("fullpath: %s\r\n",pAppletData->fullpath);

}
pAppletData->nfilesCount++;
pAppletData->totalEntriesCount++;
pAppletData->filepStat = ListBody;
}

// if (pAppletData->nfilesCount==pAppletData->nfiles)
if ((i + 1) ==(pAppletData->totalEntries-1))
{
VirtualfolderSort(pHeadVirtualDirArray);
pAppletData->pHeadVirtualDirArray = pHeadVirtualDirArray;

pSVirtualDirArray = pHeadVirtualDirArray;

//count how many virual dir is.
for ( pAppletData->nVirualdirs = 0;pSVirtualDirArray != NULL;pAppletData->nVirualdirs++)
{
pSVirtualDirArray = pSVirtualDirArray->next;
}
}

2008年6月3日星期二

注定单身

赞。
平静而充实,这就是单身生活最佳的状态。
爱上一些转身,然后离开,不断与瞬间的暧昧,从不奢求也不期待。就像坐着公车路过,偶然惊鸿一瞥,再眨眼已然消逝。自己也不怅然,只需转过头,看另一边车窗外还会有怎样的景色,面带微笑。

2008年5月13日星期二

C语言 单向链表选择法排序

typedef struct FiledataNode
{
char FileName[256]; // the length is 256 for filename, liangls
char datetimeOriginal[20];
char fullpath[PHOTO_MAX_PATH];
/*other item*/
struct FiledataNode *prior;
struct FiledataNode *next;
}FiledataNode;


AF_ERROR_CODE VirtualfolderSort(FiledataNode *phead)
{
FiledataNode *i,*j,*t,*p,*max,tmp;

if(phead == NULL)
return AF_STATUS_FAIL;

p=phead;
for(i=p;i->next!=NULL;i=i->next)
{
max=i;
for(j=i->next;j!=NULL;j=j->next)
{
if(j->datetimeOriginal[0] > max->datetimeOriginal[0] )
{
max = j;
if(max->datetimeOriginal[0] != i->datetimeOriginal[0])
{
tmp = *max;
*max = *i;
*i = tmp;
t = max->next;
max->next= i->next;
i->next = t;
max = i;
}
}

}
}
while(p->next != NULL)
{
AF_PRINTF("%s",p->datetimeOriginal);
p = p->next;
}
AF_PRINTF("%s",p->datetimeOriginal);

return (phead);

}

2008年5月11日星期日

男人探戈教学(搞笑)

嗯嗯,两个都不错~!

2008年5月5日星期一

西班牙舞蹈简介

一般人提到西班牙,大概马上会联想到斗牛及佛朗明哥。 然而西班牙的舞蹈,并不不只有佛朗明哥一种,依据其年代、渊源、形态、地域, 全西班牙的舞蹈共分为四大类:


一.西班牙各地区的地方舞蹈(danzas regionales)。 例如:fandango vasco舞、aurresku舞、 ezpatadantza舞(arin-arin)以上属于巴斯克舞蹈。 verdiales舞属于马拉加(Málaga)舞蹈。 Sardana舞属于巴塞隆纳(Barcelona)舞蹈。 Charrada picada舞属于沙拉孟加(Salamanca)舞蹈。 Jota antillón舞、jotaj alcañiz舞、 jota albalte舞属于阿拉贡(Aragón) 舞蹈…等。


二.波丽露部门舞蹈(Escuela Bolera)。 k例如:sevillana bolera舞属于塞维亚 (Sevilla) 舞蹈, Malagueñal舞属于马拉加 (Málaga) 舞蹈, Olé de la Curra舞属于卡斯帝亚 (Castilla) 舞蹈… 等各地区都有他的波丽露舞蹈。


三.佛朗明哥舞蹈(Flamenco)。 例如:soleares舞、bulería舞、alegría舞、caracoles舞、 tango舞、tiento舞、 seguiriya (siguiriya)(seguidilla)舞、 guajira舞、farruca舞、caña舞、zapateado舞… 有二十多种舞蹈。 其发源地是安达鲁西亚 (Andalucía),位于西班牙南部。


四.古典西班牙舞蹈 (Clásico español)。 例如:Córdoba舞、Polo Gitano舞、Andaluza舞、 Goyescas舞…等等。 此类舞蹈繁多,最主要以近代的音乐家所做的音乐为主要题材。


其实所谓的Flamenco是由三个部份所组成:cante (歌)、 baile (舞)及toque (吉它弹奏)。 一般认为Flamenco是由gitanos (吉普赛人) 所创造出来的, 但不容否认, 西班牙历代居住在Andalucía的民族或多或少对flamenco都有影响。 从原住民tartesos, árabes到后来发展出来的Andalucía民间的舞蹈、歌唱等。

2008年4月25日星期五

以寂寞开始我的假期

错过了版聚

错过了MIX

也可能错过了很多别的美好的东西。

以寂寞开始我的假期

2008年4月24日星期四

忙完了这个阶段的工作,开始假期

从4月26日开始休息到5月4日,好长的一个假期。

现在还不知道做点什么好~