类似 Rolan 的快速启动工具。
启动后隐藏,当鼠标移至左上角时,窗口显示,点击项目可运行程序。
GitHub地址: MyRolan 。
1 #if defined(UNICODE) && !defined(_UNICODE) 2 #define _UNICODE 3 #elif defined(_UNICODE) && !defined(UNICODE) 4 #define UNICODE 5 #endif 6 7 #include <tchar.h> 8 #include <windows.h> 9 #include <string> 10 #include <stdio.h> 11 #include <shellapi.h> 12 #include <windowsx.h> 13 #include <commctrl.h> 14 using namespace std; 15 16 /* Declare Windows procedure */ 17 LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); 18 19 /* Make the class name into a global variable */ 20 TCHAR szClassName[ ] = _T("MyRolan"); 21 22 #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) 23 #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) 24 25 typedef struct item { 26 string name; 27 string path; 28 string icon_path; 29 string arguments; 30 } item; 31 typedef struct group { 32 string name; 33 item* items; 34 int item_num; 35 } group; 36 37 int WIDTH=398; 38 int HEIGHT=500; 39 int GROUP_WIDTH=100; 40 int ITEM_WIDTH=100; 41 int ITEM_HEIGHT=40; 42 int GROUP_HEIGHT=ITEM_HEIGHT; 43 #define BKCOLOR RGB(240,240,240) 44 #define COMMON_ITEM_BKCOLOR RGB(220,220,220) 45 #define ACTIVE_ITEM_BKCOLOR RGB(200,200,200) 46 47 48 group* groups; 49 int group_num; 50 int current_group=0; 51 int current_item=0; 52 int current_top=0; 53 int item_columns=3; 54 55 56 57 int WINAPI WinMain (HINSTANCE hThisInstance, 58 HINSTANCE hPrevInstance, 59 LPSTR lpszArgument, 60 int nCmdShow) 61 { 62 HWND hwnd; /* This is the handle for our window */ 63 MSG messages; /* Here messages to the application are saved */ 64 WNDCLASSEX wincl; /* Data structure for the windowclass */ 65 66 /* The Window structure */ 67 wincl.hInstance = hThisInstance; 68 wincl.lpszClassName = szClassName; 69 wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ 70 wincl.style = CS_DBLCLKS; /* Catch double-clicks */ 71 wincl.cbSize = sizeof (WNDCLASSEX); 72 73 /* Use default icon and mouse-pointer */ 74 wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); 75 wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); 76 wincl.hCursor = LoadCursor (NULL, IDC_ARROW); 77 wincl.lpszMenuName = NULL; /* No menu */ 78 wincl.cbClsExtra = 0; /* No extra bytes after the window class */ 79 wincl.cbWndExtra = 0; /* structure or the window instance */ 80 /* Use Windows's default colour as the background of the window */ 81 //wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; 82 wincl.hbrBackground = NULL; 83 /* Register the window class, and if it fails quit the program */ 84 if (!RegisterClassEx (&wincl)) 85 return 0; 86 87 /* The class is registered, let's create the program*/ 88 hwnd = CreateWindowEx ( 89 WS_EX_TOOLWINDOW, /* Extended possibilites for variation */ 90 szClassName, /* Classname */ 91 _T("MyRolan"), /* Title Text */ 92 WS_EX_TOOLWINDOW, /* default window WS_OVERLAPPEDWINDOW*/ 93 CW_USEDEFAULT, /* Windows decides the position */ 94 CW_USEDEFAULT, /* where the window ends up on the screen */ 95 WIDTH, /* The programs width */ 96 HEIGHT, /* and height in pixels */ 97 HWND_DESKTOP, /* The window is a child-window to desktop */ 98 NULL, /* No menu */ 99 hThisInstance, /* Program Instance handler */ 100 NULL /* No Window Creation data */ 101 ); 102 DWORD dwExStyle = GetWindowLong(hwnd, GWL_STYLE); 103 dwExStyle &=~WS_CAPTION; 104 SetWindowLong(hwnd, GWL_STYLE, dwExStyle); 105 106 /* Make the window visible on the screen */ 107 ShowWindow (hwnd, nCmdShow); 108 109 /* Run the message loop. It will run until GetMessage() returns 0 */ 110 while (GetMessage (&messages, NULL, 0, 0)) 111 { 112 /* Translate virtual-key messages into character messages */ 113 TranslateMessage(&messages); 114 /* Send message to WindowProcedure */ 115 DispatchMessage(&messages); 116 } 117 118 /* The program return-value is 0 - The value that PostQuitMessage() gave */ 119 return messages.wParam; 120 } 121 void remove_nextline(char* buf) { 122 int l=strlen(buf); 123 if(buf[l-1]==' ') 124 buf[l-1]='