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
E

Erich Ruth

@Erich Ruth
About
Posts
21
Topics
17
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • See if print queue is empty
    E Erich Ruth

    I use the print driver pdf995. I go to File/Print and I can print to PDF. Is there any way to programmatically check to see if the print queue for this 'printer' is empty? If its empty, all is well and my software works fine. But if something is stuck in that print queue, it really causes chaos. When you go to File/Print, there must be some way of checking the status of the print queue.

    Managed C++/CLI data-structures help question

  • Run executable with arguments
    E Erich Ruth

    How can I run this command: pdfcompress.exe "c:\currentfile.pdf" "c:\newfile.pdf" I dont see how I can use ShellExecute to send these 2 arguments. Is there some other command I can use along with these arguments to execute this file? Please let me know.

    Managed C++/CLI question

  • IsFileReady
    E Erich Ruth

    I use this code:

    Quote:

    BOOL C1095C::IsFileReady(CString path) { HANDLE hFile = CreateFile(path.GetBuffer(), GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { return FALSE; } else { CloseHandle(hFile); return TRUE; } }

    while (!IsFileReady(output.GetBuffer())) { Sleep(1); } which waits for a file to be created and then once it is, it proceeds to the next job. The problem is, this code doesnt seem to work every time. Im nervous now in using it. I need to wait for a file to be full created and sometimes it may take 5+ minutes. Once its created, then I want to move onto the next step. How can I adjust this code to make it work every time? Please any response any one can give me will be great appreciated.

    C / C++ / MFC question help career

  • How to remove a non-ascii character from CString
    E Erich Ruth

    That worked. Thank you very much.

    Managed C++/CLI question tutorial

  • How to remove a non-ascii character from CString
    E Erich Ruth

    I find that some of the data I bring in has a character that looks like a space but is not a space. After much research, I identified the character as & then #160; If I put it together, it looks like a space in this message. How can I remove characters like this? I tried CString GetRidOf(CString str) { str.Remove(' '); return str; } but the remove function is not correct.

    Managed C++/CLI question tutorial

  • pdf995.ini in Program Files (x86)
    E Erich Ruth

    I have a file under Program Files (x86) called pdf995.ini and I want to programmatically edit this file. Sometimes I can make the software edit this file but many times it doesnt work. I know this file requires permission to change. Is there a way to open this file and overwrite this file? Please let me know.

    C / C++ / MFC question

  • Data Shifting on Some Computers
    E Erich Ruth

    I have a program that works fine on most machines. Every now and then I find a computer and the edit boxes are shifted to the right. I have an image of the shifting here http://ruthtechnology.com/temp/Untitled2.jpg[^] In the past, I use to be able to go to display settings and change it from 125% to 100% and reboot and the boxes would line up nicely with the form. But its on a 100% and I dont know why its not lining up. Any comments or suggestions are greatly appreciated.

    Managed C++/CLI com

  • Error when printing
    E Erich Ruth

    When I say it breaks, that means it pops up a box that says: "Unhandled exemption x 0x777f6a73 in MultiScreen.exe: 0xC0000005: Access violation reading location 0xfeeefefa. and then I have Break or Continue. I hit Break and it shows me this code:

    inline void* CThreadSlotData::GetThreadValue(int nSlot)
    {
    EnterCriticalSection(&m_sect);
    ASSERT(nSlot != 0 && nSlot < m_nMax);
    ASSERT(m_pSlotData != NULL);
    ASSERT(m_pSlotData[nSlot].dwFlags & SLOT_USED);
    ASSERT(m_tlsIndex != (DWORD)-1);
    if( nSlot <= 0 || nSlot >= m_nMax ) // check for retail builds.
    {
    LeaveCriticalSection(&m_sect);
    return NULL;
    }

    CThreadData\* pData = (CThreadData\*)TlsGetValue(m\_tlsIndex);
    if (pData == NULL || nSlot >= pData->nCount)
    {
    	LeaveCriticalSection(&m\_sect);
    	return NULL;
    }
    void\* pRetVal = pData->pData\[nSlot\];
    LeaveCriticalSection(&m\_sect);
    return pRetVal;
    

    }

    and its pointing to

    LeaveCriticalSection(&m_sect);

    which is the 2nd to last line.

    C / C++ / MFC csharp visual-studio help

  • Error when printing
    E Erich Ruth

    I have a small program. I compile the executable. If I find the executable and double click on it, everything works fine. I can print, print preview; all is well. If within visual studio I hit the green triangle to run the executable and then I try to print or print preview, I get an error in this code: inline void* CThreadSlotData::GetThreadValue(int nSlot) { EnterCriticalSection(&m_sect); ASSERT(nSlot != 0 && nSlot < m_nMax); ASSERT(m_pSlotData != NULL); ASSERT(m_pSlotData[nSlot].dwFlags & SLOT_USED); ASSERT(m_tlsIndex != (DWORD)-1); if( nSlot <= 0 || nSlot >= m_nMax ) // check for retail builds. { LeaveCriticalSection(&m_sect); return NULL; } CThreadData* pData = (CThreadData*)TlsGetValue(m_tlsIndex); if (pData == NULL || nSlot >= pData->nCount) { LeaveCriticalSection(&m_sect); return NULL; } void* pRetVal = pData->pData[nSlot]; LeaveCriticalSection(&m_sect); return pRetVal; } It breaks at LeaveCriticalSection(). Im really perplexed as to why this error has arisen and what to do to get it to go away. If you have any insight, please let me know.

    C / C++ / MFC csharp visual-studio help

  • Print causes in afxtls.cpp
    E Erich Ruth

    I have a small program. I compile the executable. If I find the executable and double click on it, everything works fine. I can print, print preview; all is well. If within visual studio I hit the green triangle to run the executable and then I try to print or print preview, I get an error in this code:

    inline void* CThreadSlotData::GetThreadValue(int nSlot)
    {
    EnterCriticalSection(&m_sect);
    ASSERT(nSlot != 0 && nSlot < m_nMax);
    ASSERT(m_pSlotData != NULL);
    ASSERT(m_pSlotData[nSlot].dwFlags & SLOT_USED);
    ASSERT(m_tlsIndex != (DWORD)-1);
    if( nSlot <= 0 || nSlot >= m_nMax ) // check for retail builds.
    {
    LeaveCriticalSection(&m_sect);
    return NULL;
    }

    CThreadData\* pData = (CThreadData\*)TlsGetValue(m\_tlsIndex);
    if (pData == NULL || nSlot >= pData->nCount)
    {
    	LeaveCriticalSection(&m\_sect);
    	return NULL;
    }
    void\* pRetVal = pData->pData\[nSlot\];
    LeaveCriticalSection(&m\_sect);
    return pRetVal;
    

    }

    It breaks at LeaveCriticalSection(). Im really perplexed as to why this error has arisen and what to do to get it to go away. If you have any insight, please let me know.

    Managed C++/CLI csharp c++ visual-studio help

  • Adjust paper size
    E Erich Ruth

    I have this code

    BOOL CFormOptions::OnPreparePrinting(CPrintInfo* pInfo)
    {
    tagPDA pPrintDlg;
    AfxGetApp()->GetPrinterDeviceDefaults (&pPrintDlg);
    pInfo->m_pPD->m_pd.hDevMode = pPrintDlg.hDevMode;
    LPDEVMODE devMode = pInfo->m_pPD->GetDevMode();
    if (devMode)
    {
    if (m_legal)
    devMode->dmPaperSize = 45; // DMPAPER_10X11; // DMPAPER_LEGAL;
    else
    devMode->dmPaperSize = DMPAPER_LEGAL; // _LETTER

       devMode->dmPaperWidth = 2000;
    
    
       //devMode->dmPaperSize = DMPAPER\_10X11;
    
       GlobalUnlock(devMode);
    }
    	
    if ( pInfo->m\_bPreview )        // normal print preview
         return DoPreparePrinting(pInfo);
    
    return DoPreparePrinting(pInfo);
    

    }

    and I can adjust the paper size from letter to legal. But if I try to adjust the paper size to DMPAPER_10X11 or any other size, the software ignores it and just uses letter size. How can I adjust the paper size to be something like DMPAPER_10X11? I tried adjust the PaperWidth as well and that is ignored as well. So Im not sure what Im doing wrong. Any help, any direction any one can provide will be greatly appreciated.

    C / C++ / MFC question help

  • tricky question about endl
    E Erich Ruth

    > How exactly is your code going wrong when you don't have > cout << endl;? If I leave the endl, I get no real errors, the computer doesn't crash or anything, I just get the wrong calculations, almost like it forgets or confuses simple addition. If I insert endl, I get no errors and my calculations are dead-on. I have a vague clue as to what flushing is. I am stuck badly. Any other response, suggestions, anything will be greatly appreciated. Sincerely, Erich J. Ruth

    C / C++ / MFC question help

  • tricky question about endl
    E Erich Ruth

    I really appreciate your response. I have gotten responses from you before and they have always been helpful. For some reason, I still can't get my code to work. I managed to reduce it to the following error. If I type at the end of my function cout << "." << endl; the code works fine, but I get along list of periods before I get the answer. If I type cout << "."; or cout << "." << "\n"; or puts(""); or anything that doesn't have the endl command, then my calculations are way, way, way off. It does not make any sense to me why is works with endl. In a book I read, it says endl "flushes the stream", but the command cout.flush(): doesn't "flush" anything. I am going nuts! Please any response you can give me will be gretly appreciated. Sincerely, Erich J. Ruth (an overworked graduate student)

    C / C++ / MFC question help

  • tricky question about endl
    E Erich Ruth

    I have a function that keeps returning a value. For some reason, when I have at the end of that function cout << "." << endl; everything works, I get a new value each time. If I leave this command off or type cout << "."; I get an error in my calculations. Several sources say "the endl command outputs a newline character and flush the stream". How can I "flush the stream" without creating a new line? Any response any one can give me will be greatly appreciated. Sincerely, Erich J. Ruth

    C / C++ / MFC question help

  • Is there any way of printing text on top of a pdf file, without printing the pdf then asking the user to stick the paper back into the printer?
    E Erich Ruth

    I have a pdf file. I can read the file, but I can't edit it. Is there any way of printing text on top of the pdf file without printing the file and then asking the user to put the paper back into the printer to print the text on top of it. Please, any response any one can give me will be greatly appreciated. Sincerely, Erich J. Ruth (an overworked graduate student)

    C / C++ / MFC question

  • How can I open a file without typing in the full path?
    E Erich Ruth

    I open a file for reading by typing: ofstream datain("c:\\my_program\\data\\my_file.txt", ios::in); The problem is, when I give the program to some people, they have the data on the c: drive while others have data on the d: drive or something different. Is there any way of opening this file without specifying the drive? I tried typing: "..\\my_program\\data\\my_file.txt" as well as "../my_program/data/my_file.txt" but nothing has worked yet!! Please, any response any one can give me will be greatly appreciated. Sincerely, Erich J. Ruth (an overworked graduate student)

    C / C++ / MFC question ios help

  • Does any one know how to create that page break line in an edit box??
    E Erich Ruth

    If you look at microsoft word or at wordperfect, when you get to the bottom of a page, a little line appears that looks like the following: -------------------------- End of Page -------------------- It is any way of creating this feature for an edit box? Please, please, please any response any one can give me will be greatly appreciated. Sincerely, Erich J. Ruth (an overworked graduate student)

    C / C++ / MFC tutorial question

  • (Hopefully) a simple question on classes and inheritance.
    E Erich Ruth

    I developed several class using unix g++ compiler. I developed one class in particular, called CEditString, that edits string pointers. Every other class that I created uses this CEditString class. At the top of all these other classes, I type #include "EditString.H" and within that class I type public: CEditString EditString; The problem is, when I compile, I get the following error: /code/EditString.H: In method `CEditString::CEditString()': In file included from /code/AtomLocation.H:11, from /code/ProteinStructure.H:13, from topView.C:7: /code/EditString.H:56: redefinition of `CEditString::CEditString()' /code/EditString.H:56: `CEditString::CEditString()' previously defined here. I know that I am redefining the class, but if I don't redefine, then I get that error that 'CEditString' undeclared. This is really frustrating. Is there any way of destroying the class so that when I do call it, I am not redefining it? Please, any response any one can give me will be greatly appreciated. Sincerely, Erich J. Ruth (an overworked graduate student)

    C / C++ / MFC help question oop

  • How can I change font for just say one line in a multiline edit box?
    E Erich Ruth

    I have a multiline edit box with scrolling vertical bars. The user sometimes types lots of text in this edit box. I want the user to know where the end of each page is. So I want to say something like if this is the 50th line of the edit box then insert the text 'End of Page' and make this text smaller and bolder in color I know how to find every 50th line of text. My question is, how can I change the font for just one line of text in a multiline edit box? Any response any one can give me will be greatly appreciated. Sincerely, Erich J. Ruth

    C / C++ / MFC question tutorial

  • How can I give a 30 day working version of a program?
    E Erich Ruth

    I want to give people a 30 day working version of software that I write and after which time, if they haven't entered the correct password then the program fails to execute. If I just hardcode some password like 'duckpond', then what stops an individual from giving that password to someone else? Nothing. I am confused and frustrated. Please, any response you can give me will be greatly appreciated. Details and a sample project would be cherished. Sincerely, Erich J. Ruth (an overworked graduate student)

    C / C++ / MFC question announcement
  • Login

  • Don't have an account? Register

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