|
Do you want to load and show bmp file yourself?
|
|
|
|
|
yes.I need to load the .bmp file in tree control.If i click that file it will show in pain.
|
|
|
|
|
AnithaSubramani wrote: I need to load the .bmp file in tree control.
See here.
AnithaSubramani wrote: If i click that file it will show in pain.
This has already been answered (assuming you are not wanting to know how to respond to a mouse click).
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I think David answered to your question and for show your bmp file you can use of LoadImage or CImage class.
|
|
|
|
|
Hi all,
in my application i m using a wizad dialog here i can use 8 different wizard pages.
when run my application it works poperly but if i work on it over 4-5 hr than it woking like in hang of not responding condition and in this case the memory usage of application is increase upto 30000k.
same condition occurs even i left my application in open condition for long time.
i this there is some problem of memory relese.
if yes please help me.
or give me any other solution for this.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
|
i made this code conversion but i have 2 problems there one it works perfectly for a word with 3 chars but it doesnt for a 4 char cant understand why ..
second problem i cant add a simple manu with an if so i can separate the encryption from the decryption ...any ideas how can i do that ..
here is pascal code ...
program shfrovalka;
uses crt;
var text:string;
m,k,c,men:integer;
procedure cez(var text:string; var k:integer);
begin
clrscr;
writeln('vvedite isxodniy text ');
write('$~/> ');
read(text);
write('vvedite klu4 shifrovani9 ');
readln(k);
for m:=1 to length(text) do
begin
c:=ord(text[m])+k;
if c>256 then c:=c-256;
text[m]:=chr(c);
end;
end;
procedure desh (var text:string);
begin
writeln('vvedite kluch deshifrovki' );
readln(k);
for m:=1 to length(text) do
begin
c:=ord(text[m])-k;
if c<256 then c:=c+256;
text[m]:=chr(c);
end;
end;
begin
repeat
clrscr;
writeln('1 - shifrovka ');
writeln('2 - deshifrovka ');
writeln('3 - sosto9nie texta ');
readln(men);
case men of
1:cez(text,k);
2:desh(text); U?
3:begin
writeln(text);
readkey;
end;
end;
until men = 0;
end.
here is my c code..
#include <stdio.h>
#include <string.h>
#include <conio.h>
char text[256];
int m,k,c,men;
void cez(char *Text)
{
printf("%s\n", "give me the text");
gets(Text);
printf("%s\n", "give me the key ");
scanf("%d", &k);
for(m = 0; m < strlen(text); ++m)
{
c = text[m] + k;
if(c > 256) c -= 256;
Text[m] = c;
}
}
void desh(char *Text)
{
printf("%s\n", "give me the decoding key ");
scanf("%d", &k);
for(m = 0; m < strlen(text); ++m)
{
c = Text[m] - k;
if(c < 256) c+=256;
Text[m] = c;
}
}
int main()
{
cez(text);
printf("%s\n", text);
desh(text);
printf("%s\n", text);
_getch();
return 0;
}
|
|
|
|
|
Member 4038335 wrote: char text[256];
Comment this line out and you'll see the problem.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
what is rong with it ? as far as i know it s the way to do it with aski code...what should i replce instead of 256?
|
|
|
|
|
Member 4038335 wrote: what is rong with it ?
Did you do as I suggested (and then obviously recompile)?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
well i saw th poblem there i rewrite the code but stil i have same problem when i use 'o' or any letter after it will shift outside of printable chars. of ASCII how can i fix that??
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <cctype>
#include <cstdlib>
char text[256];
int m,c,men;
void cez(char *Text)
{
char key[20];
printf("%s\n", "dwse text ");
gets_s(Text,256);
printf("%s\n", "dwse to klidi kriptografisis");
gets_s(key,20);
for(int i=0; key[i] !='\0'; i++)
{
if(!isdigit(key[i]))
{
printf ("Your key is not number! Try again \n");
return;
}
}
int k = atoi(key);
for(m = 0; m < strlen(text); ++m)
{
c = text[m] + k;
if(c > 256) c -= 256;
Text[m] = c;
}
}
void desh(char *Text)
{
char key[20];
printf("%s\n", "dwse to klidi apokriptografisis");
gets_s(key,20);
for(int i=0; key[i] !='\0'; i++)
{
if(!isdigit(key[i]))
{
printf ("Your key is not number! Try again \n");
return;
}
}
int k = atoi(key);
for(m = 0; m < strlen(text); ++m)
{
c = Text[m] - k;
if(c < 256) c+=256;
Text[m] = c;
}
}
int main()
{ printf("=======================\n KRYPTOGRAFISH \n=======================\n");
cez(text);
printf("%s \n", text);
printf("=======================\n APOKRYPTOGRAFISH \n=======================\n");
desh(text);
printf("%s \n", text);
}
|
|
|
|
|
Member 4038335 wrote: well i saw th poblem there i rewrite the code...
But your code snippet shows otherwise. Until you address the problem, the outcome will remain the same.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi All,
Im using the two tree controls in my project.This tree control has list folders.That folders contains some .txt file.I need to drag the .txt files from first tree to another one.I dont need to darg & drop the folders.
Thanks in advance.
Regards,
Anitha
modified on Saturday, November 22, 2008 1:17 AM
|
|
|
|
|
When the user drags an item in the tree control the control will send you a TVN_BEGINDRAG notification, also look into the DoDragDrop function for starters, there is a lot of help online about doing Drag And Drop, also here on Codeproject, and of course, google is your friend.
|
|
|
|
|
Hi!
i have a MFC project by Single Document.
i remove title bar and any border on form (main form) for my project.
but a thin line around of the form!
i don't want any line. what do i do?
Zo.Naderi-Iran
|
|
|
|
|
i resolve my problem.
in OnCreate in CMainFrame Class, i call
ModifyStyle(WS_BORDER, NULL);
my wrong was :
ModifyStyle(NULL, WS_BORDER);
thank you
Zo.Naderi-Iran
|
|
|
|
|
In the future you should post the code relevant to your problem. If you would have posted that line of code someone would have instantly recognized the error.
Best Wishes,
-David Delaune
|
|
|
|
|
Hi all,
Printing matter is greater than one page but when i generate the preview i can view only single page same problem for printing only single page is print.
i m use this also.
pInfo->m_bContinuePrinting=TRUE;
but after use this the problem still same,there is no effects.
please help he for this.
i waiting for your valuable suggestions and views.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
u must be having a lot of data ,that cannot fit in a page ,so u need
to shift viewport origin using setviewportorigin() in OnPrepareDC method ...see msdn for more
info.......
best regards
|
|
|
|
|
Hello, it goes wrong again but I don't know where to make it right.
Last time the code that should be no wrong coz I builded it successfully just stuck in type conversion. I mean no pragma use or others. It just my fault that just uses the code without make suitable type.
Now I make my own project that uses bitmap. Finally, I've build it successfully and the compiled result's shown below.
====================================================================================================
------ Rebuild All started: Project: KungfuPanda, Configuration: Debug Win32 ------
Deleting intermediate and output files for project 'KungfuPanda', configuration 'Debug|Win32'
Compiling...
PO.cpp
c:\program files\microsoft sdks\windows\v6.0a\include\gl\glaux.h(17) : warning C4068: unknown pragma
c:\program files\microsoft sdks\windows\v6.0a\include\gl\glaux.h(374) : warning C4068: unknown pragma
c:\documents and settings\satellite\my documents\visual studio 2008\projects\vc++ project\kungfupanda\kungfupanda\po.cpp(33) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\program files\microsoft visual studio 9.0\vc\include\stdio.h(237) : see declaration of 'fopen'
Compiling manifest to resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
Copyright (C) Microsoft Corporation. All rights reserved.
Linking...
LINK : C:\Documents and Settings\SATELLITE\My Documents\Visual Studio 2008\Projects\VC++ PROJECT\KungfuPanda\Debug\KungfuPanda.exe not found or not built by the last incremental link; performing full link
Embedding manifest...
Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
Copyright (C) Microsoft Corporation. All rights reserved.
Build log was saved at "file://c:\Documents and Settings\SATELLITE\My Documents\Visual Studio 2008\Projects\VC++ PROJECT\KungfuPanda\KungfuPanda\Debug\BuildLog.htm"
KungfuPanda - 0 error(s), 3 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
=====================================================================================================
This make me very happy, coz this is my first project but something bad appear while I start debuging.
It just like before, I mean while the windows form appear "would you like to run in fullscreen mode", whether I choose yes or no, it just start the appearence then disappear in seconds. Maybe in milliseconds.
What cause this problem. For every one who knows this case, please tell me. How to prevent the result not to disappear while it just start running ? A comment would be a real help.
Here's the debugging log
===================================================================================================
'KungfuPanda.exe': Loaded 'C:\Documents and Settings\SATELLITE\My Documents\Visual Studio 2008\Projects\VC++ PROJECT\KungfuPanda\Debug\KungfuPanda.exe', Symbols loaded.
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\glu32.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\user32.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_597c3456\msvcr90d.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\imm32.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\lpk.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\usp10.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\avgrsstx.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\MSCTF.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\version.dll'
'KungfuPanda.exe': Unloaded 'C:\WINDOWS\system32\version.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\MSCTFIME.IME'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\ole32.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll'
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\iglicd32.dll', Binary was not built with debug information.
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\igldev32.dll', Binary was not built with debug information.
'KungfuPanda.exe': Loaded 'C:\WINDOWS\system32\mcd32.dll'
'KungfuPanda.exe': Unloaded 'C:\WINDOWS\system32\mcd32.dll'
The program '[896] KungfuPanda.exe: Native' has exited with code 0 (0x0).
===================================================================================================
This is my first project code; If I run it should be a rotating box that contain Po bitmap.
====================================================================================================
#include <windows.h>
#include <stdio.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>
HDC hDC=NULL;
HGLRC hRC=NULL;
HWND hWnd=NULL;
HINSTANCE hInstance;
bool keys[256];
bool active=TRUE;
bool fullscreen=TRUE;
GLfloat xrot;
GLfloat yrot;
GLfloat zrot;
GLuint texture[1];
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
AUX_RGBImageRec *LoadBMP(char *Filename)
{
FILE *File=NULL;
if (!Filename)
{
return NULL;
}
File=fopen(Filename,"r");
if (File)
{
fclose(File);
return auxDIBImageLoad(Filename);
}
return NULL;
}
int LoadGLTextures()
{
int Status=FALSE;
AUX_RGBImageRec *TextureImage[1];
memset(TextureImage,0,sizeof(void *)*1);
if (TextureImage[0]=LoadBMP("Data/DragonWarrior.bmp"))
{
Status=TRUE;
glGenTextures(1, &texture[0]);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
}
if (TextureImage[0])
{
if (TextureImage[0]->data)
{
free(TextureImage[0]->data);
}
free(TextureImage[0]);
}
return Status;
}
GLvoid ReSizeGLScene(GLsizei width, GLsizei height)
{
if (height==0)
{
height=1;
}
glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Calculate The Aspect Ratio Of The Window
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
int InitGL(GLvoid)
{
if (!LoadGLTextures())
{
return FALSE;
}
glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
return TRUE;
}
int DrawGLScene(GLvoid)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0f,0.0f,-5.0f);
glRotatef(xrot,1.0f,0.0f,0.0f);
glRotatef(yrot,0.0f,1.0f,0.0f);
glRotatef(zrot,0.0f,0.0f,1.0f);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glBegin(GL_QUADS);
// muka depan
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
// muka belakang
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
// muka atas
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
// muka bawah
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
// muka kanan
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
// muka kiri
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
glEnd();
xrot+=0.3f;
yrot+=0.2f;
zrot+=0.4f;
return TRUE;
}
GLvoid KillGLWindow(GLvoid)
{
if (fullscreen)
{
ChangeDisplaySettings(NULL,0);
ShowCursor(TRUE);
}
if (hRC)
{
if (!wglMakeCurrent(NULL,NULL))
{
MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
}
if (!wglDeleteContext(hRC))
{
MessageBox(NULL,"Release Rendering Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
}
hRC=NULL;
}
if (hDC && !ReleaseDC(hWnd,hDC))
{
MessageBox(NULL,"Release Device Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
hDC=NULL;
}
if (hWnd && !DestroyWindow(hWnd))
{
MessageBox(NULL,"Could Not Release hWnd.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
hWnd=NULL;
}
if (!UnregisterClass("OpenGL",hInstance))
{
MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
hInstance=NULL;
}
}
BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag)
{
GLuint PixelFormat;
WNDCLASS wc;
DWORD dwExStyle;
DWORD dwStyle;
RECT WindowRect;
WindowRect.left=(long)0;
WindowRect.right=(long)width;
WindowRect.top=(long)0;
WindowRect.bottom=(long)height;
fullscreen=fullscreenflag;
hInstance = GetModuleHandle(NULL);
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = (WNDPROC) WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = "OpenGL";
if (!RegisterClass(&wc))
{
MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
if (fullscreen)
{
DEVMODE dmScreenSettings;
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
dmScreenSettings.dmSize=sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = width;
dmScreenSettings.dmPelsHeight = height;
dmScreenSettings.dmBitsPerPel = bits;
dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)
{
if (MessageBox(NULL,"The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?","NeHe GL",MB_YESNO|MB_ICONEXCLAMATION)==IDYES)
{
fullscreen=FALSE;
}
else
{
MessageBox(NULL,"Program Will Now Close.","ERROR",MB_OK|MB_ICONSTOP);
return FALSE;
}
}
}
if (fullscreen)
{
dwExStyle=WS_EX_APPWINDOW;
dwStyle=WS_POPUP;
ShowCursor(FALSE);
}
else
{
dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
dwStyle=WS_OVERLAPPEDWINDOW;
}
AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle);
// Create The Window
if (!(hWnd=CreateWindowEx( dwExStyle,
"OpenGL",
title,
dwStyle |
WS_CLIPSIBLINGS |
WS_CLIPCHILDREN,
0, 0,
WindowRect.right-WindowRect.left,
WindowRect.bottom-WindowRect.top,
NULL,
NULL,
hInstance,
NULL)))
{
KillGLWindow();
MessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
static PIXELFORMATDESCRIPTOR pfd=
{
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW |
PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
bits,
0, 0, 0, 0, 0, 0,
0,
0,
0,
0, 0, 0, 0,
16,
0,
0,
PFD_MAIN_PLANE,
0,
0, 0, 0
};
if (!(hDC=GetDC(hWnd)))
{
KillGLWindow();
MessageBox(NULL,"Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
if (!(PixelFormat=ChoosePixelFormat(hDC,&pfd)))
{
KillGLWindow();
MessageBox(NULL,"Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
if(!SetPixelFormat(hDC,PixelFormat,&pfd))
{
KillGLWindow();
MessageBox(NULL,"Can't Set The PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
if (!(hRC=wglCreateContext(hDC)))
{
KillGLWindow();
MessageBox(NULL,"Can't Create A GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
if(!wglMakeCurrent(hDC,hRC))
{
KillGLWindow();
MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
ShowWindow(hWnd,SW_SHOW);
SetForegroundWindow(hWnd);
SetFocus(hWnd);
ReSizeGLScene(width, height);
if (!InitGL())
{
KillGLWindow();
MessageBox(NULL,"Initialization Failed.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE;
}
return TRUE;
}
LRESULT CALLBACK WndProc( HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
switch (uMsg)
{
case WM_ACTIVATE:
{
if (!HIWORD(wParam))
{
active=TRUE;
}
else
{
active=FALSE;
}
return 0;
}
case WM_SYSCOMMAND:
{
switch (wParam)
{
case SC_SCREENSAVE:
case SC_MONITORPOWER:
return 0;
}
break;
}
case WM_CLOSE:
{
PostQuitMessage(0);
return 0;
}
case WM_KEYDOWN:
{
keys[wParam] = TRUE;
return 0;
}
case WM_KEYUP:
{
keys[wParam] = FALSE;
return 0;
}
case WM_SIZE:
{
ReSizeGLScene(LOWORD(lParam),HIWORD(lParam));
return 0;
}
}
return DefWindowProc(hWnd,uMsg,wParam,lParam);
}
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
BOOL done=FALSE;
if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO)
{
fullscreen=FALSE;
}
if (!CreateGLWindow("NeHe's Texture Mapping Tutorial",640,480,16,fullscreen))
{
return 0;
}
while(!done)
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if (msg.message==WM_QUIT)
{
done=TRUE;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
else
{
if ((active && !DrawGLScene()) || keys[VK_ESCAPE])
{
done=TRUE;
}
else
{
SwapBuffers(hDC);
}
if (keys[VK_F1])
{
keys[VK_F1]=FALSE;
KillGLWindow();
fullscreen=!fullscreen;
// Recreate Our OpenGL Window
if (!CreateGLWindow("NeHe's Texture Mapping Tutorial",640,480,16,fullscreen))
{
return 0;
}
}
}
}
KillGLWindow();
return (msg.wParam);
}
==================================================================================================
I'm really confused now coz I'm a newbie for this
<div class="ForumMod">modified on Saturday, November 22, 2008 12:53 AM</div>
|
|
|
|
|
sen pao wrote: A comment would be a real help. Please try to compile and run the code to see what's going on.
While you may get lucky, it's doubtful that you'll get any takers on this. You need to narrow the problem down to a small handful of relevant lines and then start asking specific questions. As is it right now, most folks will just ignore this big bunch of code.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I'm so sorry coz this is my first post. I just in hurry and then copy paste my problem to this thread. Please help me. I can't solve it.
|
|
|
|
|
Hi,
I am new to Visual C++/.Net, I have a simple question. I have a DatePickerTime object which I need to display future date in days (i.e. if you pick 11/21/2009, I will display 365 days).
I have managed to compute my 365 days but I am not able to assign the char* to the label Text
i.e. Sysytem::String ^
Can anyone help me? Thanks in advance
|
|
|
|
|
Label->Text = days->ToString();
By the way there is a separate forum for Managed C++.
-Saurabh
|
|
|
|
|
Thanks, but this does not work. I need to compute the numeric day toString() gives me 11/22/2009 but I need 365.
|
|
|
|
|