|
Daniel 'Tak' M. wrote: I now am facing a box that comes from MFC
What do you mean by this? I don't think you will get random message boxes without writing some code.
Daniel 'Tak' M. wrote: I stumbled upon this a few times during testing, but never cared
Big mistake.
I must get a clever new signature for 2011.
|
|
|
|
|
I suggest you follow the tried and true and procudure of getting a stack trace when the problem occurs. You may want to alter the settings for the release build so that a pdb file is built (so you get a more meaningful stack).
Steve
|
|
|
|
|
My main problem is not to find out where it occurs, the main problem is why all warnings and errors from MFC are empty... It doesn't happen only this one time, it happens for every DDV call as well, for example, and I'd really prefer some more meaningful message boxes (crazy, I know). Is there, for example, a resource DLL that has to be shipped with my program so that MFC can load its error messages properly? Something like that...
http://www.renderpal.com
http://www.shoran.de
|
|
|
|
|
Daniel 'Tak' M. wrote: Is there, for example, a resource DLL
If you create a standard MFC app and choose the defaults, you will see that "afxres.rc" is included in the project's .rc file.
|
|
|
|
|
- Consider a class that is used as a utility by many of your classes.
- The classes that can use it (I'm calling it the host or parent class for now) must, derive from some abstract base class .
- When you instantiate the utility class, the constructor takes a reference to the host or parent class so it can call the base class methods the hosts are required to implement. This reference is stored as a member in the utility class object instance.
(NOTE: lifetime issues are taken care of properly since the utility class object is a member of the host but that is unrelated)
What do you refer to this member variable (reference) for the hosting class as?
I've been using...
m_parent
m_host
However, I'm wondering if these don't convey the relationship properly.
What terms do some of you use for such a relationship?
|
|
|
|
|
How about m_container or maybe m_utilizer ?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
thanks.
I sometimes wish there was a programmers thesaurus to help find meaningful class and variable names that match intent. MS Word thesaurus only goes so far. 
|
|
|
|
|
Or at least an online random class/variable name generator similar to these[^], it could spit out smart-sounding names like: m_denominatorEqualizerFactor or somesuch.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
Hello folks!
Am not sure where to ask this so i thought i ask here, maybe you fellas know the answer. If i write a Visual Studio Add-in in VC++, is there any way to "hook" the up-to-date check VS does when compiling files? When you hit "Build", VS checks what files have changed and what files are up-to-date and builds only the ones that are outdated. VS seems to be also using the pch file and perhaps pdb file to determine this, i guess it is needed when using precompiled headers. What i would like to do is handle the up-to-date check for certain files a bit differently than others. E.g. the project has a file called "source.cpp", when the up-to-date check is done, i'd like my method to be called with the name (or full path) of "source.cpp" and the corresponding pch, e.g. "c:\vsprojects\theproject\debug\vc70.pch", then for some files i'd just like to pass this along to the "default" handler but for certain files i'd like to "redirect" the path to the pch to somewhere else. Anyone knows how this could be done?
Thanks in advance for any pointers (preferably not NULL pointers ).
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
the "up-to-date" check is done by the compiler / linker by comparing the timestamp of the exe/dll to that of it's component .obj files, the .obj files timestamps are compared to those of the associated .c or .cpp files, the .c / .cpp files are compared to those of it's included files. If any of the timestamps are greater that triggers a build of the appropriate .c/.cpp file(s), then the .obj files are then linked to make the target .exe/.dll file. So, if you want a .cpp file to be built based on some other file's timestamp you need to find a way to tell the compiler (or Visual Studio) to do so.
There is a way to hook into the build process in the way you describe by making a Visual Studio extension. Look here[^] for info about that.
"If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
|
|
|
|
|
I've been experimenting a bit and what i see is that VS passes only those .cpp files to the compiler which need to be updated in the first place so the up-to-date check isn't done by the compiler (could be that the compiler itself also does some check against the boject files, i don't know that, but as said, it gets the list of outdated files in the first place). Also, if the pch file is removed, VS passes all(?) the files to the compiler even tough the obj files are still there and the sources are not modified. I supose this is done because if a header changes this is the way for VS to know what cpp files include it and need to be rebuilt, but if the pch is missing then it falls back to rebuilding everything to reproduce the pch file. Ah, and another thing, i'm talking VS2003 (i know, it's old, but i have no other options).
Thanks for the link, i will check it out.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
You are right as pertains to VS passing only those files needing to be recompiled.
The reason for passing all of the files in the case of the deleted / missing .PCH file is it is the compiler that builds it.
"If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
|
|
|
|
|
Have you checked nmake?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Now i did, but it doesn't seem to be involved, isn't nmake used only for makefile projects?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
Code-o-mat wrote: ...but it doesn't seem to be involved, isn't nmake used only for makefile projects?
Yes, but I was just giving you something else to consider. I often times do not solve problems directly, but give folks ideas and suggestions that they can then take a step further and decide if its right for them or not.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
The idea was good, thank you. Indeed sometimes all people need is a kick in the right direction and then they can tumble down the stairs themselfs. Most of the time i am just looking for that kick when asking questions, getting the complete solution on a plate is no fun.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
How can I get direct access of disk and partition of disk instead UAC enabled or disabled?
There is a utility which provides direct access called RAWDISK from eldos.
But this is paid, Is there anything free?
|
|
|
|
|
Firstly, this is not a C/C++ question, so it does not belong in this forum.
Secondly, if you are looking for free software then a Google search should be your first port of call.
I must get a clever new signature for 2011.
|
|
|
|
|
Do you realize UAC is a feature, not a bug?
(it looks like a bug, I should admit).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I want the color of every pixel of bitmap image, so that I can extract alpha value of it.
I have tried GetPixel, but it is very slow. I tried GetDIBits as well but it's not giving me the proper color as compare to GetPixel gives. Can somebody help me??
|
|
|
|
|
Amrit Agr wrote: I tried GetDIBits as well but it's not giving me the proper color as compare to GetPixel gives.
What do you intend, specifically (i.e. are you sure you got the right pixel value, could you post some code)?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The buffer returned by GetDIBits holds the pixel data in a way that isn't very intuitive:
- The pixel data is stored bottom-up, which means line 0 is the bottom of the image.
- The pixel values are stored as blue/green/red rather than red/green/blue.
- Each line is 4byte-alligned. So if your bitmap would be 24bpp (3 bytes) and the image width is 125 pixels, the expected line length would be 3*125 = 375, but it is in fact rounded up to 376, where the 376th byte contains no information.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
I think GetPixel doesn't give you any alpha values, or does it? Anyways, you could alternatively use Gdiplus::Bitmap[^] and its Bitmap::GetPixel[^] method, not sure about its speed though.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
HI ALL
I am trying to load image buffer and update image buffer per second .
The function can load 256*256 image or 512*512 image but it can not load 768*576 image.
I apply it with following function,Please let me know how can i load 768*576 image buffer?.
int iwidth=768;
int iHeight=512;
unsigned char* data = 0;
float angle=1.0f;
BOOL CTestDlg::CreateWindowGL(HWND window) // This Code Creates Our OpenGL Window
{
DWORD windowStyle = WS_OVERLAPPEDWINDOW; // Define Our Window Style
DWORD windowExtendedStyle = WS_EX_APPWINDOW; // Define The Window's Extended Style
int iBitperPixel=16;
PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be
{
sizeof (PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
1, // Version Number
PFD_DRAW_TO_WINDOW | // Format Must Support Window
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
PFD_DOUBLEBUFFER, // Must Support Double Buffering
PFD_TYPE_RGBA, // Request An RGBA Format
iBitperPixel, // Select Our Color Depth
0, 0, 0, 0, 0, 0, // Color Bits Ignored
0, // No Alpha Buffer
0, // Shift Bit Ignored
0, // No Accumulation Buffer
0, 0, 0, 0, // Accumulation Bits Ignored
16, // 16Bit Z-Buffer (Depth Buffer)
0, // No Stencil Buffer
0, // No Auxiliary Buffer
PFD_MAIN_PLANE, // Main Drawing Layer
0, // Reserved
0, 0, 0 // Layer Masks Ignored
};
GLuint PixelFormat; // Will Hold The Selected Pixel Format
CDC *pDc= GetDC(); // Grab A Device Context For This Window
PixelFormat = ChoosePixelFormat (pDc->m_hDC, &pfd); // Find A Compatible Pixel Format
if (SetPixelFormat (pDc->m_hDC, PixelFormat, &pfd) == FALSE) // Try To Set The Pixel Format
{
// Failed
ReleaseDC (pDc); // Release Our Device Context // Zero The Window Handle
return FALSE; // Return False
}
hRC = wglCreateContext (pDc->m_hDC); // Try To Get A Rendering Context
// Make The Rendering Context Our Current Rendering Context
if (wglMakeCurrent (pDc->m_hDC, hRC) == FALSE)
return FALSE;
glViewport (0, 0, (GLsizei)(iwidth), (GLsizei)(iHeight)); // Reset The Current Viewport
glMatrixMode (GL_PROJECTION); // Select The Projection Matrix
glLoadIdentity (); // Reset The Projection Matrix
gluPerspective (45.0f, (GLfloat)(iwidth)/(GLfloat)(iHeight),1.0f, 100.0f); // Calculate The Aspect Ratio Of The Window
glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix
glLoadIdentity ();
return TRUE; // Window Creating Was A Success
// Initialization Will Be Done In WM_CREATE
}
BOOL CTestDlg::Initialize()
{
// Start Of User Initialization
angle = 1.0f;
// Set Starting Angle To Zero // Grab A Device Context For Our Dib
glClearColor (0.0f, 0.0f, 0.0f, 0.5f); // Black Background
glClearDepth (1.0f); // Depth Buffer Setup
glDepthFunc (GL_LEQUAL); // The Type Of Depth Testing (Less Or Equal)
glEnable(GL_DEPTH_TEST); // Enable Depth Testing
glShadeModel (GL_SMOOTH); // Select Smooth Shading
glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Set Perspective Calculations To Most Accurate
glEnable(GL_TEXTURE_2D); // Enable Texture Mapping
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); // Set Texture Max Filter
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); // Set Texture Min Filter
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); // Set The Texture Generation Mode For S To Sphere Mapping
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); // Set The Texture Generation Mode For T To Sphere Mapping
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 256,256, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
return TRUE; // Return TRUE (Initialization Successful)
}
void CTestDlg::Draw() // Draw Our Scene
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
int i,j;
LoadBmpFile("C:\\test.bmp",i,j);
glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0,i, j, GL_RGB, GL_UNSIGNED_BYTE, data);
if (TRUE) // Is Background Visible?
{
glLoadIdentity(); // Reset The Modelview Matrix
glBegin(GL_QUADS); // Begin Drawing The Background (One Quad)
// Front Face
glTexCoord2f(1.0f, 1.0f);
glVertex3f( 11.0f, 8.3f, -20.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(-11.0f, 8.3f, -20.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-11.0f, -8.3f, -20.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f( 11.0f, -8.3f, -20.0f);
glEnd(); // Done Drawing The Background
}
glFlush (); // Flush The GL Rendering Pipeline
}
|
|
|
|
|
Please, in the future read the posting guidelines before posting (for instance, use the pre tags to format your code properly so that it is readable).
Now to your question: OpenGL only handle images which have a power of 2 as dimensions. Loading images with non-standard dimensions will work on certain graphic cards but not all of them. So, the solution to your problem is to simply create your image as a 1024x1024 image (for instance, additional space is filled with white) and then when the image is used (using glTexCoord2) you only take the part where your image really is (for instance if your image is 768 pixels wide, you have to specify 768/1024=0.75 in your glTexCoord function).
|
|
|
|
|