Esempio n. 1
0
//
//	Generic WM_NOTIFY handler for all other messages
//
UINT NotifyHandler(HWND hwnd, NMHDR *nmhdr)
{
	NMMOUSE *nmmouse;
	UINT	 nMode;

	switch(nmhdr->code)
	{
	case NM_DBLCLK:

		// statusbar is the only window at present which sends double-clicks
		nmmouse = (NMMOUSE *)nmhdr;

		// toggle the Readonly/Insert/Overwrite mode
		if(nmmouse->dwItemSpec == 2)
		{
			nMode   = TextView_GetEditMode(g_hwndTextView);
			nMode	= (nMode + 1) % 3;
	
			TextView_SetEditMode(g_hwndTextView, nMode);
		
			SetStatusBarText(g_hwndStatusbar, 2, 0, g_szEditMode[nMode]);
		}

		break;

	default:
		break;
	}	

	return 0;
}
Esempio n. 2
0
BOOL
InitControls(HWND hwnd)
{
    if (SettingsInfo.bSaveWndPos)
    {
        MoveWindow(hwnd, SettingsInfo.Left, SettingsInfo.Top,
                   SettingsInfo.Right - SettingsInfo.Left,
                   SettingsInfo.Bottom - SettingsInfo.Top, TRUE);

        if (SettingsInfo.Maximized) ShowWindow(hwnd, SW_MAXIMIZE);
    }

    if (CreateStatusBar(hwnd) &&
        CreateToolBar(hwnd) &&
        CreateListView(hwnd) &&
        CreateTreeView(hwnd) &&
        CreateRichEdit(hwnd) &&
        CreateVSplitBar(hwnd) &&
        CreateHSplitBar(hwnd))
    {
        WCHAR szBuffer1[MAX_STR_LEN], szBuffer2[MAX_STR_LEN];

        InitApplicationsList();

        InitCategoriesList();

        LoadStringW(hInst, IDS_APPS_COUNT, szBuffer2, sizeof(szBuffer2) / sizeof(WCHAR));
        swprintf(szBuffer1, szBuffer2, ListView_GetItemCount(hListView));
        SetStatusBarText(szBuffer1);
        return TRUE;
    }

    return FALSE;
}
Esempio n. 3
0
BOOL
InitControls(HWND hwnd)
{

    if (CreateStatusBar(hwnd) &&
        CreateToolBar(hwnd)   &&
        CreateListView(hwnd)  &&
        CreateTreeView(hwnd)  &&
        CreateRichEdit(hwnd)  &&
        CreateVSplitBar(hwnd) &&
        CreateHSplitBar(hwnd))
    {
        WCHAR szBuffer1[MAX_STR_LEN], szBuffer2[MAX_STR_LEN];

        InitApplicationsList();

        InitCategoriesList();

        LoadStringW(hInst, IDS_APPS_COUNT, szBuffer2, _countof(szBuffer2));
        StringCbPrintfW(szBuffer1, sizeof(szBuffer1),
                        szBuffer2,
                        ListView_GetItemCount(hListView));
        SetStatusBarText(szBuffer1);
        return TRUE;
    }

    return FALSE;
}
Esempio n. 4
0
VOID
UpdateApplicationsList(INT EnumType)
{
    WCHAR szBuffer1[MAX_STR_LEN], szBuffer2[MAX_STR_LEN];
    HICON hIcon;
    HIMAGELIST hImageListView;

    (VOID) ListView_DeleteAllItems(hListView);

    /* Create image list */
    hImageListView = ImageList_Create(LISTVIEW_ICON_SIZE,
                                      LISTVIEW_ICON_SIZE,
                                      GetSystemColorDepth() | ILC_MASK,
                                      0, 1);

    hIcon = LoadImage(hInst,
                      MAKEINTRESOURCE(IDI_MAIN),
                      IMAGE_ICON,
                      LISTVIEW_ICON_SIZE,
                      LISTVIEW_ICON_SIZE,
                      LR_CREATEDIBSECTION);

    ImageList_AddIcon(hImageListView, hIcon);
    DestroyIcon(hIcon);

    if (EnumType == -1) EnumType = SelectedEnumType;

    if (IS_INSTALLED_ENUM(SelectedEnumType))
        FreeInstalledAppList();
    else if (IS_AVAILABLE_ENUM(SelectedEnumType))
        FreeAvailableAppList();

    if (IS_INSTALLED_ENUM(EnumType))
    {
        /* Enum installed applications and updates */
        EnumInstalledApplications(EnumType, TRUE, EnumInstalledAppProc);
        EnumInstalledApplications(EnumType, FALSE, EnumInstalledAppProc);
    }
    else if (IS_AVAILABLE_ENUM(EnumType))
    {
        /* Enum availabled applications */
        EnumAvailableApplications(EnumType, EnumAvailableAppProc);
    }

    /* Set image list for ListView */
    hImageListView = ListView_SetImageList(hListView, hImageListView, LVSIL_SMALL);

    /* Destroy old image list */
    if (hImageListView)
		ImageList_Destroy(hImageListView);

    SelectedEnumType = EnumType;

    LoadStringW(hInst, IDS_APPS_COUNT, szBuffer2, sizeof(szBuffer2) / sizeof(WCHAR));
    swprintf(szBuffer1, szBuffer2, ListView_GetItemCount(hListView));
    SetStatusBarText(szBuffer1);

    SetWelcomeText();
}
Esempio n. 5
0
//
//	WM_NOTIFY handler for the TextView notification messages
//
UINT TextViewNotifyHandler(HWND hwnd, NMHDR *nmhdr)
{
	switch(nmhdr->code)
	{
	// document has changed due to text input / undo / redo, update
	// the main window-title to show an asterisk next to the filename
	case TVN_CHANGED:

		if(g_szFileTitle[0])
		{
			BOOL fModified = TextView_CanUndo(g_hwndTextView);

			if(fModified != g_fFileChanged)
			{
				SetWindowFileName(hwnd, g_szFileTitle, fModified);
				g_fFileChanged = fModified;
			}
		}
		break;

	// cursor position has changed, update the statusbar info
	case TVN_CURSOR_CHANGE:

		SetStatusBarText(g_hwndStatusbar, 1, 0, _T(" Ln %d, Col %d"), 
			TextView_GetCurLine(g_hwndTextView) + 1, 
			TextView_GetCurCol(g_hwndTextView) + 1 );

		break;

	// edit/insert mode changed, update statusbar info
	case TVN_EDITMODE_CHANGE:

		SetStatusBarText(g_hwndStatusbar, 2, 0, 
			g_szEditMode[TextView_GetEditMode(g_hwndTextView)] );

		break;

	default:
		break;
	}	

	return 0;
}
Esempio n. 6
0
BOOL UpdateProgress(MAINWND *mainWnd, BOOL fVisible, size_w pos, size_w len)
{
    MSG msg;
    BOOL fAbort = FALSE;

    int newpos = len > 0 ? (int)((UINT64)pos*100/len) : 0;//(unsigned __int64)256) / len);
    DWORD dwRate;

    static HWND hwndProgress;
    static DWORD startTicks;
    static DWORD lastTick;
    static size_w oldpos;
    static size_w startpos;

    if(fVisible == FALSE)
    {
        DestroyWindow(hwndProgress);
        SetStatusBarText(mainWnd->hwndStatusBar, 0, 1, TEXT(""));
        return FALSE;
    }


    // create the progress window if it's not been done already
    if(hwndProgress == 0)
    {
        RECT rect;

        SendMessage(mainWnd->hwndStatusBar, SB_GETRECT, 0, (LPARAM)&rect);

        hwndProgress = CreateWindowEx(0, PROGRESS_CLASS, 0, WS_CHILD|WS_VISIBLE,
                                      rect.left+220,rect.top+2,
                                      min(rect.right-rect.left-220,159),rect.bottom-rect.top-5,
                                      mainWnd->hwndStatusBar, 0, 0, 0);

        SendMessage(hwndProgress, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
        startTicks = GetTickCount();
        oldpos = 0;
        startpos = pos;
    }

    if(GetTickCount() - lastTick > 1000)
    {
        lastTick = GetTickCount();
        dwRate = (lastTick - startTicks) / 1000;

        TRACEA("search: searched=%d elapsed=%d (%u/%u -> %d)\n", pos-oldpos, dwRate, pos, len, newpos);

        dwRate = (DWORD)(dwRate ? ((pos-startpos)/(1024*1024)) / dwRate : 0);
        //dwRate = dwRate / (1024 * 1024);

        SetStatusBarText(mainWnd->hwndStatusBar, 0, 1, TEXT("%s: %d Mb/s"), TEXT("Searching"), dwRate);
    }

    SendMessage(hwndProgress, PBM_SETPOS, newpos, 0);

    // dispatch any messages
    while(!fAbort && PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
    {
        TranslateMessage(&msg);

        switch(msg.message)
        {
        case WM_QUIT:
            PostQuitMessage(0);
            fAbort = TRUE;
            break;

        case WM_KEYDOWN:
            if(msg.wParam == VK_ESCAPE)
            {
                fAbort = TRUE;
                //fAbort = QueryAbortDlg();
                continue;
            }
            break;

        case WM_LBUTTONDOWN :
        case WM_RBUTTONDOWN:
        case WM_MBUTTONDOWN:
            //fAbort = QueryAbortDlg();
            fAbort = TRUE;
            continue;
        }

        DispatchMessage(&msg);
    }

    oldpos = pos;
    return fAbort;
}
Esempio n. 7
0
File: Vcc.c Progetto: vcc6809/VCC
// The Window Procedure
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	unsigned int x,y;
	unsigned char kb_char; 
	kb_char=(unsigned char)wParam;
	static unsigned char OEMscan=0;
	static char ascii=0;
	static RECT ClientSize;
	static unsigned long Width,Height;

	switch (message) 
	{
		case WM_COMMAND:
			wmId    = LOWORD(wParam); 
			wmEvent = HIWORD(wParam); 
			// Parse the menu selections:
			// Added for Dynamic menu system
			if ( (wmId >=ID_SDYNAMENU) & (wmId <=ID_EDYNAMENU) )
			{
				DynamicMenuActivated (wmId - ID_SDYNAMENU);	//Calls to the loaded DLL so it can do the right thing
				break;
			}

			switch (wmId)
			{	
				case IDM_HELP_ABOUT:
					DialogBox(EmuState.WindowInstance, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
				    break;

				case ID_CONFIGURE_OPTIONS:
					
					if (EmuState.ConfigDialog==NULL)
					{
						EmuState.ConfigDialog = CreateDialog (NULL,(LPCTSTR)IDD_TCONFIG,EmuState.WindowHandle,(DLGPROC) Config) ;
						ShowWindow (EmuState.ConfigDialog, SW_SHOWNORMAL) ;
					}
				//	DialogBox(EmuState.WindowInstance, (LPCTSTR)IDD_TCONFIG, hWnd, (DLGPROC)Config);
				    break;


				case IDOK:
					SendMessage (hWnd, WM_CLOSE, 0, 0);
					break;

				case ID_FILE_EXIT:
					BinaryRunning=0;
					break;

				case ID_FILE_RESET:
					if (EmuState.EmulationRunning)
						EmuState.ResetPending=2;
					break;

				case ID_FILE_RUN:
					EmuState.EmulationRunning=TRUE;
					InvalidateBoarder();
					break;

				case ID_FILE_RESET_SFT:
					if (EmuState.EmulationRunning)
						EmuState.ResetPending=1;
					break;

				case ID_FILE_LOAD:
					LoadIniFile();
					EmuState.ResetPending=2;
					SetClockSpeed(1); //Default clock speed .89 MHZ	
					break;

				default:
				   return DefWindowProc(hWnd, message, wParam, lParam);
			}
			break;

//		case WM_CREATE:
//				
//			break;
//		case WM_SETFOCUS:
//			Set8BitPalette();
//			break;

		case WM_CLOSE:
			BinaryRunning=0;
			break;

		case WM_CHAR:
//			OEMscan=(unsigned char)((lParam & 0xFF0000)>>16);
//			ascii=kb_char;
//			sprintf(ttbuff,"Getting REAL CHAR %i",ascii);
//			WriteLine ( ttbuff);
//			KeyboardEvent(kb_char,OEMscan,1); //Capture ascii value for scancode
			return 0;
			break;

		case WM_KEYUP:
		case WM_SYSKEYUP:
			OEMscan=(unsigned char)((lParam & 0xFF0000)>>16);
			KeyboardEvent(kb_char,OEMscan,0);
			return 0;
		break;

		case WM_KEYDOWN: 
		case WM_SYSKEYDOWN:
			OEMscan=(unsigned char)((lParam & 0xFF0000)>>16);

			switch (OEMscan)
			{
				case 61:	//F3

				break;
				case 62:	//F4

				break;

				case 63:	//F5
					if (EmuState.EmulationRunning)
						EmuState.ResetPending=1;
				break;

				case 64:	//F6
					SetMonitorType(!SetMonitorType(QUERY));
				break;

	//			case 65:	//F7
	//				SetArtifacts(!SetArtifacts(QUERY));
	//			break;

				case 66:	//F8
					SetSpeedThrottle(!SetSpeedThrottle(QUERY));
				break;

				case 67:	//F9
					EmuState.EmulationRunning=!EmuState.EmulationRunning;
					if (EmuState.EmulationRunning)
						EmuState.ResetPending=2;
					else
						SetStatusBarText("",&EmuState);
				break;

				case 68:	//F10
					SetInfoBand(!SetInfoBand(QUERY));
					InvalidateBoarder();
				break;
				
				case 87:	//F11
				if (FlagEmuStop==TH_RUNNING)
				{
					FlagEmuStop=TH_REQWAIT;
					EmuState.FullScreen=!EmuState.FullScreen;
				}
		
				break;

	//			case 88:	//F12
	//				CpuDump();
	//				break;

				default:
					if (EmuState.EmulationRunning)
						KeyboardEvent(kb_char,OEMscan,2);		
					break;
			}
			return 0;
		break;

		case WM_LBUTTONDOWN:  //0 = Left 1=right
			SetButtonStatus(0,1);
			break;

		case WM_LBUTTONUP:
			SetButtonStatus(0,0);
			break;

		case WM_RBUTTONDOWN:
			SetButtonStatus(1,1);
			break;

		case WM_RBUTTONUP:
			SetButtonStatus(1,0);
			break;

		case WM_MOUSEMOVE:
			if (EmuState.EmulationRunning)
			{
				x = LOWORD( lParam ) ;
				y = HIWORD( lParam ) ;
				GetClientRect(EmuState.WindowHandle,&ClientSize);
				x/=((ClientSize.right-ClientSize.left)>>6);
				y/=(((ClientSize.bottom-ClientSize.top)-20)>>6);
				joystick(x,y);
			}
			return(0);
			break;
//		default:
//			return DefWindowProc(hWnd, message, wParam, lParam);
   }
Esempio n. 8
0
void SetStatusBarTextFromRes (UINT stringResID)
{
	char text[100];
	LoadString (GetModuleHandle(0), stringResID, text, 100);
	SetStatusBarText (text);
}
Esempio n. 9
0
/*
 =======================================================================================================================
 =======================================================================================================================
 */
BOOL ReadZippedRomData(char *rompath)
{
	/*~~~~~~~~~~~~~~~~~~~~~~~*/
	unzFile			fp;
	unsigned long	gROMLength; /* size in bytes of the ROM */
	/*~~~~~~~~~~~~~~~~~~~~~~~*/

	if(fp = unzOpen(rompath))
	{
		/*~~~~~~~~~~~~~~~~~~~~*/
		char	szFileName[256];
		/*~~~~~~~~~~~~~~~~~~~~*/

		if(unzGoToFirstFile(fp) == UNZ_OK)
		{
			do
			{
				/*~~~~~~~~~~~~~~~~~~~~~~*/
				unz_file_info	file_info;
				/*~~~~~~~~~~~~~~~~~~~~~~*/

				if(unzGetCurrentFileInfo(fp, &file_info, szFileName, 256, NULL, 0, NULL, 0) == UNZ_OK)
				{
					if
					(
						stricmp(&szFileName[strlen(szFileName) - 4], ".bin") == 0
					||	stricmp(&szFileName[strlen(szFileName) - 4], ".v64") == 0
					||	stricmp(&szFileName[strlen(szFileName) - 4], ".rom") == 0
					||	stricmp(&szFileName[strlen(szFileName) - 4], ".usa") == 0
					||	stricmp(&szFileName[strlen(szFileName) - 4], ".z64") == 0
					||	stricmp(&szFileName[strlen(szFileName) - 4], ".j64") == 0
					||	stricmp(&szFileName[strlen(szFileName) - 4], ".pal") == 0
					||	stricmp(&szFileName[strlen(szFileName) - 4], ".n64") == 0
					)
					{
						gROMLength = file_info.uncompressed_size;	/* get size of ROM */

						/* pad with zeros to fill the displacement */
						if(((gROMLength & 0xFFFF)) == 0)
							gAllocationLength = gROMLength;
						else
							gAllocationLength = gROMLength + (0x10000 - (gROMLength & 0xFFFF));

						if(unzOpenCurrentFile(fp) == UNZ_OK)
						{
							uint64	i;

							InitVirtualRomMemory(gAllocationLength);
							InitMemoryLookupTables();
							InitTLB();

							Is_Reading_Rom_File = TRUE;
							To_Stop_Reading_Rom_File = FALSE;

							sprintf(generalmessage, "%s [%s] ", TranslateStringByString("Loading"), szFileName);
							SetStatusBarText(0, generalmessage);

							for(i = 0; i < gROMLength && To_Stop_Reading_Rom_File == FALSE; i += 65536)
							/* for( i=0; i<gROMLength; i+=65536) */
							{
								WindowMsgLoop();

								if(To_Stop_Reading_Rom_File == TRUE)
								{
									CloseROM();
									To_Stop_Reading_Rom_File = FALSE;
									Is_Reading_Rom_File = FALSE;

									unzClose(fp);
									return FALSE;
								}

								/* fread(gMS_ROM_Image+i, sizeof(uint8), 65536, fp); */
								if(unzReadCurrentFile(fp, gMS_ROM_Image + i, sizeof(uint8) * 65536) == 65536)
								{
									sprintf(generalmessage, "%s [%s] %d%%",  TranslateStringByString("Loading"), szFileName, i * 100 / gROMLength);
									SetStatusBarText(0, generalmessage);
								}
								else if(unzReadCurrentFile(fp, gMS_ROM_Image + i, 1) == 0)
								{
									sprintf(generalmessage, "%s [%s] %d%%",  TranslateStringByString("Loading"), szFileName, i * 100 / gROMLength);
									SetStatusBarText(0, generalmessage);
								}
								else
								{
									DisplayError("File could not be read. gROMLength = %08X\n", gROMLength);
									CloseROM();
									unzCloseCurrentFile(fp);
									unzClose(fp);
									Set_Ready_Message();
									Is_Reading_Rom_File = FALSE;
									return FALSE;
								}
							}

							ByteSwap(gAllocationLength, gMS_ROM_Image);
							memcpy((uint8 *) &rominfo.validation, gMS_ROM_Image, 0x40);
							SwapRomHeader((uint8 *) &rominfo.validation);

							/* Copy boot code to SP_DMEM */
							memcpy((uint8 *) &SP_DMEM, gMS_ROM_Image, 0x1000);
							memcpy(rominfo.name, gMS_ROM_Image + 0x20, 20);
							SwapRomName(rominfo.name);
							Set_Ready_Message();
							unzCloseCurrentFile(fp);
							unzClose(fp);
							Is_Reading_Rom_File = FALSE;
							return TRUE;
						}
						else
						{
							DisplayError("File could not be read: CRC Error in zip.");
							unzClose(fp);
							return FALSE;
						}
					}
				}
				else
				{
					DisplayError("File could not unzipped.");
					unzClose(fp);
					return FALSE;
				}
			} while(unzGoToNextFile(fp) == UNZ_OK);
		}

		unzClose(fp);
	}

	return FALSE;
}
Esempio n. 10
0
BOOL ReadRomData(char *rompath)
{
	/*~~~~~~~~~~~~~~~~~~~~~~~*/
	FILE			*fp;
	unsigned long	gROMLength; /* size in bytes of the ROM */
	/*~~~~~~~~~~~~~~~~~~~~~~~*/

	if(stricmp(&rompath[strlen(rompath) - 4], ".zip") == 0)
	{
		return ReadZippedRomData(rompath);
	}

	fp = fopen(rompath, "rb");
	if(fp == NULL)
	{
		MessageBox
		(
			gui.hwnd1964main,
			TranslateStringByString("Error opening this file. Please refresh the ROM list."),
			TranslateStringByString("Error"),
			MB_ICONINFORMATION
		);
		return FALSE;
	}

	rewind(fp);
	fseek(fp, 0, SEEK_END);
	gROMLength = ftell(fp);

	/* pad with zeros to fill the displacement */
	if(((gROMLength & 0xFFFF)) == 0)
		gAllocationLength = gROMLength;
	else
		gAllocationLength = gROMLength + (0x10000 - (gROMLength & 0xFFFF));

	fseek(fp, 0, SEEK_SET);		/* set pointer to beginning of file */
	if(fp != NULL)
	{
		uint64	i;

		InitVirtualRomMemory(gAllocationLength);
		InitMemoryLookupTables();
		InitTLB();

		Is_Reading_Rom_File = TRUE;
		To_Stop_Reading_Rom_File = FALSE;

		for(i = 0; i < gROMLength && To_Stop_Reading_Rom_File == FALSE; i += 65536)
		{
			WindowMsgLoop();


			if(To_Stop_Reading_Rom_File == TRUE)
			{
				CloseROM();
				To_Stop_Reading_Rom_File = FALSE;
				Is_Reading_Rom_File = FALSE;

				fclose(fp);
				return FALSE;
			}

			fread(gMS_ROM_Image + i, sizeof(uint8), 65536, fp);
			{
				/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
				char	drive[_MAX_DRIVE], dir[_MAX_DIR];
				char	fname[_MAX_FNAME], ext[_MAX_EXT];
				/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

				_splitpath(rompath, drive, dir, fname, ext);
				strcat(fname, ext);
				sprintf(generalmessage, "%s [%s] %d%%", TranslateStringByString("Loading"), fname, i * 100 / gROMLength);
			}

			SetStatusBarText(0, generalmessage);
		}

		Set_Ready_Message();

		Is_Reading_Rom_File = FALSE;

		ByteSwap(gAllocationLength, gMS_ROM_Image);
		memcpy((uint8 *) &rominfo.validation, gMS_ROM_Image, 0x40);
		SwapRomHeader((uint8 *) &rominfo.validation);

		/* Copy boot code to SP_DMEM */
		memcpy((uint8 *) &SP_DMEM, gMS_ROM_Image, 0x1000);
		memcpy(rominfo.name, gMS_ROM_Image + 0x20, 20);
		SwapRomName(rominfo.name);
	}
	else
	{
		MessageBox(0, TranslateStringByString("File could not be opened."), TranslateStringByString("Error"), 0);
		return FALSE;
	}

	fclose(fp);

	return TRUE;
}
Esempio n. 11
0
    VOID UpdateApplicationsList(INT EnumType)
    {
        WCHAR szBuffer1[MAX_STR_LEN], szBuffer2[MAX_STR_LEN];
        HICON hIcon;
        HIMAGELIST hImageListView;

        m_ListView->SendMessage(WM_SETREDRAW, FALSE, 0);

        if (EnumType == -1) EnumType = SelectedEnumType;

        if (IS_INSTALLED_ENUM(SelectedEnumType))
            FreeInstalledAppList();

        (VOID) ListView_DeleteAllItems(hListView);

        /* Create image list */
        hImageListView = ImageList_Create(LISTVIEW_ICON_SIZE,
            LISTVIEW_ICON_SIZE,
            GetSystemColorDepth() | ILC_MASK,
            0, 1);

        hIcon = (HICON) LoadImage(hInst,
            MAKEINTRESOURCE(IDI_MAIN),
            IMAGE_ICON,
            LISTVIEW_ICON_SIZE,
            LISTVIEW_ICON_SIZE,
            LR_CREATEDIBSECTION);

        ImageList_AddIcon(hImageListView, hIcon);
        DestroyIcon(hIcon);

        if (IS_INSTALLED_ENUM(EnumType))
        {
            /* Enum installed applications and updates */
            EnumInstalledApplications(EnumType, TRUE, s_EnumInstalledAppProc);
            EnumInstalledApplications(EnumType, FALSE, s_EnumInstalledAppProc);
        }
        else if (IS_AVAILABLE_ENUM(EnumType))
        {
            /* Enum availabled applications */
            EnumAvailableApplications(EnumType, s_EnumAvailableAppProc);
        }

        /* Set image list for ListView */
        hImageListView = ListView_SetImageList(hListView, hImageListView, LVSIL_SMALL);

        /* Destroy old image list */
        if (hImageListView)
            ImageList_Destroy(hImageListView);

        SelectedEnumType = EnumType;

        LoadStringW(hInst, IDS_APPS_COUNT, szBuffer2, _countof(szBuffer2));
        StringCbPrintfW(szBuffer1, sizeof(szBuffer1),
            szBuffer2,
            ListView_GetItemCount(hListView));
        SetStatusBarText(szBuffer1);

        SetWelcomeText();

        /* set automatic column width for program names if the list is not empty */
        if (ListView_GetItemCount(hListView) > 0)
            ListView_SetColumnWidth(hListView, 0, LVSCW_AUTOSIZE);

        SendMessage(hListView, WM_SETREDRAW, TRUE, 0);
    }