我创建了任务栏图标,在鼠标右键单击时显示弹出菜单:
count = 0
with open('mydata.csv', newline='') as csvfile:
reader = csv.DictReader(csvfile)
#row_count = sum(1 for row in reader)
#print(row_count)
for row in reader:
count += 1
print(count)
if count == 5:
sys.exit()
hWnd-是主窗口,它是隐藏的。 WndProc看起来像:
NOTIFYICONDATA nid;
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = (HWND) hWnd;
nid.uID = 12345;
nid.uFlags = NIF_ICON | NIF_MESSAGE;
nid.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_TRAY_ICON);
nid.uCallbackMessage = WM_USER_SHELLICON;
Shell_NotifyIcon(NIM_ADD, &nid);
当我右键单击任务栏图标时,它会显示我的弹出菜单。问题在于默认的TaskBar上下文菜单也会显示出来。如何解决?