|
James A Beggs wrote:
What is your favorite C++ compilers?
VC, the one and only
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Haha!
Well, I "grew up" on Borland C++, then picked up C++ Builder 3.0. I liked it, a lot. I haven't used it in awhile, and I am debating on what to get, Borland, VC, or something else.
James A Beggs
Microsoft MSN Mobile Component Test Team
|
|
|
|
|
I have been looking at solving some "inconsistent" problems with my program which seemed to be memory related. Strings displayed in dialog boxes overwritten when there was no command to change them. In order to check that I did a build with Boundschecker. Although I am not sure how I fixed my own problems , after a few full rebuilds and initializing data in the pointer class I was using, my code seemed to solidfy. However bounds checker gave me a list of memory leaks within external dlls. (i.e.
Dynamic memory overrun
Copying 65535 bytes to a block allocated in DNSAPI.DLL!0000121A
Starting offset: 0, destination size: 2 bytes
HANDLE: 0x0016B5A8
allocating thread ID: 0x6DC, current thread ID: 0x6DC
Location of Error
DNSAPI.DLL!0000141D (unknown) (unknown)
DNSAPI.DLL!000015BA (unknown) (unknown)
DNSAPI.DLL!00002AAF (unknown) (unknown)
DNSAPI.DLL!000029E4 (unknown) (unknown)
DNSAPI.DLL!0000298F (unknown) (unknown)
Point of Allocation
DNSAPI.DLL!0000121A (unknown) (unknown)
DNSAPI.DLL!00002AAF (unknown) (unknown)
DNSAPI.DLL!000029E4 (unknown) (unknown)
DNSAPI.DLL!0000298F (unknown) (unknown)
or
Memory leak
1152 bytes allocated by MSVCRT.DLL!0000101F in MSVCRT.DLL!00003517, HANDLE: 0x01F31F20
Location of Error
MSVCRT.DLL!00003517 (unknown) (unknown)
MSVCRT.DLL!00001431 (unknown) (unknown)
Is there a way to debug this.. I assume it is something that I am doing in the calling of the API and MFC code. Okay I am one that doesn't want to just blame Microsoft and release something with errors that I can resolve.
Unfortunatly I am not a debug guru and haven't been able to study under any master, so any help could be cool. Otherwise when I get time, I guess I could comment out calls and find out what is causing these leaks. Trust me I learned alot debugging my AddRef/ Release extremly simple garbage collection for some classes. I learned I should probably have used a better smart pointer class instead of my simple technique....
Anyway thanks for any tips...
The path to mastery is full of stupid moments and errors, but the error of the stupid is to assume that they are masters.
|
|
|
|
|
- you cannot debug MSVCRT
- BoundsChecker is not always accurate. Far from that, type casting makes it easily confused and say wrong things about it. Moreover, you are not telling us whether BoundsChecker reports it is a object leak, interface leak, gdi leak.... If that's an object leak, then MSDEV is likely to show it as well (as a proof whether BoundsChecker is wrong or not).
- Best advice would be :
-- do not use DNSAPI if you can
-- try to use it in another similar program
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
|
|
|
|
|
Wish I could not use DNSAPI, but one of the requirements that I have already is that I can resolve an Internet Address by name as well as by numbers, so I have to use it.
I sort of realized that boundschecker is not going to be completely accurate. Many people have posted examples of the way I use gethostbyname, so I will check out one of their programs to see if it is the same problem. Otherwise it must be the way I am using it.
As far as the leak goes... It is labeled as a memory leak. VC++ doesn't record the leak, which is where I normally start. I usually use Boundschecker if I have had a problem that might be memory related. I have learned to ignore resource leaks and gdi leaks unless they are in my code.
Thanks for the help though. I appreciate the feedback...
|
|
|
|
|
Hi all
First off, I know nothin of C++ (well i can read a bit). Now the problem is: I have a static object library (file.lib) and its header (file.h). Now I want to compile this into a static(???) DLL and export the 4 functions available in the header. Is this possible?
I have tried something myself by creating a file.c file and including file.h at the top. I also made a def file with the exports (correct AFAIK) and adding file.lib to additional dependacies in the linker properties. This is why I like C# so much, VC++ has toooo many settings!
Can someone please help? I'm clueless!
Cheers
Give them a chance! Do it for the kittens, dear God, the kittens!
|
|
|
|
|
leppie,
I see you are creating a .def file, are you trying to convert this into a .dll that can be called from VB?
Nick Parker
The goal of Computer Science is to build something that will last at least until we've finished building it. - Unknown
|
|
|
|
|
Nick Parker wrote:
I see you are creating a .def file, are you trying to convert this into a .dll that can be called from VB?
C# really, but yes!
Give them a chance! Do it for the kittens, dear God, the kittens!
|
|
|
|
|
leppie wrote:
First off, I know nothin of C++ (well i can read a bit). Now the problem is: I have a static object library (file.lib) and its header (file.h). Now I want to compile this into a static(???) DLL and export the 4 functions available in the header. Is this possible?
Yes.
Let the wizard generate a DLL project for you. I prefer to use (MS specific) __declspec keywords instead of a DEF file.
Pavel
Sonork 100.15206
|
|
|
|
|
Pavel Klocek wrote:
Let the wizard generate a DLL project for you. I prefer to use (MS specific) __declspec keywords instead of a DEF file.
OK I rephrase, I know nothing of Visual C++
What wizard must I use? what is this precomopiled header, do I need it? I dont really want answers to these. I just too much for me, but the compiler complains to what ever I do, so I just remove them.
Give them a chance! Do it for the kittens, dear God, the kittens!
|
|
|
|
|
leppie wrote:
What wizard must I use?
AppWizard "Win32 Dynamic-link library" in VC6, should be in VC7 too. It generates a dummy DLL project with some optional example code.
leppie wrote:
what is this precomopiled header, do I need it?
No, you don't need them, if you turn of use of precompiled header files in your project settings (C/C++ section). The purpose of precompiled headers is to speed up the compiling - selected header files are compiled only once per project, otherwise they are compiled with every cpp file where included again. The stdafx.h file marks a point, where the precompiled headers ends in your cpp file, following includes are compiled as usually.
Pavel
Sonork 100.15206
|
|
|
|
|
A .def file (where you list exported functions) is of the form :
LIBRARY "COMServerPS"
DESCRIPTION 'Proxy/Stub DLL'
EXPORTS
DllGetClassObject @1 PRIVATE
DllCanUnloadNow @2 PRIVATE
GetProxyDllInfo @3 PRIVATE
DllRegisterServer @4 PRIVATE
DllUnregisterServer @5 PRIVATE
To replace your static library with a DLL, you have at least two options :
- edit the existing .dsp file :
-> replace 0x0104 to 0x0102 (in the TARGTYPE line)
-> remove -lib (in link.exe -lib)
- create a new .dsp
-> VC6 : Win32 dynamic library
-> VC7 : Win32 project (and then check DLL in the propertysheet)
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
|
|
|
|
|
Ok my exports does look like it, it compiles to a 286kb blob of #$%#$
But the exports viewed in w32dasm doesnt point anywhere.
This is what I not wanted in the 1st place, A lesson in C++. I just want to use the dll from C#, but it is distributed as a lib and I'm clueless how to do the conversion to dll.
Can I mail it to someone willing to do it? It's just 4 functions. Its small 160kb. Please
Thanx in advance!
Give them a chance! Do it for the kittens, dear God, the kittens!
|
|
|
|
|
The scenerio: if I start my application from the task bar I cannot use the open or new dialog menu options. It will not open the "save" or "open" dialog boxes. However if I start the application using the icon shortcut from anywhere on my hard drive, the application works normally. The application is effected the same way if I use the start menu. Is there something different with the Task Bar that would affect win32 applications in this fashion?
Thanks!
|
|
|
|
|
It seems to work in all the tests that I did.
Is the save/open dialog invoked by your code or is it the MFC framework code?
modified 29-Aug-18 21:01pm.
|
|
|
|
|
In each case where I'm expecting a dialog to open is when I'm involking the CFileDialog class. That is, when saving I call this class with the proper constructor to open a save dialog box and similiarly when I call open.
thanks!
"Why are we hiding from the police, Daddy?"
"We use VI, son. They use Emacs."
|
|
|
|
|
Hi,
I'm sure there is a easy method for this, but I cannot see for looking !
Q. Is there any method to force the Nonclient area of a window to be redrawn/recalculated ?
The only methods I can see, affect the client area of a windows.
At the moment I am increasing the size of the windows then reseting it back to the original size.
My other solution was to recreate the window.
Both of thse solutions work, but they are obviously work-arounds, and I would like a more "professional"
solution.
Thanks,
Gary Ranson.
|
|
|
|
|
Call RedrawWindow with RDW_FRAME.
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Now I am developing a tool to simulate user input (keyboard and mouse input) to other applications on windows. The problem seems to be the program doest not work like I expected when I use SendMessage or PostMessage to send keyboard and mouse input to other applications. For example, the user input steps are: mouseclick an editbox in an application’s window, type a string , and then mouseclick another editbox in the window , type another string ; First I send a mouse message to the first edit box to get focus, and send keyboard messages to type the string in the first edit box, then send a mouse message to the second edit box to get focus, and send keyboard messages to type the string in the second edit box. But the result is not what I expected. What’s the matter at all? And if I post a mouse message to click a button, then open a model dialog, but I send any message to the controls in the dialog box , nothing happed. I expect my program can work like some testing tools, such as QARun, Robot etc., to control applications and simulate user input. How should I do? Can you give me some suggestion? Thank you very much!
waiting for your help ^_^
xia
|
|
|
|
|
look at keybd_event() and its brother mouse_event()
...make it about Visual C++, and don't ever mention Visual Basic. Nick Hodapp (MSFT) in Semicolon[^]
|
|
|
|
|
Thanks for your help! I have just solved my problem by using mouse_event() and keybd_event(),instead of using SendMessage(). The program works as i expected.
|
|
|
|
|
Hey, what's this field for?
"In an organization, each person rises to the level of his own incompetence." Peter's Principle
|
|
|
|
|
Our test team are developing a tool like QARun & Robot. You may ask me why we develop our own tool and do not use the professional tools. My manager thinks these tools can not help us to run testing well. He wants the new tool can get every GUI object's information easily on windows, and can accomplish the keyword-driven framwork well. Now the problem we meet is: we can not control the be-tested software well by using a series of keybd_event() and mouse_event(). I need the tool can simulate user inputs just like we do manually. Can you give me some advice?
thanks,
xia
|
|
|
|
|
Can two applications (running on two or same machine) broadcast data on the same multicast group? If yes, how is the message integrity preserved - i mean like messages getting intertwined ( part of msg1 .. part of msg2 .. rest of msg1 etc...)
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Thomas George wrote:
Can two applications (running on two or same machine) broadcast data on the same multicast group?
Yes.
If yes, how is the message integrity preserved
Not. Multicast is UDP, which by the very definition is unreliable.
i mean like messages getting intertwined ( part of msg1 .. part of msg2 .. rest of msg1 etc...)
That won't happen. You can get a complete message, a partial message (f.ex. if you exceed MTU) or no message from recvfrom(). Messages never get "blended" like this.
|
|
|
|