Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
O

opsoft op

@opsoft op
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to open recent files from file menu in MFC application?
    O opsoft op

    If I understood this question then, here I say... Just create one MenuItem in your File popup menu with this id. you can give name something as "Recent Files" ID_ FILE_MRU_FILE1 To know more about how it works and all, view this Microsoft link its pretty clear http://www.microsoft.com/msj/0899/c/c0899.aspx[^] regards, -OP

    C / C++ / MFC c++ tutorial question

  • Single Instance Application using Events
    O opsoft op

    What can be issue of using EVENTS object for single instance application for single user on a desktop. I have seen this method given in the link, which is quite clean solution to the problem but using mutex and then boradcasting message is bit concern. http://www.codeproject.com/threads/simplesingleinstanceapp.asp[^] Here is what I inted to do when using events for process communication. step1: Create an unique event in the ininstance method in Reset mode. Check if event is already created. If event not created then create event and create screenControl thread to listen for set/reset of that event. If event is there then means window is already present and hence set the event here so that running thread can wakeup. // OnlyOne.cpp // global data HANDLE hEvent; int ShutDownFlag; void ScreenMonitor(LPVOID pParam); // COnlyOneApp initialization BOOL COnlyOneApp::InitInstance() { ///// other stuff... CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(COnlyOneDoc), RUNTIME_CLASS(CMainFrame), RUNTIME_CLASS(COnlyOneView)); AddDocTemplate(pDocTemplate); //------ hEvent = CreateEvent(NULL,TRUE,FALSE,_T("ONLYONE-APP")); AlreadyRunning = ( ::GetLastError() == ERROR_ALREADY_EXISTS || ::GetLastError() == ERROR_ACCESS_DENIED); if (AlreadyRunning) { MessageBox(NULL,"Already Running....","Message!!",MB_OK); SetEvent(hEvent); return TRUE; } //------- // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; //-------- CWinThread *wndThread = AfxBeginThread((AFX_THREADPROC)ScreenMonitor, m_pMainWnd->GetSafeHwnd(),THREAD_PRIORITY_NORMAL,0,0); if (wndThread == NULL) { MessageBox(NULL,"Could not Create Thread...","MSG",MB_OK); return FALSE; } //------- m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); return TRUE; } step 2: Thread method. This method waits for events to set. When event is set which signifies same application tried to start, this thread brings first instance in the foreground. // COnlyOneApp message handlers void ScreenMonitor(LPVOID pParam) { CW

    C / C++ / MFC help c++ com linux
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups