|
If you had done a search on Google first you could have found this article[^].
|
|
|
|
|
thank you very much.
my time, for this problem, is very few. you helped me, thanks.
and this article: Getting the most out of IDispatch[^], solved my problem.
Zo.Naderi-Iran
|
|
|
|
|
What's wrong with my code to load an image from a file? It doesn't seem to work. Or is it the code to make it into an HDC that causes the problem?
HBITMAP LoadBitmapFromFile(LPCTSTR szFilename)
{
HBITMAP hBitmap = NULL;
hBitmap = (HBITMAP)LoadImage(NULL, szFilename, IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE);
return hBitmap;
}
HDC userNewHDC;
HBITMAP userNewBitmap;
userNewBitmap = LoadBitmapFromFile("C:\imagefile.bmp");
userNewHDC = CreateCompatibleDC(NULL);
SelectObject(userNewHDC,userNewBitmap);
I then BitBlt the userNewHDC object but it doesn't seem to work. Whats wrong?
|
|
|
|
|
You should check the return values and the error codes using GetLastError() .
|
|
|
|
|
Try using the Debugger to see if LoadBitmapFromFile returns NULL or a valid handle.
You can than use GetLastError() to see what went wrong.
Looking at your code I would say you should change:
userNewBitmap = LoadBitmapFromFile("C:\imagefile.bmp")
to:
userNewBitmap = LoadBitmapFromFile("C:\\imagefile.bmp");
|
|
|
|
|
Omnicoder wrote: It doesn't seem to work.
How are you verifying this?
"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
|
|
|
|
|
hi every body,
is it possible to handle voice speech recognizable and saving option in vc++6.0
please help me..
thanks in advance
|
|
|
|
|
Not possible in VC++6.0 unless you install and use SAPI, Just refer [^]
Величие не Бога может быть недооценена.
|
|
|
|
|
Hi,
I utilize Visual C++ 2003 and MFC with document/view architecture..
I want to respond differently when I choose Print from the menu and the Print button from the toolbar. The reason is that I want to select the file to print when I choose from the menu, and I want to print directly the open file when I choose from the Print toolbar button.
How can I do that ?
Thanks,
Claude
|
|
|
|
|
Gagnon Claude wrote: I want to respond differently when I choose Print from the menu and the Print button from the toolbar.
Connect them to different triggers.
|
|
|
|
|
I want to draw menu without the shadow frame, but i don't know how to deal with the frame of the menu. I searched but only found one project Professional User Interface Suite[^] implemented this. But, the project is so huge, so, i almost can't find how it reaches its aim.
Any ideas will be very appreciated.
Regards
|
|
|
|
|
Hi all,
using System.Net.WebClient().DownloadFile we can download the files from web in C#.
How to incorporate these functionalities in WIN32 C++ projects
i am using Microsoft Visual C++ 6.0
Thanks in advance
|
|
|
|
|
|
|
You can use the Windows API: UrlDownloadToFileA or UrlDownloadToFileW .
|
|
|
|
|
#include <windows.h>
#include <stdio.h>
#include <math.h>
#include <gl\glew.h>
#include <gl\gl.h>
#include <gl\glut.h>
static GLfloat f1,f2,f3;
static void initA(void)
{
GLfloat fogColor[4]={0.0,0.25,0.25,1.0};
f1=1.0f;
f2=5.0f;
f3=10.0f;
glEnable(GL_FOG);
glFogi(GL_FOG_MODE,GL_EXP);
glFogfv(GL_FOG_COLOR,fogColor);
glFogf(GL_FOG_DENSITY,0.25);
glHint(GL_FOG_HINT,GL_DONT_CARE);
glFogi(GL_FOG_COORDINATE_SOURCE_EXT,GL_FOG_COORDINATE_EXT);
glClearColor(0.0,0.25,0.25,1.0);
}
void displayA(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,0.75,0.0);
glBegin(GL_TRIANGLES);
glFogCoordfEXT(f1);
glVertex3f(0.2f,0.2f,0.0f);
glFogCoordfEXT(f2);
glVertex3f(-0.2f,0.0f,-0.5f);
glFogCoordfEXT(f3);
glVertex3f(0.0f,0.2f,-1.0f);
glEnd();
glutSwapBuffers();
}
void reshapeA(int w,int h)
{
glViewport(0,0,(GLint)w,(GLint)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0,1.0,0.25,25.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0,0.0,-5.0);
}
void keyboardA(unsigned char key,int x,int y)
{
switch(key)
{
case 'c':
glFogi(GL_FOG_COORDINATE_SOURCE_EXT,GL_FRAGMENT_DEPTH);
glutPostRedisplay();
break;
case 'C':
glFogi(GL_FOG_COORDINATE_SOURCE_EXT,GL_FOG_COORDINATE);
glutPostRedisplay();
break;
case '1':
f1=f1+0.25;
glutPostRedisplay();
break;
case '2':
f2=f2+0.25;
glutPostRedisplay();
break;
case '3':
f3=f3+0.25;
glutPostRedisplay();
break;
case '8':
if(f1&amp;amp;amp;amp;amp;gt;0.25)
{
f1=f1-0.25;
glutPostRedisplay();
}
break;
case '9':
if(f2&amp;amp;amp;amp;amp;gt;0.25)
{
f2=f2-0.25;
glutPostRedisplay();
}
break;
case '0':
if(f3&amp;amp;amp;amp;amp;gt;0.25)
{
f3=f3-0.25;
glutPostRedisplay();
}
break;
case 'b':
glMatrixMode(GL_MODELVIEW);
glTranslatef(0.0,0.0,-0.25);
glutPostRedisplay();
break;
case 'f':
glMatrixMode(GL_MODELVIEW);
glTranslatef(0.0,0.0,0.25);
glutPostRedisplay();
break;
case 27:
exit(0);
break;
default:
break;
}
}
int main(int argc,char** argv)
{
glutInit(&amp;amp;amp;amp;amp;amp;argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(400,400);
glutCreateWindow("Fog effect Demo");
initA();
glutReshapeFunc(reshapeA);
glutKeyboardFunc(keyboardA);
glutDisplayFunc(displayA);
glutMainLoop();
return 0;
}
The code can be impiled,but it can not run. when it runs, the operate system give an exception message.I use vc6.0 as a tool.
modified on Tuesday, November 24, 2009 4:02 AM
|
|
|
|
|
Is there a question in there somewhere?
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Yes,it can not run. There is an abnormal essage.
|
|
|
|
|
Please read the posting guidelines before posting on this message board (this is the message called "How to ask a question").
Points which require your attention:
1) Formatting of the code (use the code tag to format code properly)
2) No clear description of the problem (please provide details about it)
3) You say there's a "abnormal essage", then give the exact error message and in which conditions it occurs.
|
|
|
|
|
I am sorry for that. This is my fist time to ask help in this site.
|
|
|
|
|
You still didn't provide a lot of information. What is the exact error message ? Did you try to debug to see where your code causes problem ?
|
|
|
|
|
I have tried to debug. when it runs to the
" glFogCoordfEXT(f1); ",the program stops.
this is the error message:
AppName: fog.exe AppVer: 0.0.0.0 ModName: unknown
ModVer: 0.0.0.0 Offset: 00000000
|
|
|
|
|
Can you send an array of longs through a pipe? If it is possible, how would you do it?
Thanks in advance.
|
|
|
|
|
Typecast the array to whatever data type the function to send expects and give sizeof(array) as the size to be sent.
|
|
|
|
|
I never thought to do that, thanks so much, you're a lifesaver!
|
|
|
|