skinnable application
Hi,
I would like to know what is the best technique for creating skinnable
application ?
everything should be imagess if i understood well, and 1 file should
contain all information about these images like names, status (pressed,
hover, standard, up, and so on...).
But should i write in this file, the dimensions of each image ?
does anyone have some samples please ?
thanks a lot,
Maileen Tag: load a PNG image Tag: 250369
how to Call VB dlll in VC
Could anybody point me to some resource about how to call a VB.net DLL in
VC.net?
Thanks in advance.
Al Tag: load a PNG image Tag: 250368
Theme issue in VC++.
Hi All,
I have created the application like TurboNote+. The application should
run on both Win2K and WinXP. While running the application in XP, i got
some border issues. It will be fixed, if we choose the default theme in
WinXP. But my application should run on all themes of WinXP. How can i
handle themes issues in VC++. Please help me to solve this problem.
Regards,
Prakash. Tag: load a PNG image Tag: 250365
=?Utf-8?Q?Funny_linker_error=E2=80=A6!?=
I have a class that I'm using in my solution. This is an Internet solution,
and this class is something I share with couple of projects.
Now, to avoid redefining the class, I included the header in both projects.
In order to relieve my self from recompiling, I let the server (project 1)
compile this file, and I added the client (project 2) the object file. Now
here is the funny thingâ?¦ I have a clean constructor to this class (no
parameters) which is called without a problem from the object file. Any
method declared works very well, BUT the ones that has wchar_t * as
parameters. Any function that have any parameter like this will result in a
linker error " chat client error LNK2019: unresolved external symbol "public:
int __thiscall CUserLoginInfo::SetLoginData(wchar_t *)"
(?SetLoginData@CUserLoginInfo@@QAEHPA_W@Z) referenced in function "public:
void __thiscall CchatclientDlg::OnBnClickedOk(void)"
(?OnBnClickedOk@CchatclientDlg@@QAEXXZ) " no matter what the function is, as
long it contains this parameter, I will get this error. If I won't call this
function the project will obviously runâ?¦ needles to say that this can be
resolved very quickly by copying the values by hand, but this is a flowed
programming style, not to mention extremely annoying!...
wchar_t is, of course, defined in both projects (/Zc:wchar_t).
I had tried to fiddle with some functions parameters, all passed but thisâ?¦
What do you think? Tag: load a PNG image Tag: 250364
image JPEG and BMP
Hi,
i've created a JPEG image which is 300 x 50. this image contains 6
images of 50 x 50.
i would like to know how can i tell to my program to use image 1 (from
pixel 0 to 49) at one place and to tell again to use image 3 (from pixel
99 to 149) to another place ?
or does it work only with BMP image ?
how to do it without using MFC ?
thanks a lot,
Maileen Tag: load a PNG image Tag: 250363
Dll Entry Point Name
Hi,
MSDN documentation states:
"The name DllMain is a placeholder for a user-defined function. You
must specify the actual name you use when you build your DLL."
How do you actually accomplish that? I have not been able to find that
in the VC.Net documantation.
Many thanks,
Aaron Fude Tag: load a PNG image Tag: 250350
Enabling Memory Leak Detection
Hi,
I am trying to enable memory leak detection based on the url below.
If I use _CRTDBG_MAP_ALLOC instead of CRTDBG_MAP_ALLOC in a test program, I
can see the offending line numbers and source file get printed out.
However in the program that I am trying to find memory leaks, I get the same
debug output regardless of whether I #define _CRTDBG_MAP_ALLOC or
CRTDBG_MAP_ALLOC. And I only get one line number <dllmodul.cpp(106)> output
instead of every offending (leak causing) line number. Why is that?
// based on
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxconenablingmemoryleakdetection.asp
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
. . .
_CrtDumpMemoryLeaks();
OUTPUT
Detected memory leaks!
Dumping objects ->
{61} normal block at 0x00872680, 7 bytes long.
Data: <MyExename> 43 61 70 47 65 6E 00
{56} normal block at 0x00872748, 33 bytes long.
Data: < C > 00 43 00 CD CD CD CD CD CD CD CD CD CD CD CD CD
{55} normal block at 0x008726E0, 40 bytes long.
Data: < |L > 14 7C 4C 10 16 00 00 00 00 00 00 00 00 00 00 00
dllmodul.cpp(106) : {53} client block at 0x00872590, subtype 0, 64 bytes long.
a CDynLinkLibrary object at $00872590, 64 bytes long
{52} client block at 0x00872508, subtype 0, 64 bytes long.
a CDynLinkLibrary object at $00872508, 64 bytes long
{50} client block at 0x00874F68, subtype 0, 64 bytes long.
a CDynLinkLibrary object at $00874F68, 64 bytes long
Object dump complete.
Thanks! Tag: load a PNG image Tag: 250349
Client Server using TCP/IP - which interface to use?
Hi there...
I want to write a small utility.
It should be front- and backend running on different machines.
I don't want to handle error correction or timeouts by myself.
Communication is TCP/IP.
How could I easyly do the communication?
CSocket or something else.
Thanks in advance
Stefan Tag: load a PNG image Tag: 250346
GetDIBits is returning 0
hi,
i'm geting de bits of to bitmaps into a buffer in order to compare
then.
the first time i call GetDIBits, it works ok, and returns the number
of scanlines an correct data in the buffer.
the second time, it returns 0 and does nothing in the baffer.
if i change the order of the calls, the second still fails.
i know that then bitmaps must not be selected on any DC, and i'm
carefully with that.
¿¿any reason why GetDIBits returns 0??
Thank you.
by MJM. Tag: load a PNG image Tag: 250338
reversing bit order
Hi folks -
I'm writing some code for a checksum algorithm and I need to reverse the
order of bits in an unsigned char array, in 4-bit chunks (half byte, or
nibble).
Example.. the array contains BYTE data:
0001 0110, 0000 0010, 1000 0000
0x16, 0x02, 0x80
Each nibble gets reversed:
1000 0110, 0000 0100, 0001 0000
0x86, 0x04, 0x10
Each nibble will then be added and the results become a checksum nibble.
I can do this brute force, one bit at a time, but I'm hoping someone out
there will recognize a possible elegant solution. There will always be 5
bytes (40 bits, 10 nibbles) to deal with.
Any ideas?
Thanks. Tag: load a PNG image Tag: 250334
Tree control: How do I get the expand / collapse icons?
I'm performing a custom draw of the items of a tree control and I need to be
able to draw the expand and collapse toggle button ([+] & [-]) that appears
to the left of items with children.
I need to know how to get that icon, and the coordinates that the OS expects
the symbol to be drawn. I can't find this information in the MSDN.
Thanks
(Sorry that this is the wrong category but there isn't a vc.controls
newsgroup) Tag: load a PNG image Tag: 250331
Initializing member variables
Hi,
I did this test using VC .NET 7.0:
#include <iostream>
using namespace std;
class A {
public:
//A () { } // Providing a default constructor makes it work
int i;
int GetI() { return i; }
};
int main(int argc, char* argv[])
{
A a;
//cout << a.GetI() << endl; //This call works
cout << a.i << endl; //Throws Runtime error
a.i++; //Throws Runtime Error
return 0;
}
In the lines mentioned, it throws a runtime error saying that the variable
is not 'defined'. The variable is not initialized, of course, but what makes
it not throw the error if:
1) the default constructor is provided, which does not actually initialize
'i'?
2) a.GetI() is called, again without initializing 'i'?
TIA,
SD Tag: load a PNG image Tag: 250327
Using WebBrowser Control, how to Navigate w/o displaying the HTML page.
I built an MFC project of the SDI type, hosting a WebBrowser Control.
Everything seems to behave properly.
I am using the Navigate(LPCTSTR URL) to get web pages.
Is it possible and if so how to perform all the functionality of the
Navigate()
w/o display the page?
There is a method called SetVisible(false/true) but when trying to use it,
it creates an exception.
With and w/o regard to the above question,
Is it preferred to have a host of the MDI (or top level MDI) type, as to
separate between the host's GUI window and the window in which the
WebBrowser Control displays a page (that is if I allow it to do that)?
Thanks,
David Tag: load a PNG image Tag: 250301
std::_MAX Replacement
I'm migrating from VS6.0 to VS 2003 .Net.
One of the breaking changes is that _MAX has been redefined so that
std::_MAX will no longer compile. I tried changing each usage to std::max,
but that won't compile either. So I went
using std::max
...
float a = max(b, c);
which is compiling.
How have other people dealt with this issue?
Thanks in advance! Tag: load a PNG image Tag: 250291
Calling vb.net web service from visual c++
Hi. I am new to this so this may be a dumb question:
I am trying to call a web service that is Written in VB.NET from my C++ dll.
here is what I did:
1. Create a sample web service (with helloworld function)
2. Create an empty ATL application (it compiled)
3. Added a reference to the wsdl document of the web service to the project.
4. tried to compile it and got an error:
syntax error : expecting a type specification near "HelloWorldResult"
error points to this line:
[id(4), helpstring("method HelloWorld")] HRESULT HelloWorld([out, retval]
HelloWorldResult *);
Here is the code that was generated by Soap Tool Kit when I added a reference:
// TestSoapTool.idl : IDL source for TestSoapTool.dll
//
// This file will be processed by the MIDL tool to
// produce the type library (TestSoapTool.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(433144B5-225D-42D8-8E2C-875467ABE7FA),
dual,
helpstring("IService1SoapProxy Interface"),
pointer_default(unique)
]
interface IService1SoapProxy : IDispatch
{
[propget, id(1), helpstring("property URL")] HRESULT URL([out, retval]
BSTR *pVal);
[propput, id(1), helpstring("property URL")] HRESULT URL([in] BSTR newVal);
[propget, id(2), helpstring("property ProxyServerAddress")] HRESULT
ProxyServerAddress([out, retval] BSTR *pVal);
[propput, id(2), helpstring("property ProxyServerAddress")] HRESULT
ProxyServerAddress([in] BSTR newVal);
[propget, id(3), helpstring("property ProxyServerPort")] HRESULT
ProxyServerPort([out, retval] BSTR *pVal);
[propput, id(3), helpstring("property ProxyServerPort")] HRESULT
ProxyServerPort([in] BSTR newVal);
[id(4), helpstring("method HelloWorld")] HRESULT HelloWorld([out, retval]
HelloWorldResult *);
};
[
uuid(A07EF164-8E81-41FF-9D91-BD74F3C1F67E),
version(1.0),
helpstring("TestSoapTool 1.0 Type Library")
]
library TESTSOAPTOOLLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
uuid(C7AC7808-58F3-4109-B2D9-ACC22521C055),
helpstring("Service1SoapProxy Class")
]
coclass Service1SoapProxy
{
[default] interface IService1SoapProxy;
};
};
Before I go any further I wanted to know if it is even doable: calling
vb-based functions from c++ since all types are different. Is this a common
issue? Did I do anything wrong in my steps or is there anything I did not do?
Thanks for the help. Tag: load a PNG image Tag: 250284
Dynamically Set Tab Index
Hi,
Is there anyway to Dynamically Set the Tab Index of the controls in a
mfc dialog? I want two fields to switch tab order under certain
conditions.
Thanks
Marcus de Leon Tag: load a PNG image Tag: 250281
VC++ 6.0 or higher
This is a multi-part message in MIME format.
------=_NextPart_000_000D_01C58D71.02386B80
Content-Type: text/plain;
charset="koi8-r"
Content-Transfer-Encoding: quoted-printable
What is newest environment to build C++ applications?
Microsoft VS 6.0 or something better?
--
Thank you
Vadim S.
------=_NextPart_000_000D_01C58D71.02386B80
Content-Type: text/html;
charset="koi8-r"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dkoi8-r">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>What is newest environment to build C++ =
applications?</FONT></DIV>
<DIV>Microsoft VS 6.0 or something better?</DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>--</FONT></DIV>
<DIV>Thank you</DIV>
<DIV>Vadim S.</DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></BODY></HTML>
------=_NextPart_000_000D_01C58D71.02386B80-- Tag: load a PNG image Tag: 250278
nmake for Windows 2003 x64
Hi
Where can I find nmake for Windows 2003 x64? nmake is needed for some Perl
development I'm doing, particularly to install some plug-in packages from
CPAN.
Thanks
tl Tag: load a PNG image Tag: 250277
unicode and debuging
Hey, anybody can advice how to debug unicode,
this is real pain in the ... Regular logging also doesn't work... When
debuging I'm getting only first character of the srtring...
thanks Tag: load a PNG image Tag: 250272
J-Integra for COM (Java COM interoperability)
Looking for Java/COM interoperability tools? Thousands of companies
world-wide are using J-Integra for COM for interoperability between
Java and Microsoft COM applications. J-Integra for COM is a pure Java
implementation of the DCOM protocol, making it several times faster
than Web Services.
J-Integra for COM Features:
* Access J2EE components from VB, C++, ASPs, etc...
* Access COM components from EJBs, Servlets, JSPs, Applets, etc...
* Pure Java implementation, 100% managed code (no native code required)
* Bi-directional: "Java to COM" and "COM to Java"
* One-sided deployment (no touch on Microsoft client/server side)
* Supports any JVM running on any platform (Windows, Unix, Linux,
etc...)
* Optional high-speed native mode for Windows platforms
* Allows Java clients to subscribe to COM events using standard Java
semantics, and COM clients to subscribe to Java events using standard
COM semantics
* Supports both early binding and late binding access to Java/COM
components
* Supports the full range of COM Oleautomation types
For a free evaluation, visit our website at
http://j-integra.intrinsyc.com/
Regards,
Shane Sauer
Intrinsyc Software International, Inc.
J-Integra Interoperability Solutions
http://j-integra.intrinsyc.com/
When Web Services are not enough Tag: load a PNG image Tag: 250268
IDL Help
Newbie question:
What is the syntax to declare a string constant in an IDL? I'm trying to
compile a type lib that I can reference and use from VB project.
If I use 'string', I get an error:
"syntax error : expecting a type specification or a storage specifer or a
type qualifier near "string"
If I use 'BSTR', I get an error:
error C2440: 'initializing' : cannot convert from 'char [24]' to 'unsigned
short *const '
If I use 'wchar_t *' I can compile it, but obviously I cannot use it in VB.
TIA. Tag: load a PNG image Tag: 250264
mscorlib help
I am using VC++ and am doing something where I need this: #using
<mscorlib.dll>, however, I am told at compile time that I need to compile
with /clr. When I used /clr I was told that I cannot use it with /RTC. I can
modify /RTC but cannot seem to get rid of it. How can I resolve this problem? Tag: load a PNG image Tag: 250263
Lost on anything pertaining to MessageBox
I have the following 2 files:
File1.cpp
Line 100: MessageBox("ABC");
Line 101: MessageBox(NULL,"ABC",NULL,MB_OK);
File2.cpp
Line 120: MessageBox("ABC");
Line 121: MessageBox(NULL,"ABC",NULL,MB_OK);
When compiling, I am getting two error messages:
File1.cpp(100): error C2660: 'CWnd::MessageBoxA' : function does not take 4
arguments
File2.cpp(121): error C2660: 'MessageBoxA' : function does not take 1
arguments
So it does not like one MessageBox signature in one file and likes the other
one
While in the other file it is the reverse!
#include statement in both files are identical.
Couldn't find a clear decription of the usage of MessageBox.
I guess it must be related to the base classes of the involved derived
classes in each file:
class File1_X : public Cdocument
class File2_X : public ChtmlView
Anybody saw a good & COMPLETE definition of MessageBox?
I am simply exhausted from this MessageBoxA stuff, let alone the above wierd
behavior.
Thanks,
David Tag: load a PNG image Tag: 250240
Release vs Debug (Memory leak...Object Dump)
I found out that when I build a project in Debug mode, memory
leak...object dump occurs.
But when I build the project in Release mode no memory leak...object
dump occurs.
So my question is that whether the release build have memory leak??? Tag: load a PNG image Tag: 250227
VS2005 doesn't like its own suggestions
I typed std::
A pull down list box poped up with a list of all selections available as
expected.
Among them is "string" as expected. I choose "string".
The compiler then complains that "string is not a member of std"...
Any idea about such a puzzle?
Thanks,
David Tag: load a PNG image Tag: 250226
Runtime assert -> DBGDEL.CPP
Hello ,
I am getting a Debug Assertion "Error in line 47 at dbgdel.cpp" , though
the code I am running has been compiled in release build .
To wipe off the doubt that it can be a debug,release build mismatch, I
have rebuild all the code in the Release build , but still I am getting this
problem .
Any help would be appreciated .
Thanks ,
Sujay
--
Sujay Ghosh
Bangalore, INDIA Tag: load a PNG image Tag: 250219
VC .NET 2003 - const (public) and non-const (protected) overloaded funcs do not compile
Can anybody tell me why this fails to compile with the following error??
Compiling...
Test.cpp
d:\Sample_Code\Test\Test\Test.cpp(24) : error C2248: 'Foo::Get' : cannot
access protected member declared in class 'Foo'
d:\Sample_Code\Test\Test\Test.cpp(14) : see declaration of 'Foo::Get'
d:\Sample_Code\Test\Test\Test.cpp(7) : see declaration of 'Foo'
class Foo
{
public:
Foo() : m_A( 0 ) {}
const int &Get() const { return m_A; }
protected:
int &Get() { return m_A; }
private:
int m_A;
};
int _tmain(int argc, _TCHAR* argv[])
{
Foo f;
const int &n = f.Get();
return 0;
} Tag: load a PNG image Tag: 250218
ANNC: Reliable Software releases their own C++ Windows Library
Seattle, WA -- Seattle-based Reliable Software=AE announces the release
their Windows Library into the public domain. Reliable Software Windows
Library, RSWL, is the foundation for their compact, feature rich
applications including the flagship product, Code Co-op. The use of
RSWL in both individual and commercial products is free and not
restricted to public domain projects.
RSWL provides a thin, easy to understand, object-oriented layer
encapsulating the Windows API. Its architecture is based on the ideas
described in the book "C++ in Action, Industrial Strength Programming
Techniques" (Addison-Wesley 2001). Besides including the encapsulation
of basic Windows infrastructure, like handles, message loops, Window
classes and instances, dialog boxes, and Windows controls; it also
provides sub-libraries for many of the Windows subsystems. There is a
compact graphics library built around GDI, a file library that includes
memory-mapped files, a thread library with synchronization primitives,
a network library including FTP, BITS, SMTP and POP3, and many others.
More information can be found online at
http://www.relisoft.com/rswl.html
Reliable Software uses a novel mechanism for the distribution of RSWL
sources and updates using a free, e-mail based, version of its own
distributed version control system, Code Co-op.
Reliable Software's contributions to the development community go
beyond Code Co-op. On their website, they provide extensive information
for developers, including tutorials, discussion forums, and an on-line
book. The founder of Reliable Software is the author of "C++ in Action"
and a regular contributor to various trade magazines. Tag: load a PNG image Tag: 250216
DSWebCamCap
I have bought the book "Programming Microsoft DirectShow for digital video
and television" and I'm trying to compile and link the DSWebCamCap example
for my web cam. However, it fails trying to link - error: it can't find
C:/Program/microsoft.obj. What is microsoft.obj, how is it created, why, and
how can I make sure it is made so that I can compile, link and run the
DSWebCamCap example? Tag: load a PNG image Tag: 250213
Get friendly name of struct
Is there any way to get the value name of an enumeration as a string?
i.e.
typedef enum EventID
{
ServiceStart = 100,
ServiceStop = 101,
};
char* szName = Foo(ServiceStop);
//Then szName would equal "ServiceStop\0"
Bob Tag: load a PNG image Tag: 250206
Calling .Net web services from Visual C++ (Soap Tool Kit)
Hi. I am new to this so this may be a dumb question:
I am trying to call a web service that is Written in VB.NET from my C++ dll.
here is what I did:
1. Create a sample web service (with helloworld function)
2. Create an empty ATL application (it compiled)
3. Added a reference to the wsdl document of the web service to the project.
4. tried to compile it and got an error:
syntax error : expecting a type specification near "HelloWorldResult"
error points to this line:
[id(4), helpstring("method HelloWorld")] HRESULT HelloWorld([out, retval]
HelloWorldResult *);
Here is the code that was generated by Soap Tool Kit when I added a reference:
// TestSoapTool.idl : IDL source for TestSoapTool.dll
//
// This file will be processed by the MIDL tool to
// produce the type library (TestSoapTool.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(433144B5-225D-42D8-8E2C-875467ABE7FA),
dual,
helpstring("IService1SoapProxy Interface"),
pointer_default(unique)
]
interface IService1SoapProxy : IDispatch
{
[propget, id(1), helpstring("property URL")] HRESULT URL([out, retval]
BSTR *pVal);
[propput, id(1), helpstring("property URL")] HRESULT URL([in] BSTR newVal);
[propget, id(2), helpstring("property ProxyServerAddress")] HRESULT
ProxyServerAddress([out, retval] BSTR *pVal);
[propput, id(2), helpstring("property ProxyServerAddress")] HRESULT
ProxyServerAddress([in] BSTR newVal);
[propget, id(3), helpstring("property ProxyServerPort")] HRESULT
ProxyServerPort([out, retval] BSTR *pVal);
[propput, id(3), helpstring("property ProxyServerPort")] HRESULT
ProxyServerPort([in] BSTR newVal);
[id(4), helpstring("method HelloWorld")] HRESULT HelloWorld([out, retval]
HelloWorldResult *);
};
[
uuid(A07EF164-8E81-41FF-9D91-BD74F3C1F67E),
version(1.0),
helpstring("TestSoapTool 1.0 Type Library")
]
library TESTSOAPTOOLLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
uuid(C7AC7808-58F3-4109-B2D9-ACC22521C055),
helpstring("Service1SoapProxy Class")
]
coclass Service1SoapProxy
{
[default] interface IService1SoapProxy;
};
};
Before I go any further I wanted to know if it is even doable: calling
vb-based functions from c++ since all types are different. Is this a common
issue? Did I do anything wrong in my steps or is there anything I did not do?
Thanks for the help. Tag: load a PNG image Tag: 250200
using enums in array references
I tested the following lines of code, and they work, but I was wondering if
usage of enums like this is frowned upon. I don't really ever see enums used
like this, and I was wondering why.
enum index {first, second, third};
int i[3];
i[first] = 1;
i[second] = 2;
i[third] = 3;
Thanks, Tag: load a PNG image Tag: 250198
Use IE as help window
I would like to use IE (or registered browser) to display some HTML help in
my application. In addition I would like to continue to use the same
instance for subsequent help queries (provided it is still open). Also, I
want to be able to make it an always on top window so that giving focus to
the application does not obscure it. I've got the easy part opening IE
using ShellExecute(). Can I do what I am suggesting? I'm willing to change
the method of launching if necessary.
Thanks,
Drew Tag: load a PNG image Tag: 250196
space or tab in #define
I find there are some statements like "# define PI 3.14159" in our code.
Please note that there is a space between "#" and "define". I have tried
space and tab in VC project, and find they work well. But I wonder whether it
is standard usage in standard C, especially in make of cygwin. Thank you!
Best regards,
GanJinhua Tag: load a PNG image Tag: 250188
difference between AfxOleInit() & CoUninitialize() ?
Hi to All,
My Questions :
1. What is the difference between AfxOleInit() & CoUninitialize() in
case of shell object?
2. In MFC appln, When i use CoInitialize(), then is it neccessary to
UnInitialize it ? and if yes,where do i UnInitialize() it?
waiting eagerly for replay.
KC. Tag: load a PNG image Tag: 250178
simple dll question
How can you register a VC++6 dll which won't register with regserv32?
This project was made with MFC App Wizard(dll).
The project works fine when it's placed in Windows\System32\ for Visual
Basic 6, but I need to place it somewhere else.
Thank you.
--
Rick Tag: load a PNG image Tag: 250165
VC 8 crash (fatal internal error) when using nested exceptions
Greetings,
While migrating some old code (5+ years) to VC 8, Beta 2 (for targeting
AMD64), I encountered an internal compiler error when building release
builds. This code builds fine in both VC 6 & 7.1 when targeting x86 (I think
it even built fine in VC 4.2 if my memory squeeks correctly). The code in
question has nested try/except blocks, for example:
"
__try
{
//OS Call
}
__except( EXCEPTION_EXECUTE_HANDLER )
{
__try
{
//OS_call(different parameters)
}
__except( EXCEPTION_EXECUTE_HANDLER )
{
//review parameters, cleanup, unwind
}
}
"
This crash was easily worked around by moving the nested exception block to
its own function. Here are the juicy details from a cross build:
"
Finished searching libraries
Finished pass 1
Generating code
xxxx.cpp(1109) : fatal error C1001: An internal error has occurred in the
compiler.
(compiler file
'f:\beta2\vctools\compiler\utc\src\P2\main.c[0x10B080F6:0x0000004F]', line
183)
To work around this problem, try simplifying or changing the program near
the locations listed above.
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
LINK : fatal error LNK1000: Internal error during IMAGE::BuildImage
Version 8.00.50215.44
ExceptionCode = C0000005
ExceptionFlags = 00000000
ExceptionAddress = 10B080F6 (10B00000)
"D:\msvc80\VC\BIN\x86_amd64\c2.dll"
NumberParameters = 00000002
ExceptionInformation[ 0] = 00000000
ExceptionInformation[ 1] = 0000004F
CONTEXT:
Eax = 00000000 Esp = 0012EDCC
Ebx = 00000000 Ebp = 0012EDF8
Ecx = 00000000 Esi = 00000000
Edx = 073E4C00 Edi = 00000000
Eip = 10B080F6 EFlags = 00010202
SegCs = 00000023 SegDs = 0000002B
SegSs = 0000002B SegEs = 0000002B
SegFs = 00000053 SegGs = 0000002B
Dr0 = 00000000 Dr3 = 00000000
Dr1 = 00000000 Dr6 = 00000000
Dr2 = 00000000 Dr7 = 00000000
"
Here's the same from the native compiler (depending on your preference):
"
xxxxx.cpp(1109) : fatal error C1001: An internal error has occurred in the
compiler.
(compiler file
'f:\beta2\vctools\compiler\utc\src\P2\main.c[0x0000000010C4B254:0x0000000000000078]', line 183)
To work around this problem, try simplifying or changing the program near
the locations listed above.
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
LINK : fatal error LNK1000: Internal error during IMAGE::BuildImage
Version 8.00.50215.44
ExceptionCode = C0000005
ExceptionFlags = 00000000
ExceptionAddress = 0000000010C4B254 (0000000010C40000)
"D:\msvc80\VC\BIN\amd64\c2.dll"
NumberParameters = 00000002
ExceptionInformation[ 0] = 0000000000000000
ExceptionInformation[ 1] = 0000000000000078
CONTEXT:
Rax = 0000000000000000 R8 = 00000000FFFE94F2
Rbx = 0000000007210000 R9 = 0000000000000000
Rcx = 0000000000000000 R10 = 726464416D654D74
Rdx = 0000000000000000 R11 = 0000000000000D4C
Rsp = 000000000023E1B0 R12 = 0000000007245960
Rbp = 0000000007248106 E13 = 00000000072481C8
Rsi = 0000000006871900 R14 = 0000000000000000
Rdi = 00000000071FBBE8 R15 = FFFFFFFFFFFFFFFF
Rip = 0000000010C4B254 EFlags = 0000000000010202
SegCs = 0000000000000033 SegDs = 000000000000002B
SegSs = 000000000000002B SegEs = 000000000000002B
SegFs = 0000000000000053 SegGs = 000000000000002B
Dr0 = 0000000000000000 Dr3 = 0000000000000000
Dr1 = 0000000000000000 Dr6 = 0000000000000000
Dr2 = 0000000000000000 Dr7 = 0000000000000000
"
It would be nice if this was fixed in a future release of this compiler.
Though busy, I may be able to assist you with additional data, though I hope
that this will be easy for you to reproduce and fix (or may have already
fixed but not yet released). Thanks!
--
Jeremiah
National Instruments -- http://www.ni.com
"stack smasher" djajadi tribute. Tag: load a PNG image Tag: 250164
question about the processes created in VC
Hi,
I am new to the windows platform and working in VC++ on WIN-2000 platform.
I have a process P1. P1 has to create another process P2 ( I'm using
CreateProcess API for the same). Now if some one kills P2 or P2 exits
gracefuly, is there any any for P1 to know that P2 has exited. Similarly if
P1 exits then is there any mechanism so that P2 can know that P1 has exited.
Pls solve my problem
Thanks in advance
Vidyut Gupta Tag: load a PNG image Tag: 250156
Why map work like this?
I'm using VC++ 6.0, I just started to learn container and iterator,
As I found a problem about container:map like below:
map<int, int> intmap;
for (int i = 0; i < 10; i++) {
intmap[i] = i+1;
}
intmap.erase(2);
map<int, int>::iterator it;
if ( (it = intmap.find(2)) != intmap.end()) {
cout << intmap[2] ;
}
the result is:
0
I had thought the key: 2 should have been erased, why it is still in
and just change the coresponding value to 0?
Thank you!
Li Hang Tag: load a PNG image Tag: 250152
While using realloc, what if the number of bytes are not available ??
Hi all,
What will happen if we have malloc 'ed some memory and reallocating the
memory at runtime.. what will happen if there is not enf space for the new
allocation ?? I know it will return the error but what will happen to the
previously allocated memory ??
--jigar Tag: load a PNG image Tag: 250124
what will be status of file descriptor ??
What will be the status of file descriptor if we,
1. open a file in parent process..
2. fork() a process and use the file in the child.
3. close the file in the child.
4. again to use the file descriptor in the parent process.
--jigar Tag: load a PNG image Tag: 250121
Whats the difference between strcpy and memcpy ??
Hi all,
what is the difference between strcpy and memcpy ??? Mean why does
memcpy takes third parameters as no of bytes to be copied ?? why does strcpy
not take it ???
--jigar Tag: load a PNG image Tag: 250113
What happens if memory allocated by new and freed up by function free() ??
Hi all,
I have been asked a question somewhere that what will happen if you
allocate the memory using new operator and de-allocating that memory using
free ?? Will it give exception or just un-defined behavior.. ???
--jigar Tag: load a PNG image Tag: 250112
"Curiouser and curiouser.", said Alice. "WTF?!", said Joe.
The following SDK program works fine on my Win2k PC.
I start trying it out on a WinXP machine:
Things are looking bad now: it will only run in debug build. In release
build it just exits (no crash, just doesn't start properly).
I track it down to the part marked with "THE REALLY IMPORTANT BIT IS
HERE" (see psuedo code, below). (I couldn't find the point of failure,
because my attempt at logging each point just caused everything to work
again (hmmm...)).
WITHOUT that code block, the program just exists prematurely.
WITH that code block, the program runs fine (note that the block is
AFTER the message pump).
If I move the code block in front of the message pump, it still works.
IF I remove the volatile keyword, the program stops working again.
If I remove huge chunks of other code (not shown), it makes no
difference.
Is it a thread issue with directX being initialised in a separate thread
from WinMain?
If I don't create the thread, I get the same behaviour as described above.
I'm using the multithreaded libs.
I could leave in the volatile loop, but I don't like not knowing why.
If I build with optimisations turned off, I get the same behaviour.
In fact, just tested it with for(x= 0; x < 1; x++){}; removed (leaving only
the volatile declaration - unreferrenced variable), and with optimisations
turned off, it had the same effect (program worked). With optimisation on,
it looks like it's been optimised away (program stops working).
So, what the frig is going on? Any ideas?
pseudo code:
WinMain(){
CreateEvent to check for previous existance.
Read and Write a couple of DWORDS to the registry
Register a Window Class
hwndApp= CreateWindow
_beginthreadex (myThreadProc)
check current user's locale.
Add a tray icon
// normal message loop stuff
MSG msg;
ZeroMemory(msg)
while(msg != WM_QUIT){
PeekMessage()
TranslageMessage()
DispatchMessage()
}
// THE REALLY IMPORTANT BIT IS HERE.
{
volatile int x;
for(x= 0; x < 1; x++){};
}
}
myThreadProc(){
set up directx.
etc.
} Tag: load a PNG image Tag: 250108
Hi,
how could i load a PNG image file in VC++ ?
is it possible using only Win32 functions or should i use MFC ?