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
M

MAAK

@MAAK
About
Posts
75
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Can't access IIS remotely
    M MAAK

    I already mentioned (may be not explictly) that the netowrk is established normally, the machines has its valid IP (obeying the DHCP IP range and mask), pinging working very well, the Laptop can access the internet through the PC brdige, almost every thing from the point that machines are correctly connected is OK. It is just that the intranet sites are not accessable, I just doubt that it may be related to the gateway and DNS configuration. It's like the http request might be passed through them and never get to its destination. I also knew about existance of routing table in the system, I donno much about it, but it might be a way to solve the problem if it was the gateway. I just don't get any info about the routing table and if it related to the problem

    System Admin help sysadmin windows-admin tutorial workspace

  • Can't access IIS remotely
    M MAAK

    well i already mentioned that connecting through wifi using static IPs on both sides without the bridge everything works well, it seems that there is a problem accessing just the http server when the router-network configuration

    System Admin help sysadmin windows-admin tutorial workspace

  • Can't access IIS remotely
    M MAAK

    1. the WinXP has a nice feature called network bridge that can bridge two or more network adapters to brdige different networks together 2. i have no trouble in connection, i did say that the laptop joined the network 3. for your question, I didnt use the hard way except if there is no simpler way, so just assume that the route is a "yesterday router" with no wifi and single ethernet outlet, or simply it's too far to establish another wired or wireless connection again the network is working well in terms of file sharing and pinging, the only problem is that i cannot access the IIS remotely unless i establish a dedicated static IPs wifi connection Thanks

    System Admin help sysadmin windows-admin tutorial workspace

  • Can't access IIS remotely
    M MAAK

    I would have tired this and saved me lots of trouble in connecting in the first place, but simply the router is too remote from me to make another wired connection or access it through wifi. Please note that I have no problem with connection and the laptop is joining the network and is seen as part of it, the remote IIS acess is the only problem

    System Admin help sysadmin windows-admin tutorial workspace

  • Change windowsXP start button
    M MAAK

    I once just changed the "start" text using resource hacker. As I remember it was a string resource in the explorer.exe, but to do it you need to make from another operting system instance (mean that your pc have more than one windows) because there is some kind of file protection system in the windows that restores the explorer.exe (I donno how!!) if it was tampered while the OS is running. I have no idea about the image, but it should be part of the windows skin (the luna)

    System Admin question csharp database com

  • Can't access IIS remotely
    M MAAK

    Hi! I have have a problem of accessing the IIS http site remotely when establishing network with DSL router acting as DHCP. My configuration is as follows: - I have a router connected to the internet and acts as DCHP - I have my PC directly connected to the router through wired ethernet and obtain its IP address from the router - On the PC I bridged my wired ethernet connection with a wifi connection so that my laptop can join the network and access the internet - The laptop obtains its address also from the router through the PC bridge now the laptop can see the PC from the network places and can share files and transfere files with no problems, but when I try to browse an IIS website on the PC from the laptop it cannot reach it. The strange thing is that if I removed the bridge and established a wifi network using static IPs on both sides, the problem disappears and the site becomes accesable from the laptop, but once I bridge the connections back and the laptop join the network DHCPed by the router the site is not accessable again. Please if anyone have an idea how to configure the network so that I can access the IIS remotley with the above network configuration please tell me. Thanks in advance for your help M@@K

    System Admin help sysadmin windows-admin tutorial workspace

  • AfxWndProc hook
    M MAAK

    Well, as far as I know that MFC uses window subclassing to override the default WndProc. Hooking is usually used to install the MFC WndProc to the created window. I dont know what hooks exaclty, but definitely not WH_CALLWNDPROC hook or anything like it, which involve notification of frequent events. Usually WH_CBT is used, which can notify the hooking application about creation of windows. Another thing, there is a difference of local hooking used in this process and global hooking in which the hook is installed over the whole system. To sum up, the hooking is used just to initiate subclassing and it's local to the process. Subclassing doesnt degrade performance (actually it is done using APIs). So if there existed a degreade on performance of MFC application I think hooking wont be the reason. Am saying this with accordance to my knowledge, hope if there is anything wrong someone would correct it

    C / C++ / MFC c++ json question

  • Weird popup menu display on XP
    M MAAK

    Am replying according to the snapshots you sent, cuz I encountered such weird effect before and it mya be the same problem. I have encountered this problem when I was making an owner draw menu, which I guess you are making one as well. According to the MSDN you shall save the DC state that is passed to you in the DRAWITEMSTRUCT struct and restore it back. I found that this is simply calling SaveDC and RestoreDC. Follwing is the code i used:

    void CMainFrame::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
    {
    // TODO: Add your message handler code here and/or call default
    if(nIDCtl == 0) //check if menu
    {
    	CDC dc;
    	dc.Attach(lpDrawItemStruct->hDC); //wrap the HDC into a CDC
    	dc.SaveDC();
            //draw the menu item
            .
            .
            .
    	dc.RestoreDC(-1);  //restore the dc to the previous state
    	dc.Detach();       //detach the HDC from the CDC to prevent its destruction
    }
    }
    

    When added this lines it did solve the problem and menus didnt show this effect anymore, so I hope this solves your problem.

    C / C++ / MFC help csharp c++ wpf question

  • How do I stop a do/while loop using a toolbar
    M MAAK

    I think the normal thing to be done in this case is running your do/while loop in a separate thread so you can handle all the messages, including toolbar notifications, from the main application thread normally. Your while loop condition should check on a global variable that is to be changed by the toolbar message to fail the condition.

    C / C++ / MFC question

  • Subclassing windows of other processes
    M MAAK

    Am not sure, but won't using WH_CALLWNDPROC or WH_CALLWNDPROCRET hooks to obtain the handle of the window or its controls after creation then using SetWindowLong() to set the GWL_WNDPROC property could do the job of subclassing the window after its creation?

    C / C++ / MFC question

  • Subclassed Control
    M MAAK

    When talking about assertion, it's needed to know what is its condition from the file it exists in. However, I guess that the possible assertion that could occur in your code is the IsWindow() assertion (ASSERT(::IsWindow(hWnd)) which indicate the the HWND passed to the Attach() function is invalid. When you get an assertion in debug mode, click retry to see the assertion condition.

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

  • CString::SetAt
    M MAAK

    if you need to insert a string into certain position there is CString::Insert()

    CString str;
    str.Insert(0, "TEST");
    
    C / C++ / MFC help question

  • Dynamic Matrix!
    M MAAK

    Well I think I didn't think about it correctly, cuz when I think about it again I found that the int ** seems to have better performance than the 1D array implemenation, and it may be not related to how data is near to each other. The int ** needs 4 mov micro instruction to get the effective address, while the 1D needs 2 mov, one multiplication (which I think more costy and which make the whole overhead) and one addition operation to get the effective address. This is the assembly code for getting the effective address in the 1D implementation for a matrix 10 x 10 to access element (i, j)

    ar[j * w + i] = 5;
    mov         eax,dword ptr [j] 
    imul        eax,dword ptr [w] 
    add         eax,dword ptr [i] 
    mov         ecx,dword ptr [ar] 
    mov         dword ptr [ecx+eax*4],5 
    

    This is code for the int ** implementation for a matrix 10 x 10

    ar[i][j] = 5;
    mov         eax,dword ptr [i] 
    mov         ecx,dword ptr [ar] 
    mov         edx,dword ptr [ecx+eax*4] 
    mov         eax,dword ptr [j] 
    mov         dword ptr [edx+eax*4],5
    

    however, I found that the the 1D representation is more commonly used for example, this is how the same thing work for a static 2D array declared in the compiler:

    ar[i][j] = 5;
    mov         eax,dword ptr [i] 
    imul        eax,eax,28h 
    lea         ecx,ar[eax] 
    mov         edx,dword ptr [j] 
    mov         dword ptr [ecx+edx*4],5
    

    If you checked it thourougly you will find that it's similar to the 1D, but it has optimization due to previous knowledge of the array size. [All assembly code is obtained using VC++ debugging disassembly] This approach is useful in data serializzation since serialization can be done using single call to I/O device, bitmaps for example are stored in memory as a single 1D array. I hope if anyone has more infomation about this issue shares it with us, cuz am more curios about it.

    C / C++ / MFC question

  • Dynamic Matrix!
    M MAAK

    if you just need 2d array that doesnt shrink or grow frequently then you can use two approaches, pointers to pointers or a 1d array accessed by formula. for pointers to pointers this is how it's done:

    int ** p; //a pointer to an integer pointer
    p = new int * [10]; //create 10 new integer pointers
    
    for(int i = 0; i <10; i++)
    	p[i] = new int[10];
    for(int i = 0; i < 10; i++)
    	for(int j = 0; j < 10; j++)
    		p[i][j] = rand();
    for(int i = 0; i <10; i++)
    	delete [] p[i];
    delete [] p;
    

    for 1d arrays, you make an array with size m * n and access elements at i,j by formula j * m + i, where m are rows and n are columns.

    int * p = new int[m * n];
    
    for(int i = 0; i < n; i++)
    	for(int j = 0; j < m; j++)
    		p[j * m + i] = rand();
    delete [] p;
    

    this approach is better since the whole array elements are compact together rather than having group of 1d arrays scattered in the memory. if you need an array that grows and shrink frequently, then you may use template containers to make array or arrays, rather than making your own class for it. for example, if you gonna use the STL vector container you can declare the array as follows: vector< vector > my_matrix; //declare a vector of integer vecotrs //a space must be inserted between the last two '>' //symbol to be differentiated from insertion operator my_matrix.resize(10); //initialize the matrix to contain 10 rows //intialize each row to contrai 10 elements for(int i = 0; i <10; i++) my_matrix[i].resize(10); //fill the matrix with random numbers for(i = 0; i < 10; i++) for(int j = 0; j < 10; j++) my_matrix[i][j] = rand(); this also can be done using the MFC's CArray using the declaration

    CArray< CArray, CArray > my_matrix;
    
    C / C++ / MFC question

  • Question about the new features in VS.Net 2003
    M MAAK

    Concerning the second question. The oulining (the + and -)is availabe in version 2002 as well but it's not enabled by default. To control this in 2002 you should go to Tools|Options then in the options dialog go to Text Editor->C/C++->Formatting and check or uncheck the Outlining option. I dont know if there is a difference between the options dialog in 2002 and 2003 but I hope this could help.

    C / C++ / MFC csharp visual-studio question c++ announcement

  • HELP! Anyone know MFC here?
    M MAAK

    Another note concerning the code of you derived CButton class. The code did not work becuase the BN_CLICKED message is not sent to the button, this message is sent to the parent of the button. Therefore the message is not sent to the button in the first place.

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

  • HELP! Anyone know MFC here?
    M MAAK

    You dont need to inherit from CButton to handle the click event of your button All you have to do is to add a button notification handler in the view class for the id of your button, and ensure that the button's id is unique in order not to conflict with other controls. This code should explain it:

    //in the class declaration
    class CTstButtonView : public CView
    {
    	.
    	.
    	CButton m_btn;
    	afx_msg void MyButtonHandler();
    	.
    	.
    };
    
    //this code is in the message map
    BEGIN_MESSAGE_MAP(CTstButtonView , CView)
    	.
    	.
    	ON_BN_CLICKED(ID_MYBUTTON, MyButtonHandler)
    	.
    	.
    END_MESSAGE_MAP()
    
    //implementation of the OnInitialUpdate
    void CTstButtonView::OnInitialUpdate() 
    {
    	CView::OnInitialUpdate();
    	//if the button is not already created
    	if(!m_btn.GetSafeHwnd())
    		//create the button, WS_VISIBLE can be ised instead of using
    		//ShowWindow
    		m_btn.Create("TEST", WS_CHILD|WS_VISIBLE, CRect(0,0, 200, 100), this, ID_MYBUTTON);
    }
    //implementation of the button's handler funciton
    void MyButtonHandler()
    {
    	AfxMessageBox("My Function!");
    }
    

    note that in your code you made the parent window of the button is the main window which is the CMainFrame class, if you want it this way you may need to move the handler function and handler message map to the CMainFrame instead of the CView

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

  • modeless Dlg
    M MAAK

    There is another simple way to do it. To move the dialog the user must drag the caption bar, thus you can override the WM_NCHITTEST message and disable the system from recognizing that the mouse is in the caption bar. This code shows ho that is done:

    UINT CMyDlg::OnNcHitTest(CPoint point)
    {
    	//store the value returnd by the WndProc	
    	UINT hitResult = CDialog::OnNcHitTest(point);
    	//if the mouse is in the caption bar, change the result to HTNOWHERE
    	//so the system does not recognize that the mouse is in hte caption
    	if(hitResult == HTCAPTION)
    		return HTNOWHERE;
    	//any other result mus t be returned as it is
    	return hitResult;
    }
    
    C / C++ / MFC question

  • modeless Dlg
    M MAAK

    This is another way to do it. To move the dialog the user should drag the dialog caption. you can override the WM_NCHITTEST message and disable the HTCAPTION result from reaching hte system. the could should be like this

    UINT CMyDlg::OnNcHitTest(CPoint point)
    {
    	//Store the result returned by the dialog's WinProc    
    	UINT hitResult = CDialog::OnNcHitTest(point);
    	//if the mouse is in the caption bar change the result to HTNOWHERE
    	//so the system wouldn't recognize it
    	if(hitResult == HTCAPTION)
    		return HTNOWHERE;
    	//any other result should be returned as it is
    	return hitResult;
    }
    
    C / C++ / MFC question

  • Check if file existe, get temporary file name?
    M MAAK

    to check if a file exist you can use the shell function

    BOOL PathFileExists(
        LPCTSTR pszPath
        );
    

    it takes the file path and return 1 if it exist and 0 if not for temporary files, there is the function

    UINT GetTempFileName(
      LPCTSTR lpPathName,      // directory name
      LPCTSTR lpPrefixString,  // file name prefix, first three letters is taken only
      UINT uUnique,            // integer
      LPTSTR lpTempFileName    // file name buffer
    );
    

    which can be used to generate temporary file names. The temporary path is formed like this lpPathName+'\'+lpPrefixString+[uUnique as hexadecimal] + ".tmp" and returned in the lpTempFileName for e.g if the path is c:\ and the unique integer is 10 and the prefix is "fil" the result will be c:\fil000A.tmp. The uUnique parameter should have a unique integer value but if you passed 0 the system will assign this unique value.

    C / C++ / MFC 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