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
H

Hosam Aly Mahmoud

@Hosam Aly Mahmoud
About
Posts
61
Topics
10
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Arabic characters in a console window
    H Hosam Aly Mahmoud

    I want to create a console application (using Visual C++ 6.0) that can input and output Arabic characters. I tried the following code:

    #define UNICODE
    #include <tchar.h>
    #include <iostream>

    int main()
    {
    TCHAR in[10];
    std::wcin >> in;
    std::wcout << in;
    }

    When I run the program I try to type an Arabic word, but strange characters appear (those at the 2nd half of the ASCII table). The "cout" statement does absolutely nothing. All help would be appreciated. Thank you in advance.

    Hosam Aly Mahmoud

    C / C++ / MFC c++ help

  • Detecting mouse/KB events on another Application
    H Hosam Aly Mahmoud

    Look for "Hooking" or "Hooks".

    Hosam Aly Mahmoud

    C / C++ / MFC help tutorial

  • SendMessage(MainWnd) from another thread
    H Hosam Aly Mahmoud

    Thanks for your reply, but could you point out an alternative?

    Hosam Aly Mahmoud

    C / C++ / MFC json help question

  • SendMessage(MainWnd) from another thread
    H Hosam Aly Mahmoud

    Thanks for your help. I am sorry to say that your clarification missed a bit. I want to stop the secondary thread, and get out the message box. After the message box returns yes or no, the secondary thread will do work according to the user's choice. But thanks for your help anyway! :rose:

    Hosam Aly Mahmoud

    C / C++ / MFC json help question

  • SendMessage(MainWnd) from another thread
    H Hosam Aly Mahmoud

    I have an API program in which I have one thread other than the main thread. In the other thread, I wrote MessageBox(globalMainWndHWND, ...), trying to get a message under my main window. The problem is that at this step the MessageBox function does not return! I thought that Windows might prevent threads from using objects created by other threads. I tried to pass the HWND as a parameter to the thread function (instead of using the global variable), but the same problem happened again. SendMessage did the same thing. Could someone please tell me how I could solve this problem? Thank you very much.

    Hosam Aly Mahmoud

    C / C++ / MFC json help question

  • C++ Octree structure
    H Hosam Aly Mahmoud

    Excuse me, but is your code somehow better than the following?

    struct Node { Node * children[8]; } *pRoot = 0;

    void _Add( Node *pNode, Datum* pDatum )
    {
    if ( 0 == pNode )
    {
    pNode = new Node;
    // assign data

      memset( pNode->children, 8\*sizeof(Node\*) );
      return;
    

    }
    // else
    if (...) { _Add(pNode->children[0], pDatum); return; }
    // ...
    }

    Hosam Aly Mahmoud

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

  • reverse_iterator
    H Hosam Aly Mahmoud

    Thanks for your reply. Your code does the opposite of what I wanted. I would change it to:

    {
    RectList::reverse_iterator next = ri;
    *ri = *(++next);
    }

    Thanks anyway.

    Hosam Aly Mahmoud

    C / C++ / MFC c++ help

  • reverse_iterator
    H Hosam Aly Mahmoud

    Thanks for your reply. But why can't I add to the iterator? According to MSDN[^], the reverse iterator contains operator+. What I don't know is what this operator takes as input. Anyway, I changed my code to this and it compiled:

    for ( RectList::reverse_iterator ri = myList.rbegin(), ri2 = myList.rbegin();
    ri2 != myList.rend(); ++ri )
    *ri = *(++ri2);

    Thank you for your help.

    Hosam Aly Mahmoud

    C / C++ / MFC c++ help

  • diagonal controls
    H Hosam Aly Mahmoud

    I have never tried it, but may be using regions will solve your problem.

    Hosam Aly Mahmoud

    C / C++ / MFC help workspace

  • reverse_iterator
    H Hosam Aly Mahmoud

    I have an STL list, and I want to move on it from back to front. I am trying to use the reverse_iterator, but I am getting a compilation error. Here is my code:

    typedef std::list<RECT> RectList;
    RectList myList; // The list is created and initialised elsewhere

    for ( RectList::reverse_iterator ri = myList.rbegin();
    ri != RectList.rend(); ++ri )
    {
    *ri = *(ri + 1);
    }

    I get the following errors in the last line: error C2784: 'class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> __cdecl std::operator +(_D,const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &)' : could not deduce template argument for '' from 'class std::reverse_bidirectional_iterator<class std::list<struct tagRECT,class std::allocator<struct tagRECT> >::iterator,struct tagRECT,struct tagRECT &,struct tagRECT *,int>' error C2676: binary '+' : 'class std::reverse_bidirectional_iterator<class std::list<struct tagRECT,class std::allocator<struct tagRECT> >::iterator,struct tagRECT,struct tagRECT &,struct tagRECT *,int>' does not define this operator or a conversion to a type acceptable to the predefined operator

    Hosam Aly Mahmoud

    C / C++ / MFC c++ help

  • output file in VC++
    H Hosam Aly Mahmoud
    1. When is the file empty? Do you check while your program is running or afterwards? 2) Make sure you have out.close(); after you finish. This is to make sure everything is output on the file.

    Hosam Aly Mahmoud

    C / C++ / MFC c++ question

  • MFC and std namespace-beginner question
    H Hosam Aly Mahmoud

    You're welcome.

    Hosam Aly Mahmoud

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

  • Help with templates (newbie)
    H Hosam Aly Mahmoud

    Microsoft Visual C++ 6.0 with SP5. I said it compiled, but I did not run it.

    Hosam Aly Mahmoud

    C / C++ / MFC help wpf question

  • Can anybody suggest an email provider?
    H Hosam Aly Mahmoud

    I removed it. Cheer up!

    Hosam Aly Mahmoud

    The Lounge com question

  • MFC and std namespace-beginner question
    H Hosam Aly Mahmoud

    The things I will say in this reply are MS Visual C++ 6.0 specific. I have not tried them on any other compiler. 7stud wrote: My compiler does recognize "std" as a namespace for win32 console apps You probably use #include <iostream>, which includes the std namespace. But, the cmath header file does not contain the std namespace. In fact, the following code is perfectly legal:

    #include <cmath>
    int main() {
    double x = sqrt(5);
    }

    But this one is not:

    #include <cmath>
    using std::sqrt;

    So you don't need to use the std namespace if you are going to use cmath in Visual C++ 6.0. Hope this helps.

    Hosam Aly Mahmoud

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

  • Stay On Top - Advice Needed
    H Hosam Aly Mahmoud

    I am happy it worked! :-D

    Hosam Aly Mahmoud

    C / C++ / MFC help tutorial question

  • Help with templates (newbie)
    H Hosam Aly Mahmoud

    The following code compiled correctly:

    template <typename T>
    class Node { public: T data; };

    typedef template<typename T> Node<T>* pTnode;
    pTnode<int> p;

    Hosam Aly Mahmoud

    C / C++ / MFC help wpf question

  • Stay On Top - Advice Needed
    H Hosam Aly Mahmoud

    As I tried to look it up, I saw that you may be able to handle it as follows:

    case WM_KILLFOCUS:
    if ( wParam != 0 )
    {
    WINDOWINFO wi;
    GetWindowInfo( (HWND)wParam, &wi ); // sorry, did not check for errors
    if ( (wi.dwExStyle & WS_EX_TOPMOST) == WS_EX_TOPMOST )
    {
    SetWindowPos( (HWND)wParam, HWND_TOP,
    0, 0, 0, 0, // ignored
    SWP_NOMOVE | SWP_NOSIZE |
    SWP_NOOWNERZORDER | SWP_NOSENDCHANGING );
    }
    }
    return 0;

    Hope this helps (and hope I am not wrong!).

    Hosam Aly Mahmoud

    C / C++ / MFC help tutorial question

  • Stay On Top - Advice Needed
    H Hosam Aly Mahmoud

    I hope I will not waste your time. I am a beginner and had never tried making my window on top, but I think that you do it by setting the window's style. I have an idea, but I do not know whether it is correct or applicable. If an application presents a message box, then your application will lose focus. May be you could handle WM_KILLFOCUS (or OnKillFocus()) and test the window getting focus for its style. If the style contains on top (and maybe message box style), put it somehow in front of your app (I think you would need to change your app's Z-order to make it after the message box). Hope this helps, and sorry for anything wrong I may have said.

    Hosam Aly Mahmoud

    C / C++ / MFC help tutorial question

  • RAM
    H Hosam Aly Mahmoud

    Since you are asking country-specific questions, I prefer to answer this one by e-mail. I sent you an e-mail with my address, so send me one with yours.

    Hosam Aly Mahmoud

    The Lounge hardware
  • Login

  • Don't have an account? Register

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