I created a control which is CWnd derived and nested it in an SDI application
with a CSplitterWnd derived class ( 2 columns, the Ctrl is in the left one, a CView is in the right one, no custom Paint operation ).
The Ctrl uses FillSolidRect via a MemoryDC an OnEraseBkgrnd() returns FALSE.
When I resize the ParentFrame, the Ctrl, the StatusBar and the Toolbar are extremely flickering.
I tried overriding CSplitterWnd::OnEraseBkgrnd() but it kept flickering, nontheless.
Has anyone an idea, what I can do about this issue?
Technicaly that is not a reference, that is a pointer. There is no such thing as passing by reference in C. You could call it a reference if you want to but no one else would know you where actualy talking about a pointer unless you specificaly mention the C language, and then they might figure it out.
// C Memory pointer
void foo(struct s_test* t)
int nSize = t->m_Size;
// C++ Reference
void foo(s_test& t) // or void foo(struct s_test& t)
int nSize = t.GetSize();
// C++ Memory pointer
void foo(s_test* t) // or void foo(struct s_test* t)
int nSize = t->m_Size;
Not to pick nits with you, but in the C 'bible' ("The C Programming Language", Kernighan & Ritchie) chapter 1.8 ("Arguments - Call by value") passing arguments by value is differentiated from other methods, which are referred to as "call by reference". Argument passing by value vs. by 'reference' is also mentioned several other places in the book. So, although this technique is implemented by passing pointers, it can be referred to in more than one way.
Still, your 'point' is well taken and your examples illustrate the issue quite nicely, much better than mine did.
I should have worded my replay earlier differently. I have not needed to read a book on C in years and I have know idea where my copy of "The C Programming Language" is. But here is the way I look at it (and yes I have been influenced by C++).
*pData is a dereferenced pointer (a dereference reference pointer to a memory address) and is therefore a reference to the data its self. In outher words pData could be considered an indirect reference to the data (although it looks like a direct reference to me).
Now then in C++ pData is a pointer to the data and *pData is a reference to the data. I beleive the first C++ compilers converted C++ code to C code and then use the already available C compiler (at least on UNIX).
Wether you agee with the above analiysis is only relevent to the acadimics of the subject though. Do mostly to my influence by C++, I perfer to differentiate between the two, since I do not wish to confuse outhers as to what I am actualy talking about.
Other than my comment, I did make a major mistake in the examples I gave the newbie. I forgot to give examples of how to call the function which sort of defeated the whole purpose.
foo(&myData); // C/C++ pass by address
// C++ pass by value or pass by reference depending
// on wether the function takes a value or refer a
Here's my situation. I know nothing about database programming. I know lots about C++ and MFC and I use Visual C++ 6.0 but also have VS.NET 7.0. Someone has given me a machine with SQL Server and database on it. The database is not very big, maybe 1000 records. I want to get the database off the machine and I want to write an MFC application that will access the data and display it. I want to ship the application and I don't want people to have to have SQL or install anything extra to use the application. I'm sort of hoping that I can convert the database to some sort of file (maybe Access) and query it from MFC. The application would ship with the data and all reading and querying from the file would be local to the machine that the application is installed on.
How would people get started with this and does anyone have any ideas on how to proceed.
You can use an access database with ADO however this will require your users to have a recent version of MDAC http://msdn.microsoft.com/library/default.asp?url=/nhp/Default.asp?contentid=28001860[^] which is several MB. Also I think the recent versions do not include JET which is the driver that you need. I switched to MSDE a few years ago because of this reason and for the more advanced SQL queries that are available with MSDE and SQL Server.
Actually, it's fairly siple. Launch the SQL Server Enterprise manager, drill down to the database table you want, right click it and choose Export. The ensuing wizard will allow you to select MS Access as the export format; after that you're done!
Hi, trying to write out my "video conference" app now, able only to preview my video on my screen. Have not thought of a way to capture those to memory and subsequently send out via Windows socket to another PC connected in the network.
Trying using DIB functions from Video for Windows, but due to inexperience in programming, am not able to do so yet. Anyone can help by providing some ideas or samples?
Is it possible to call explicitly a class from a DLL (not a simple C function but a C++ class)?
I suppose we must use ::Loadlibrary("my_dll_path_to_call") and GetProcAddress(hInstance, "class_name_from_dll")... like the call of a simple C function!
Even if this was possible, what would you do with the result of GetProcAddress(hInstance, "class_name_from_dll")? Think it over, a class is not an entity per se in a program, only their instance objects (The situation differs in Java and C#, where classes are program entities). GetProcAddress will give you pointers to functions, with a little work it is possible to make it return pointers to the methods of a given class: if this is what's in your mind, you might consider exporting classes from a DLL (see the docs), but this is a whole different beast than you're asking for.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
I've written an console app. Is there a way to make the window from not popping up. I want to hide the window because there is nothing for the user to see.
How can I get a handle that is useful for showwindow to use to hide the window?
Probably the easiest way to accomplish this is to write your program as a Win32 app (with WinMain) and not do any UI at all. If you still need argc and argv, resort to the equivalent global variables __argc and __argv.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
I'm using the ping class listed in network/internet section of CP. When I compile my app in debug mode it works great. When I compile it in release mode I get the following error:
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxcmn2.inl(293) : error C2084: function '__thiscall CIPAddressCtrl::CIPAddressCtrl(void)' already has a body
Both have the same settings. I'm not sure what this error means, can someone give some insight to this.
What's even stranger is that when I compile on my laptop it compiles fine in both debug and release. Could I have a header file that is out of date?
I have created my own files going along with my application, let's say they are .rage files. How do I do to get them programatically registered, so that if I click on myfile.rage, for instance, it opens my application and load my file ?
Has this to do with the shell or with the registry or both ?
I have a game that allows you to display the frame rate in the upper right corner of the screen. I want to intercept the data being shown there so I can determine the minimum and maximum frame rate attained (it changes wildly depending on the current conditions of the game).
I tried using Spy++ to see if I might be able to get a window handle (wehile the game was running), but no joy.
Does anyone have an idea of how I might go about intercepting this data?
Oh yeah, it must work no matter which 3d engine the game is using - OpenGL or DirectX, and it would be nice if it would also work in both full-screen AND windowed mode.
Many thanks in advance.
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
At one point I hide the Cdialogs.....pDlg->SHowWIndow(SW_HIDE);
Later when the user definitely decides he is going through with a certain action, I want to destroy them (modeless) pDlg->DestroyWindow();
Do I have to do a SHowWIndow(SW_SHOW) right before I destroy, or can I go ahead and destroy the hidden CDlg?
Hey, does anyone know how to close a certain program that is running. I am making a toolbar to contol Kazaa and I found out how to open Kazaa but now I need to know how I can close it. Is there a message I send?? Thanks for any help.