|
If think, instead of this, NULL check would be better option,
ie.
if ( AfxGetThread())
{
COleMessageFilter* pfilter = ::AfxOleGetMessageFilter (); \
if (NULL != pfilter) \
{ \
pfilter->EnableBusyDialog(FALSE); \
pfilter->EnableNotRespondingDialog(FALSE); \
}
}
Because, NULL pointer access will simply cause crash, instead of throwing exception.
|
|
|
|
|
Anyone know how to make a C++ dll that Cold Fusion can access?
|
|
|
|
|
I don't know CF, but most non-C languages require that the functions be exported as C functions with undecorated names, like:
extern "C" __declspec(dllexport) int SomeFunc(); C linkage is the lowest-common-denominator when it comes to exports.
|
|
|
|
|
Hi,
How can I get the reference of a already launched visual studio IDE
in the Window OS and automate it in my program ?
Thanks
|
|
|
|
|
Hey, guys.
I have a dll that I originally built in VS2003 that uses the new common controls 6 look and feel via jumping through the hoops of the manifest, defining ISOLATION_AWARE_ENABLED and such.
I opened and converted this project in VS2005. Everything compiles, everything works, except that I no longer get the cc6 look and feel. Anyone have any idea what it is about VS2005 that breaks this, and how I can fix it?
Thanks,
|
|
|
|
|
Hi
I am a new learner of visual c++ for a new job.I want to use an owner-drawn button in my application.for example I downloaded CRoundButton2 project from this site but I couldn't use it.my question is that how can I apply this button for the buttons in my project.If someone can explain how can I use them,I will be so glad.(I tried to do what was explained in the project,bu I was not successful.)
Good Bye
(Full name of the project is -> CRoundButton2 - A fancy graphical button)
|
|
|
|
|
the best place to ask is in the forum at the botton of the article from which you downloaded it.
|
|
|
|
|
you will probably need to subclass the item.
here is what you do:
- create a data member for the control you subclass in the class of the owner window
- include the new control header
- change the type of the member
so, you will change
class CMyDialog : public CDialog
{
//blah, blah, blah
CButton m_btn;
};
into
#include "RoundButton2.h"
class CMyDialog : public CDialog
{
//blah, blah, blah
CRoundButton2 m_btn;
};
there are other ways as well, but this looks the best from my POINT of CView
Live long and prosper
johny74656@gmail.com
|
|
|
|
|
Hey guys,
I accidently posted this in the wrong forum yesterday, but after the initial flame, i got some suggestions. I figured id repost this in the right forum to see what you guys thought.
Im having a problem with the CImage::GetBits(). Im opening a TIFF file using a CImage object, and i want to take information from this image for use in another function. Here is whats happening.
unsigned BYTE* pBits<br />
chBitBuffer = image->GetBits();
This compiles, and appears to work fine, but after several access violations I went a bit deeper.
image's height = 1179, width = 673, bits per pixel = 32.
So Im assuming that the number of pixels = height * witdth. Number of pixels * 4 = total number of bytes, since each pixel is 4 bytes (32/8).
The problem comes in when I try to access the data returned from GetBits(). The buffer only has a length of 3224 in this example, when my calculations say it should be as long as the number of bytes(3173868).
Any clues to what may be going on here?
I win because I have the most fun in life...
|
|
|
|
|
The individual rows of pixels aren't necessarily right next to each other in memory; chances are there are padding bytes at the end of each row of pixels; Look at the GetBits() and GetPitch() documentation for info on this.
Also, depending on the pitch your pointer may be pointing near the end of the image not the beginning.
When you say, "The buffer only has a length of 3224", which buffer are you referring to? How are you getting this size?
|
|
|
|
|
GetPitch() returns a -2692, which mean the DIB is bottom up. this means that the buffer pointer is pointing towards the last row of the image.
the buffer is the bitmap buffer that GetBits() returns the pointer to.
I got the 3224 with a dumb for loop to see when i got the access violation.
for(int i = 0; i < 999999999; i++)
nBits[i] = o;
it broke on i = 3224
I win because I have the most fun in life...
|
|
|
|
|
The fact that it faulted at 3224 is arbitrary. There may have been extra bytes allocated for
alignment or efficiency or whatever. That doesn't mean it's ok to read/write past the end of
where the data is supposed to be.
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
VonHagNDaz wrote: ...but after the initial flame...
You consider this a flame?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
maybe misuse of the term, i was just pointing out that i miss clicked and put the initial question in the wrong forum
I win because I have the most fun in life...
|
|
|
|
|
Let 'em move the post if they want to I kept replying there - I don't know if I helped any.
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
thanks man, your post back in the c++/cli forum did the trick! It was all in the way i was handling the pitch in regard to the pixel buffer. just know that somewhere there is .cpp file with your name quoted!
I win because I have the most fun in life...
|
|
|
|
|
Cool!
VonHagNDaz wrote: just know that somewhere there is .cpp file with your name quoted!
I will deny everything Never leave a paper trail is my motto!
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Hi all.
I need add to my project "Wsock32.lib", if you can tell me how?
|
|
|
|
|
look in your linker settings...
|
|
|
|
|
|
In addition to previous reply, you can use pragma in your code,too.
#pragma comment( lib, "Wsock32.lib" )
|
|
|
|
|
Thanks for help.
I will use it.
|
|
|
|
|
Hi there,
I was wondering if you have a client socket that is supposed to initiate the connection to a server, how often the client sends the request? I have a client socket and it seems that there is some wireless communication problem so that the socket connection to the server goes down and the client socket sends the request for connection every 1/100 second. Does it make sense to you guys?
I log every messages that go through the sockets and I see the connection request every 1/100second and it seems that the connection is establishing and then I see WSAENOTSOCK message and the socket gets closed and the establishes and I get WSAECONNRESET message and it continues until the connection stays up and open. Does anybody know whatis going on here??
Thanks,
|
|
|
|
|
It depends on the protocol. If you're using TCP then you could research the TCP protocol and
see how it handles reconnects. I suppose that could be implementation specific - Microsoft's
TCP implementation may be different then others.
How are you seeing the socket error codes? These aren't part of the protocol.
The WSAENOTSOCK error isn't good - that's usually (always?) from a programming error.
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
I have done this t get the Error:
BOOL Socket::StoreError( INT Error )
{
BOOL RetCode;
RetCode = FALSE;
__try
{
if( Error != 0 )
{
.........
switch( Error )
{
case WSAEACCES: wsprintf( ErrBuff, "WSAEACCES" ); break;
case WSAEADDRINUSE: wsprintf( ErrBuff, "WSAEADDRINUSE" ); break;
case WSAENOTSOCK: wsprintf( ErrBuff, "WSAENOTSOCK" ); break;
...........
...........
if(( strlen( ErrBuff )> 0 )&&( RetCode ))
{
LogError( "Socket", "StoreError", "%s, %s", sName, ErrBuff );
}
I also check the status of the socket in the data link layer and write it down to the log.
|
|
|
|