I needed to use a bit different syntax for SetWindowPos. The line below finally worked although it set my window coordinates to 0, 0 which I don't think it should have. No biggie since a CenterWindow call fixes that.
How do prevent multiple instances of a dialog based application? I have seen the article my Newcomer which relates to non dialog base applications. Someone even posed the question to him but he never responsed.
can anyone tell me is there a way to obtain the count of GDI objects used by an application.Is there a way to obtain the count for individual dll's that are loaded by the application.I need develop code to check for the GDI count and close the application(or close all the windows opened by a dll) if the GDI count reaches beyond certain limit.
Raghunandan S wrote: can anyone tell me is there a way to obtain the count of GDI objects used by an application
What OS do you want to use?
If it's WinXP (Win2K too, if I remember correctly), you use Task Manager (taskmgr.exe). Go to View / Add columns and choose GDI Objects (the real names can be different - I translated them from Polish back into English). Then you can use Dependency Walker (depends.exe) to try to find a DLL and a method used by Task Manager.
This article[^] may prove useful. Especially if you are using Win98.
Read the article I mentioned. This is what it says: the GetGuiResources function from USER32.DLL returns either the count of USER or GDI objects used by a given process. This function is exported by USER32.DLL, but the GDI handles are created and managed by functions from GDI32.DLL because both GDI and USER were moved to the kernel (WIN32K.SYS) starting with Windows NT 4.0
I guess that you can use this function.
And take a look at the source code that comes with it (especially GDICount application).
I'm in the process of re-writing my straight Win32 API app to an MFC app.
My Win32 API app uses the mmsystem.h file with no problem whatsoever from \MSVisStudioNet\VC7\PlatformSDK\Include. It is a 175,167 byte file created May 02, 2001.
BUT, when trying to include and use mmsystem.h in my new MFC app, the compiler errors four times with "nonstandard extension used: nameless struct/union" at lines 1837, 1841, 1862, and 1866.
Could someone let me know what is happening here to cause the errors? Is there an MFC type version of mmsystem?? I did search the entire VC7 installation and only ONE mmsystem.h file exists...apparently there is no other to use?
My other includes are stdafx.h and afxdb.h (as the program access/uses an Access database).
Thanks for that suggestion. I've been combing-through all the compiler error info I could dredge up... Did notice the /Ze switch information but it was enabled.
I started this project about a year ago and only now need the benefits of MFC so that's why this re-coding is happening a year later. I didn't think a non-MFC app's project settings would be helpful, BUT learned that I had to explicitly direct the linker to the winmm.lib file.
Apparently, including the "winmm.h" header isn't enough direction to the compiler to look for and get the library file though.
Problem solved. Thanks again Mike! I think I have all the compiler switches memorized now...
Lets say someone orders software in the middle of the night.
How can I activate the software without actually being awake
to activate them?
There has to be some kind of commercial package or shopping
cart out there where a unique passcode can be dispensed that
only activates one program, one time or where the buyer can
activate the software on there own without every talking to
a human being.
Any ideas on this? Any direction any can give me will be
I have a sound understanding of c++.I have tried to learn programming in Visual C++ by reading a few pdf files and couple of books.All of them just tell how to create windows,menus or different controls etc.Some of them are also using MFC of which I haven't even the slightest idea.Where I m having problem is that i m unable to understand how to use a particular class or which function to use. Also I want to know whether I should start with Visual C++ or Visual C++.net.If there is good book for beginners, please let me know...
> Where I m having problem is that i m unable to understand how to use a
> particular class or which function to use.
My best advice is to download sample projects and study them.
There are lots of books at the bookstore. But they are expensive,
wordy, and to me, not helpful. Start by just trying to figure out
how to make a simple application with text and edit boxes. Then try
to figure out how to add buttons. Read projects on this site and
MSDN. You can be dangerous with buttons, static text and edit boxes.
In time, you will want to mimic other cool projects and so you study
them when that time comes. My best advice though, is give yourself
time and patience to pursue it.
"I have a sound understanding of C++. I have tried to learn programming in Visual C++..."
Here is a really basic overview.
I will assume you have started with learning "generic C++". That is to say, C++ language fundamentals without platform/compiler bias. This allows you to build console based applications with any modern C++ compiler on any modern operating system (OS).
If you want to write applications with a graphical user interface (GUI) then your application requires "help" from the OS to create the application window and everything that goes in it. The application and OS communicate through the application programming interface (API) specific to the OS and usually through some messaging system. The APIs for Windows and Linux are comprised of a very large number functions that can be directly called from C/C++ applications.
The Windows and Linux APIs do not follow the C++ class model. So to make things easier, various third parties have wrapped the APIs into logical C++ classes. Examples are MFC for Windows and TrollTech's Qt cross platform library.
In my opinion, it is very difficult to start using MFC directly without any knowledge of how to write a Windows GUI app using the Win32 API directly. Some basic understanding of the Win32 API will go a long way in learning to use MFC.
A few comments about your comment of "programming in Visual C++". Visual C++ (VC) is a combination of the the Microsoft C/C++ compiler and the visual studio integrated development environment (IDE) which includes a debugger. The latest VC (7.1) adheres very closely to the ISO/ANSI C++ standard. In other words, if you have an understanding of generic C++, you should be able to "program in Visual C++". I am assuming what you meant by that phrase was "writing a Win32 GUI application". FYI...there are Microsoft specific "language extensions" which are not part of "generic C++". These language extensions are not required unless you plan on using the .Net framework or do a few other things.
...So I would recommend picking up a copy of "Programming Windows" by Charles Petzold and then decide from there if you want to go the MFC, .NET, or Qt route. Good luck.
Over the past months ive been studying the protocol a certain game uses. And now i think its using DirectPlay to establish connections and all. Now i was wondering, do you think it would be possible for me to make a bot for the game, i mean, i got most of the games protocol figured out, but i'm stuck on the directplay connection part, since i cant seem to find many tuts or samples about it out there, and the game uses DirectX7 or earlier so i'm not sure if directplay still works the same way, but i downloaded the directx 7 sdk just in case. But when i use the sample client/server and log the network packets, it does completely different things.. Also, i picked up that ur game needs to have some sort of GUID which is like a unique number to identify the game, so i would have to get that from my game right? but that shouldnt be too hard since it should be sent everytime a connection is established right? All tips, comments and suggestions are very welcome.