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?
sawerr
Posts
-
Why is pointer a compound type, not a fundamental type? -
Sockets and Port number@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?
-
Sockets and Port numberHi 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?
-
ReadFile overlapped i\oThanks for the answers, I got it. How can you advance file pointer if you don't use overlapped IO?
-
ReadFile overlapped i\oHi 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...
-
Calling DLL function that is not imported(MFC and WinMain)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?
-
Calling DLL function that is not imported(MFC and WinMain)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...
-
Service Account - Account NameHi 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...
-
Compound Document Support and Automation in MFC WizardHi 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..
-
Setup and Deployment of Database Project without serverHi 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...
-
Message Queues for MFC windows classesMark 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:
-
Message Queues for MFC windows classesFor 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 defaultCEditView::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.
-
Message Queues for MFC windows classesHi 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...
-
GetModuleHandle in a DLLNo, I exported a function which is called GetModuleHandle(NULL); OK. I got answer. Thank you very much...
-
GetModuleHandle in a DLLHi "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?
-
WM_SETTEXT and Virtual Address Space [modified]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.
-
WM_SETTEXT and Virtual Address Space [modified]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)
-
WM_SETTEXT and Virtual Address Space [modified]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...
-
WM_SETTEXT and Virtual Address Space [modified]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
-
Is that sharing "memory" or sharing "file"?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.