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
G

g3e

@g3e
About
Posts
16
Topics
8
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Need a few more testers to try C++ XML Library.
    G g3e

    I would like to give it a try

    C / C++ / MFC c++ com testing beta-testing xml

  • Please help on this problem
    G g3e

    Looks like you are trying out the ADO tutorial in MSDN. The variables adVarChar etc.. are in msado15.dll. Did you import the "c:\Program Files\Common Files\System\ADO\msado15.dll" into your program?

    C / C++ / MFC help

  • Help needed!!! FileSystemWatcher
    G g3e

    Hi mav.. Thanks for your reply. When i tried to debug the program when i first faced this problem I found that the FileSystemWatcher was only holding the file:confused: So when i tried google it, many others had also said the same. That is why the wait logic was introduced. Yes i can do away with the recursion logic. Regards, G3

    C# help csharp css tutorial question

  • Help needed!!! FileSystemWatcher
    G g3e

    Hi, I've written a windows service to parse files.It uses the FileSystemWatcher class in C# to sniff a folder for particular type of files. But when the files were being processed, i repeatedly get the error "The process cannot access the file "AAA" because it is being used by another process". To overcome this problem, i added the following. lines of code

    public bool ParseEnvFile(string strFilePath)
    {
    try
    {
    using(FileStream fs = new FileStream(strFilePath, FileMode.Open, FileAccess.Read, FileShare.Read))
    {
    // Do some processing here
    fs.Close();
    m_nReadAttempts = 0;
    }
    }
    catch(IOException ex)
    {
    if(m_nReadAttempts < 3)
    {
    Thread.Sleep(2000);
    m_nReadAttempts++;
    return ParseEnvFile(strFilePath);
    }
    else
    {
    throw ex;
    }
    }
    .....
    }

    But even this did not solve the problem. The exception still kept coming, though less frequently. So I was forced to add a Timer event(runs every 5 mins) that would pick up all the files that were left over because of the exception. Now, my problem is this: When a file gets created in the folder, sometimes both the OnFileCreated event and the timer event try to access the file at the same time. Within my service, I'm required to open the file in write mode and update some contents. I find that at times the file that gets created ends up as a 0KB file (Note: when it initially got created the file had some content in it)!!!! Any ideas on how to solve it? Thanks for any help in resolving this problem.

    C# help csharp css tutorial question

  • FileSystemWatcher - File used by another process
    G g3e

    Hi, I've written a windows service to parse files.It uses the FileSystemWatcher class in C# to sniff a folder for particular type of files. But when the files were being processed, i repeatedly get the error "The process cannot access the file "AAA" because it is being used by another process". To overcome this problem, i added the following. lines of code public bool ParseEnvFile(string strFilePath) { try { using(FileStream fs = new FileStream(strFilePath, FileMode.Open, FileAccess.Read, FileShare.Read)) { // Do some processing here fs.Close(); m_nReadAttempts = 0; } } catch(IOException ex) { if(m_nReadAttempts < 3) { Thread.Sleep(2000); m_nReadAttempts++; return ParseEnvFile(strFilePath); } else { throw ex; } } ..... } But even this did not solve the problem. The exception still kept coming, though less frequently. So I was forced to add a Timer event(runs every 5 mins) that would pick up all the files that were left over because of the exception. Now, my problem is this: When a file gets created in the folder, sometimes both the OnFileCreated event and the timer event try to access the file at the same time. Within my service, I'm required to open the file in write mode and update some contents. I find that at times the file that gets created ends up as a 0KB file (Note: when it initially got created the file had some content in it)!!!! Any ideas on why this happens? Thanks for any help in resolving this problem.

    C / C++ / MFC help csharp css question announcement

  • Arghh! Visual C++ deletes project files!
    G g3e

    I use VC5 on XP machine and have faced the problem of the cpp file getting deleted. I had to rewrite the whole thing.:doh:

    C / C++ / MFC c++ help question

  • I'm puzzled
    G g3e

    I've implemented a wizard using the CPropertySheet and CPropertyPage classes. When i'm in a particular page of the wizard, when i click the "Cancel" button or press ESC or close the page by clicking on the "X" in the right top corner, the CANCEL message gets fired and control comes to the OnCancel command handler. At this point the PSN_WIZFINISH notification is not sent. void CMyPropertyPage::OnCancel() { ASSERT(m_pSheet != NULL); m_pSheet->EndDialog(IDCANCEL); } Now I have a scenario where i have to forcefully close the wizard by sending SendMessage(WM_COMMAND,IDCANCEL); Now after the CANCEL message being sent, the PSN_WIZFINISH notification is also sent . :confused: In my class, i've overridden the OnWizardFinish to do some functionality.. So when i do a "SendMessage" i dont want the PSN_WIZFINISH to be sent .. why does it work this way and how do i avoid it ?

    C / C++ / MFC question

  • Problem in Wizard - OnCancel / OnWizardFinish
    G g3e

    I've implemented a wizard using the CPropertySheet and CPropertyPage classes. When i'm in a particular page of the wizard, when i click the "Cancel" button or press ESC or close the page by clicking on the "X" in the right top corner, the CANCEL message gets fired and control comes to the OnCancel command handler. At this point the PSN_WIZFINISH notification is not sent. void CMyPropertyPage::OnCancel() { ASSERT(m_pSheet != NULL); m_pSheet->EndDialog(IDCANCEL); } Now I have a scenario where i have to forcefully close the wizard by sending SendMessage(WM_COMMAND,IDCANCEL); Now after the CANCEL message being sent, the PSN_WIZFINISH notification is also sent :confused: In my class, i've overridden the OnWizardFinish to do some functionality.. So when i do a "SendMessage" i dont want the PSN_WIZFINISH to be sent .. why does it work this way and how do i avoid it ? Thanx for ur help.

    C / C++ / MFC question help

  • How to check if logged on user has admin privileges
    G g3e

    How to check if the logged on user has admin privileges on the system ? Is there any API to do that ?? The API should be supported on all windows platforms ( Win NT, XP, 2000, Win 98/95/ME). Thanks for ur help.

    C / C++ / MFC json help tutorial question

  • Crash in ocx Create
    G g3e

    Following are my sequence of steps for creating ocx. if(!ocx.Create(...)) { Register the Ocx if(!ocx.Create(...)) throw error message } The first create fails. the control comes inside the if . Registration of ocx succeeds. But on the second create, the application crashes !!?? Can anyone tell me why ??

    C / C++ / MFC help question

  • very simple but i don't know CheckBox
    G g3e

    (CButton*)GetDlgItem(IDC_XXX))->SetCheck(TRUE)

    C / C++ / MFC tutorial question

  • CPropertySheet
    G g3e

    Thanx for all ur responses. Its working now !!! I tried first to post a user defined message from the sheet's InitDialog. But that did not work as expected. Then i tried the same from the InitDialog of the property page. And it worked just as required. Thanx again.

    C / C++ / MFC help question

  • CPropertySheet
    G g3e

    I have a wizard derived from propertysheet. It is a modal dialog which is invoked using DoModal(). Immediately after the wizard is displayed, I want to popup a dialog. But i'm not able to track the exact point after the wizard is shown. In which method of the wizard can i do this ??? Thanx for ur help.

    C / C++ / MFC help question

  • how to change printers without PrintDialog?
    G g3e

    1 : Get the handle to devmode and devnames structures by calling the OpenPrinter and GetPrinter API calls and populate PRINTER_INFO_2 strucure. Copy these handles to printInfo.m_pPD->m_pd.hDevMode and printInfo.m_pPD->m_pd.hDevNames 2 : Call SelectPrinter() API with the handles. Make sure to reset to the original printer properties.

    C / C++ / MFC design tutorial question

  • How to get process id given the process name
    G g3e

    Thanks a lot. That works.

    C / C++ / MFC json help tutorial question

  • How to get process id given the process name
    G g3e

    Hi, From within my application i need to wait for an external process to complete before proceeding. But all i have is the external process's name. Is there any API that returns the process id or handle given the process name ?? I tried using CreateToolhelp32Snapshot but it does not seem to work in VC41 in which my application is built. It works fine in VC6 though. Thanks for ur help.

    C / C++ / MFC json help tutorial question
  • Login

  • Don't have an account? Register

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