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
F

f64

@f64
About
Posts
45
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to make arguments as optional in DCOM method ?
    F f64

    Hi there, What you have to modify is your IDL code to use the [optional] attribute for the method declaration. So your code should look something like this

    [id(0x00000001)] HRESULT vListMachine([in] VARIANT SrvName, [in, optional] VARIANT Domain);

    where Domain is an optional parameter. Check the MSDN for the MIDL optional attribute. Fabian

    COM tutorial question

  • Anybody tell me how to use IStream correctly?
    F f64

    Hi there The line 622 in atlbase.h is the -> operator of the CComQIPtr< > class template, and I don't see you are using any instance of it in the code you posted, so I suggest you to open the "Call stack" (Alt + 7) when you get the assert, and follow you way up until you reach the line in your code which is calling the -> operator on an instance of CComQIPtr<>, and then take a look why that pointer is NULL. Regards, Fabian

    ATL / WTL / STL com help tutorial question announcement

  • carriage return in CFile::Write
    F f64

    Hi, How about this?

    CString s = "\r\none more line";
    CFile file("c:\\test.txt", CFile::modeCreate | CFile::modeWrite | CFile::modeNoTruncate);
    file.SeekToEnd();
    file.Write(s, s.GetLength());

    Fabian

    C / C++ / MFC question

  • carriage return in CFile::Write
    F f64

    Hi, I just tried this

    CString s = "First line\r\n";
    CFile file("c:\\test.txt", CFile::modeCreate | CFile::modeWrite);
    file.Write(s, s.GetLength());
    s = "second line";
    file.Write(s, s.GetLength());

    and this is what I see in the text.txt file First line second line Do you see something I did differently? Fabian

    C / C++ / MFC question

  • levels on CP
    F f64

    Hi, I have a question about this. Posting an article, award bronze and posting at least one message adds one extra level, so anybody in his/her first year of membership with one article and at least one message should be silver, isn't it? Then posting another message the second year moves him/her up to gold? Is this right? Could you please clarify it for me. Regards, Fabian

    Site Bugs / Suggestions question help announcement

  • question
    F f64

    Hi, Try OnEraseBkgnd Fabian

    C / C++ / MFC question c++

  • Automatically Determine Dates for Special Occasions
    F f64

    Hi First you should make a list of all the special days you are interested in, and then do a Google search on how to calculate when is each one. For example, Easter, is the Sunday following the Paschal Full Moon (PFM) date for the year; Mother's Day is always the second Sunday of May and so on. There is a way to calculate each an every one of them. Good luck, Fabian

    Web Development help tutorial question

  • Missing Filter
    F f64

    Hi there I think a filter to see only unanswered questions on the message board would be nice. Regards, Fabian

    Site Bugs / Suggestions

  • answer can or cannot
    F f64

    Hi, You may use this article as starting point: Using the Winsock Control Fabian

    Visual Basic help lounge

  • Drag and drop of files in ATL
    F f64

    Hi To have drop capabilities, a control must implement IDropTarget interface and regiter itself as a drop target using the RegisterDragDrop function. Fabian

    ATL / WTL / STL c++ help com hardware

  • OLE
    F f64

    Hi there, You are missing an & in front of Ipic.

    hr = OleLoadPicturePath(OlePathName,NULL,0,0,IID_IPicture,(void **)(**&**Ipic));

    Fabian

    C / C++ / MFC help com

  • Problem with SetTextColor
    F f64

    Hi Check the MSDN fot CWnd::OnCtlColor, it even has a example of what you are asking. You just have to verify the message is for the control you want to change, otherwise do nothing. Extracted form the MSDN

    // This OnCtlColor handler will change the color of a static control
    // with the ID of IDC_MYSTATIC. The code assumes that the CMyDialog
    // class has an initialized and created CBrush member named m_brush.
    // The control will be painted with red text and a background
    // color of m_brush.

    HBRUSH CZilchDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
    {
    // Call the base class implementation first! Otherwise, it may
    // undo what we're trying to accomplish here.
    HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

    // Are we painting the IDC_MYSTATIC control? We can use
    // CWnd::GetDlgCtrlID() to perform the most efficient test.

    if (pWnd->GetDlgCtrlID() == IDC_MYSTATIC)
    {
    // Set the text color to red
    pDC->SetTextColor(RGB(255, 0, 0));

      // Set the background mode for text to transparent 
      // so background will show thru.
      pDC->SetBkMode(TRANSPARENT);
    
      // Return handle to our CBrush object
      hbr = m\_brush;
    

    }

    return hbr;
    }

    Fabian

    C / C++ / MFC json help question

  • Unicode Programming
    F f64

    Hi, Could you be more specific? If I do this

    TCHAR t = 0x01FF;
    SendMessage(WM\_CHAR, (WPARAM)t, NULL);
    

    when I process the message I get wParam == 0x000001FF Fabian

    C / C++ / MFC tutorial

  • Gradients
    F f64

    Hi Check GradientFill() on the Win32 API documentation. Fabian

    C / C++ / MFC tutorial question

  • GDI Gurus, Ellipses
    F f64

    Hi, For most of the devices, the GDI will just delegate the drawing to the device itself because the drawing has been optimized by the manufacturer of that piece of hardware. Check the API GetDeviceCaps, it tells you if the hardware device is capable to draw the primitive, in this case, of an ellipse. Fabian

    C / C++ / MFC c++ css graphics question

  • Creating Excel File -- Autofit cells
    F f64

    Hi ODBC, ADO or OLEDB will only allow you to manipulate data in and out Excel files, to go beyond that, you should use Automation, then you will be able to do, programmatically, anything you have to do. You can take a look here to start, SAMPLE: XLCLIENT: Automation Client for Excel, also search the MSDN for more info. Fabian

    C / C++ / MFC database com help

  • Unicode Programming
    F f64

    Hi, I don't know what do you mean with "...how to send a character..." but if what you want is assign a UNICODE character to a variable, this is how

    TCHAR c = 0x0100;

    Now if you are talking about UNICODE strings, use BSTR or one of the classes that encapsulate it, CComBSTR or _bstr_t. Fabian

    C / C++ / MFC tutorial

  • CString and COM
    F f64

    Hi Aaron, There is an error in the way you are returning the string, what you are doing is passing the address of the string contained on m_bsResponse to the caller, the problem there is if the instance of CPopClient is destroyed the client will end having an address to a string that is not longer valid. So, what you should do is create a copy of the string and return the address of the copy. Remember BSTR is a pointer to a wide character string, so BSTR * is a pointer to a pointer!!!

    STDMETHODIMP CPopClient::get_Response(BSTR *pVal)
    {
    *pVal = m_bsResponse.Copy(); // m_bsResponse is a CComBSTR
    return S_OK;
    }

    And the client should do something like this to call it

    BSTR sResponse;
    IPop->get_Response(&sResponse);

    ... do something with the string

    //Free the string
    SysFreeString(sResponse);

    Fabian

    COM c++ com help question

  • ActiveX &amp; unicode
    F f64

    Hi Well one option is, as you said, having two versions, the other one is using the Microsoft Layer for Unicode on Windows 95/98/Me Systems Fabian

    COM com question

  • help sending a form to bottom
    F f64

    Hi, From VB you can use ZOrder, MyForm.ZOrder 0 will send the form to the top of the z order MyForm.ZOrder 1 will send it to the bottom of the z order If you are looking for more control, check SetWindowPos API function,

    BOOL SetWindowPos(
    HWND hWnd, // handle to window
    HWND hWndInsertAfter, // placement-order handle
    int X, // horizontal position
    int Y, // vertical position
    int cx, // width
    int cy, // height
    UINT uFlags // window-positioning options
    );

    where hWndInsertAfter is a handle to the window to precede the positioned window in the Z order or one of the following values. HWND_BOTTOM HWND_NOTOPMOST HWND_TOP HWND_TOPMOST Check the MSDN for a detailed explanation. Fabian

    Visual Basic json help
  • Login

  • Don't have an account? Register

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