I'm using a named pipe to do IPC. My callback function is static. When I receive commands from this pipe, I need to call my instance class somehow - the only way I could think of was with SendMessage. However, my AfxGetMainWnd is returning NULL since I'm not showing my window. The reason: this app is only displaying a system tray icon, so the main window is invisible. How can I communicate with my class from the static callback?