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
J

Joe Smith IX

@Joe Smith IX
About
Posts
88
Topics
30
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Pass by pointer not working
    J Joe Smith IX

    1. I didn't copy the whole code, just the snippet. 2. Yes, I did. That's how I could state 'it stays as NULL before and after the call'. 3. I do. Thanks. 4. Same reason as number 1 above. Anyway, I solved it as pointed by CPallini below. I was missing the ampersand symbol to indicate passing by pointer. Thanks anyway.

    C / C++ / MFC help question

  • Pass by pointer not working
    J Joe Smith IX

    Ah, you are right. To pass by address, I need the & character. It's working fine now. Thanks so much.

    void CMyApp::CallDlg(int nType, CMyDlg* &pDlg)
    {
    // ...
    }

    C / C++ / MFC help question

  • Pass by pointer not working
    J Joe Smith IX

    Hi all, I have a variable declared:

    CMyDlg* m_pDlg1;

    I initialized it as NULL and expected it to change when passed to CallDlg. But it stays as NULL before and after the call, therefore creating new modeless CMyDlg everytime it gets called (instead of bringing up the existing one the foreground). What did I do wrong? Shouldn't m_pDlg1 point to the newly created dialog? Please help. Thanks in advance.

    void CMyApp::ActivateDlg1()
    {
    CallDlg(1, m_pDlg1); // the variable stays as NULL
    }

    void CMyApp::CallDlg(int nType, CMyDlg* pDlg)
    {
    if(pDlg) pDlg->SetForegroundWindow(); // This never gets called
    else
    {
    pDlg = new CMyDlg(nType);
    if(!::IsWindow(pDlg->GetSafeHwnd())) pDlg->Create(IDD_MY_DLG, NULL);
    }
    }

    C / C++ / MFC help question

  • TextOut/DrawText is too slow
    J Joe Smith IX

    OK guys, thanks for the pointers. Let me try that approach.

    C / C++ / MFC com performance help question

  • TextOut/DrawText is too slow
    J Joe Smith IX

    Hello, I am looking into a full-screen text scrolling app, and found this at code project: [^] It is simple and fits my need. The only problem is that when I maximize it, its scrolling speed is way too slow (even when I take off the image and the delay iss set to 1ms). Can anyone give me some hints or pointers (sample code, maybe) on how I can make it faster? Thanks in advance.

    C / C++ / MFC com performance help question

  • How to calculate average of qty sold the last 6 months or less
    J Joe Smith IX

    Thanks a lot. Your answer pointed me to the answer I am looking for.

    Database css database help tutorial question

  • How to calculate average of qty sold the last 6 months or less
    J Joe Smith IX

    Thanks a lot. Your answer pointed me to the answer I am looking for.

    Database css database help tutorial question

  • How to calculate average of qty sold the last 6 months or less
    J Joe Smith IX

    Table [Sold]

    ID PID Qty Date


    1 1 8 jun 1, 2010
    2 3 5 jul 1, 2010
    3 3 2 aug 1, 2010
    4 1 1 sep 1, 2010
    5 3 4 sep 30, 2010
    6 2 3 oct 8, 2011
    7 2 5 nov 1, 2011
    8 3 2 dec 1, 2011
    9 1 8 jan 1, 2011
    10 2 5 feb 1, 2011

    Hi all, I have difficulty composing a rather complex (for me) query. I would like to know the average qty sold of each PID per day based on the last 6-month data. If data is less than 6 month, then adjust accordingly. So on the data above: Today: Mar 24, 2011 6-month cut-off: Sep 24, 2010 I want to get:

    PID Qty/day


    1 8/182 = 0.0440
    2 (3+5+5)/168 = 0.0774 -> 168: because the oldest sale is oct 8
    3 (4+2)/182 = 0.0330

    Is there any way I can do this? Somebody help me, please? Thanks in advance.

    Database css database help tutorial question

  • How to insert text at cursor position in a web browser?
    J Joe Smith IX

    Hi all, This is what I did (VC++ 6.0): 1. Add a new dialog 2. Insert ActiveX Control: Microsoft Web Browser (which added CWebBrowser2 class) 3. Add the object in the dialog 4. Create a variable for that object (CWebBrowser2 m_ctlBrowser;) Now, so far so good. I can go to the website I want. My question is: once I am in the desired website which prompts user input, I want to be able to simply press a button to fill it out. Let's say I already put the cursor there and there is only one "edit box" to fill. Is this doable? Thanks for any suggestion.

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

  • Copy Folder to Folder
    J Joe Smith IX

    Try "Search Messages" for FindFirstFile in this site. There were quite a few examples.

    C / C++ / MFC question help

  • Copy Folder to Folder
    J Joe Smith IX

    Hi, Try using FindFirstFile and FindNextFile to enumerate all files in Folder A, then use CopyFile to copy each found file to Folder B. (You can use CreateDirectory to create Folder B if it doesn't exist).

    C / C++ / MFC question help

  • How to pass array of byte?
    J Joe Smith IX

    I knew I was missing something simple, but I do not expect it to be that simple. Thanks a lot.

    C / C++ / MFC data-structures help tutorial question

  • How to pass array of byte?
    J Joe Smith IX

    I am trying to pass an array of binary data from one function to another, but it fails. Why?

    void C1:Caller()
    {
    BYTE *pTemplate = NULL; DWORD dwSize=0;
    GetData(pTemplate, dwSize);
    // in here dwSize=1024, which is correct
    // but pTemplate is NULL! Why?
    }

    void C1:GetData(BYTE *pTemplate, DWORD &dwSize)
    {
    delete pTemplate;
    pTemplate = NULL;

    dwSize = 1024;
    pTemplate = new BYTE[dwSize];
    // ... fill pTemplate with desired data
    }

    Anyone can help me here? Thanks.

    C / C++ / MFC data-structures help tutorial question

  • Blank printout to printer
    J Joe Smith IX

    I am NOT using Doc/View framework. The view/doc I am using are the classes from the custom control I am using (number 3 in my original post). The function that prints on the screen is

    void CReportView::OnDraw(CDC* pDC)
    {
    CReportDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    pDoc->Draw(pDC);
    }

    The pDC above is pointing to the screen, right? My thinking is that if I use the use printer's pDc, then it should print out on the printer, yes?

    void CReportView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
    {
    CReportDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    pDoc->Draw(pDC);
    CScrollView::OnPrint(pDC, pInfo);
    }

    C / C++ / MFC c++ help com

  • Blank printout to printer
    J Joe Smith IX

    That one doesn't have print preview, does it? My reports should be shown on the screen to the user, along with the option to print it out. So you can't locate the problem in the code? Regards, jsix

    C / C++ / MFC c++ help com

  • Blank printout to printer
    J Joe Smith IX

    I use the ReportViewDlg to show the report in the custom control (see number 3 in my initial post). I think the pDC is correct. Here is the function where I inserted the DrawText that prints OK.

    void CReportView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
    {
    CReportDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    pDoc->Draw(pDC); // This does not print anything

    CRect printArea;
    printArea.SetRect(0, 0, pDC->GetDeviceCaps(HORZRES), pDC->GetDeviceCaps(VERTRES));
    pDC->DrawText("My Test is OK.", printArea, DT_NOPREFIX | DT_WORDBREAK); // This prints OK

    CScrollView::OnPrint(pDC, pInfo);
    }

    C / C++ / MFC c++ help com

  • Blank printout to printer
    J Joe Smith IX

    Ah, so you can't compile it now, I see. Could you please try it later? In Chris' article, it shows that the parameters are set from CMyDialog::Print() and pass them to the view class.

    OnPrint(&dc, &Info); // Call your "Print page" function

    Anyway, I tried setting/calling the print dialog from within the view, same result: empty page.

    C / C++ / MFC c++ help com

  • Blank printout to printer
    J Joe Smith IX

    Thanks for the tips, but actually I once trying inserting one DrawText function and it printed out the text fine, but the report was not printed. So I am guessing that the parameter for the printer were correct already and problem is somewhere else. Did you try compiling and printing my report? (I know printing is not easy. But I want to have something printed out first, correctly or not, before experimenting/learning other parameters).

    C / C++ / MFC c++ help com

  • Blank printout to printer
    J Joe Smith IX

    Hi, Yes, following the article number 4, I use CreaterPrinterDC and initialize m_rectDraw and m_nCurPage. I do not change the page orientation nor the MAPMODE (I figure I can deal with this later IF the printed results is incorrect, yes?) Regards, jsix

    C / C++ / MFC c++ help com

  • Blank printout to printer
    J Joe Smith IX

    Hi all, I am writing an MFC program (VC++ 6) that generates a report and supposedly able to print it out. The report is fine, but somehow it prints a blank page to the printer. After days of debugging the code, I still cannot locate the problem. This is why I can't simply post the problematic code here, I don't know which part is the problem! (Please forgive me if this is really not the right way to ask) Here I created a (much) simplified code that simulates my problem. It could be because: 1. It is SDI-based program, but I deleted the CDocument class since I don't need it. 2. I use Easy! Reports (http://www.codeproject.com/KB/miscctrl/easyreports.aspx[^]) to generate the report 3. The report is shown using a custom control (http://www.codeproject.com/KB/docview/dfv.aspx[^]) 4. Lastly, I am trying to print without using doc/view framework (http://www.codeproject.com/KB/printing/printing_wo_docview.aspx[^]) Could anyone please help me here. From what I understand, all I have to do is prepare the device context for printing (using number 4 above) and send it to the report generator function (number 2). Yet, it prints a blank page. If anyone could please take a glance and point me to the right direction, I would really appreciate it. Thanks. Download link: http://rs324.rapidshare.com/files/121245334/TestReport.zip[^]

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

  • Don't have an account? Register

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