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
S

sawerr

@sawerr
About
Posts
143
Topics
75
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Why is pointer a compound type, not a fundamental type?
    S sawerr

    Compound types, by definition, are types that are derived from other basic types. Right? In my opinion, pointers, with their unique representation( * and &), must be classificated as a fundamental type. Am I wrong?

    C / C++ / MFC question

  • Sockets and Port number
    S sawerr

    @TV Mogul, thanks for the explanation. But I think my knowledge doesn't let me to understand it completely. In your answer, port numbers are used for clients. @Andrew Brock thank you too. We all know that, IP address is client specific. Every client has a distinct IP address. - If I am right, port number is application specific. If one application grabs a port no other application can use it. So, for example,that means one computer mustn't have 2 or more web server that listening port 80. Right? - But also a lot of clients can connect same port. But sometimes we need to serve them from different ports, ( I think TV Mogul's definition is about that) Which conditions should i make a decision that I need a new socket?

    C / C++ / MFC question help

  • Sockets and Port number
    S sawerr

    Hi I have a conceptual question that relates with socket programming. I know that socket number = IP number + Port number and A TCP packet contains four numbers, source IP source port, destination IP destination port. How am I gonna picture port number and applications while socket programming. Is it problem to have two or more applications use same port? or must every application has distinct port number? Is it problem to have two or more clients making communication over same port? or must every client has distinct port number?

    C / C++ / MFC question help

  • ReadFile overlapped i\o
    S sawerr

    Thanks for the answers, I got it. How can you advance file pointer if you don't use overlapped IO?

    C / C++ / MFC question visual-studio com

  • ReadFile overlapped i\o
    S sawerr

    Hi I am using ReadFile with overlapped i\o in synchronous mode. I have 2 questions.

    while (true)
    {
    	BOOL b = ReadFile(hSource, &buffer, 200, &k, &ov);
    	if ((b && k ) == 0)
    	{	
    		break;
    	}
    
    	ov.Offset = ov.Offset + k;
    
    }
    	}
    

    The file that program reads is bigger than 200 byte so it must not return EOF. But it does. When it reads first phase b = 0 (TRUE), k == 0 which means synchronous read operation gets to the end of a file as described here: http://msdn.microsoft.com/en-us/library/aa365690%28v=vs.85%29.aspx[^] My first question is, why does program return EOF even though file 6KB. My second question is, I want to read file in a loop as seen here: ov.Offset = ov.Offset + k; But i don't understand what is the differences between offset and offsethigh. I mean which one must be increased? I don't really understand the effect of offset and offsethigh. First i thought offset must be beginning and offsethigh is the ending so i must advanced both of them but i think this is not true. Thanks...

    C / C++ / MFC question visual-studio com

  • Calling DLL function that is not imported(MFC and WinMain)
    S sawerr

    Thanks for answers. I know that loader must fill IAT with imported functions. If I don't import a function so function can't be placed in IAT. So even this function is exported from dll, Windows can't call it. But i'm not sure about that so i started that thread. I understand that winmain(or whatever) isn't added to import section by exe, this is special case for entry point. A function can be called without adding IAT is entry point. This is valid just for entry point. Is that right?

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

  • Calling DLL function that is not imported(MFC and WinMain)
    S sawerr

    Hi We know that, WinMain is buried in the MFC Framework. OK but how can Windows call it? I opened MFC project in VC++ and tried to find out how it imports the dll(Mfc90ud.dll) and functions in that dll. But i couldn't find it. I also disassembled the mfc90ud.dll but there is no function like WinMain in exported function list. Function names are just numbers. So, I have 2 questions. 1-) How does VS knows that Mfc90ud.dll must be imported and Windows know that it must call a function in a dll that is imported by EXE? 2-) If i import a dll and although i do not use one of the imported function in that dll, OS can still call that function? Or OS can only call imported dll functions which are used by exe?? If the function doesn't import by exe, it is never be called? Thanks...

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

  • Service Account - Account Name
    S sawerr

    Hi While installing SQL Server 2008, it asks for Service account and account name, pls click: [^] Here, what are the meanings of options: "NT AUTHORITY\SYSTEM", "NT AUTHORITY\NETWORK SERVICE" etc..? Are these registry keys or something like that. Where can i find information about this stuff? I don't even know which subject they are related and where i must start to search about these. Ihanks...

    Database sysadmin database sql-server com windows-admin

  • Compound Document Support and Automation in MFC Wizard
    S sawerr

    Hi There are 2 similiar(I think) options in MFC App. Wizard. In one step we can set Compound Document Support and in Advanced Features page we can check Automation. But aren't all of them them to support COM technology? Why are there 2 different places to add support? What is the difference between these 2 options? Thanks..

    C / C++ / MFC question c++ com testing tools

  • Setup and Deployment of Database Project without server
    S sawerr

    Hi Can anyone tell is it possible use/store data to a sql database without having database server running itself. I mean do you need to have sql installed onto your machine if you want to use application program that stores/retrieves data from databases. Or is just driver enough? For example. I made an application program that has a GUI, connects to sql database file. So is it enough to install to client machine 1-)Exe 2-)Database Driver 3-)Database file(for example .mdb) to make it run correctly (no connection to server)? Thanks...

    Database database sysadmin tutorial question workspace

  • Message Queues for MFC windows classes
    S sawerr

    Mark Salsbery wrote:

    You're confusing message loops with window procedures.

    Yes, that's right. And now i understand. -One loop -Get Message and -DispatchMessage finds the right window procedure. Thank you for help... :rose:

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

  • Message Queues for MFC windows classes
    S sawerr

    For example if we want to use Edit control in win32 app, the code will be:

    hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "",
    WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL,
    0, 0, 100, 100, hwnd, (HMENU)IDC_MAIN_EDIT, GetModuleHandle(NULL), NULL);
    //http://www.winprog.org/tutorial/app_one.html[^]

    Here we create a "control". That control has a message loop in its source code which was written by controls developer. If an event happens, it is sent to its module(for example user32.dll) not to our application. It sends to our program a notification. OK. But in MFC, We use CEditView which is derived from CView. So we create a new window. And CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "",...) is in the CEditView. Has that view window got a message loop too? If no, how can we handle for example WM_CLOSE

    //class CTextView : public CEditView

    void CTextView::OnClose()
    {
    // TODO: Add your message handler code here and/or call default

    CEditView::OnClose();
    

    }

    You said:

    Mark Salsbery wrote:

    The CWinApp class derives from CWinThread, so for an MFC GUI app, your required CWinApp object generally provides the first/main message loop

    If view window has a message loop, is that mean it is created by a new thread? For example, When user close this CeditView window, is this message sent to Main Window or View Window? If it is sent to main window, does main window route it to view window? I'm sorry, i really don't solve/understand the mechanism... Thank you.

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

  • Message Queues for MFC windows classes
    S sawerr

    Hi We know that Windows keeps a message queue for every thread. If i am not wrong for win32 applications, only one message loop is enough. But in MFC applications, we have Message Map macros(DECLARE_MESSAGE_MAP/BEGIN_MESSAGE_MAP/END_MESSAGE_MAP) for every window class. Mainfrm, chidfrm, childview, doc etc.. Do all of the message map macros that we see in the source code indicate there is a message loop that buried in MFC source code? I couldn't make relation between win32 message handling and MFC message handling. Thanks...

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

  • GetModuleHandle in a DLL
    S sawerr

    No, I exported a function which is called GetModuleHandle(NULL); OK. I got answer. Thank you very much...

    C / C++ / MFC c++ com performance question

  • GetModuleHandle in a DLL
    S sawerr

    Hi "Then the loader maps the executable module at memory address 0x00400000 and the DLL module at 0x10000000." http://www.codeproject.com/KB/DLL/RebaseDll.aspx[^] I built a dll and export a function which is called GetModuleHandle(NULL); Then an MFC application which is included this dll. In Mfc app calling GetModuleHandle(NULL); returns 0x00400000. OK. But when i called an exported function in the dll, it returned 0x00400000 too. But I expected to see 0x10000000. So can we say GetModuleHandle(NULL) always returns EXE's load address even it is in a DLL?

    C / C++ / MFC c++ com performance question

  • WM_SETTEXT and Virtual Address Space [modified]
    S sawerr

    Shame on me. OK. I see it. But although these stupid errors, i think wm_settext+sendmessage could not send text as i tried to explain my previous post.

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

  • WM_SETTEXT and Virtual Address Space [modified]
    S sawerr

    Yes, it is dll to exe. But dll calls SetWindowsHookEx. So it is loaded to all processes address spaces. So it becomes exe to exe, as in the figure: http://www.codeproject.com/KB/DLL/hooks.aspx[^] I thought i could update textbox's text from dll as i tried to explain above.(In dll first get text with Sendmessage-WM_gettext and append new presssed key and send it to the application with SendMessage+WM_SETTEXT)

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

  • WM_SETTEXT and Virtual Address Space [modified]
    S sawerr

    OK. Understood. But is there a way to send a text string to another application with SendMessage+WM_SETTEXT? Because of lPararm is just a pointer, this way doesn't allow to send a buffer to another application i think. Or I couldn't find a way...

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

  • WM_SETTEXT and Virtual Address Space [modified]
    S sawerr

    Hi 1-) I compiled a DLL which is a hook dll. It calls SetWindowHookEx and hook Keyboard. and there is a hookproc.

    //DLL
    void StartHook(HWND hWnd)
    {

    hHook = SetWindowsHookEx(WH\_KEYBOARD, HookProc, hmod, NULL);
    hWndServer = hWnd;
    

    };

    2-) And I compiled a MFC app. which includes this dll. And calls StartHook. Also it sends its handle to dll. So they can communicate each other.

    //EXE
    HWND hWnd = ::GetDlgItem(this->m_hWnd, IDC_EDIT1);
    StartHook(hWnd);

    3-) In MFC app. there is an edit control which I want to show dynamically which keys user pressed. So first i get editcontrols textlength int textlength = SendMessage(hWndServer, WM_GETTEXTLENGTH, 0, 0) + 1 ; and then try to replace text of the edit control with WM_SETTEXT:

    // DLL
    TCHAR *td = new TCHAR(textlength+1);
    SendMessage(hWndServer, WM_GETTEXT, textlength, (LPARAM)td);

    	SendMessage(hWndServer, WM\_SETTEXT, 0, (LPARAM)td);  
    	delete\[\] td;
    

    4-) It doesn't work and run-time error. Here something wrong. In MSDN for WM_Settext's lParam parameter: "Pointer to a null-terminated string that is the window text." It is a pointer to another process address space and with sendmessage it is sended to another process. And it is meaningless for other process. Is this caused run-time error? How can i solve this problem? (I mean using WM_settext to send a string to another process) Thanks..

    modified on Tuesday, September 9, 2008 4:42 PM

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

  • Is that sharing "memory" or sharing "file"?
    S sawerr

    Is using CreateFileMapping/MapViewOfFile functions means sharing "Memory" or "File" on the disk? I compiled that code for both -INVALID_HANDLE_VALUE, // use paging file (that is on the disk) and -"C:\\a.txt" //physical file too. All of them works. And second process can show "Message from first process". The second process calls: 1-) OpenFileMapping to get handle 2-) MapViewOfFile. What is happening here? Does second process get handle to physical "file" which is on the disk and get "Message from first process" string which is written by first process to file. or Second process get handle to first process' physical "memory" and get string from its address space? Are they communicating with writing/reading same file(pagefile or another file) on the disk or same memory? Msdn Documentation which is about procedure for sharing data with CreateFileMapping/MapViewOfFile/OpenFileMapping is confused me. Thanks.

    C / C++ / MFC question performance
  • Login

  • Don't have an account? Register

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