|
I had put auto_search in all #import statements in dll cpp files but also i have the same problem !!!!
Have you any idea please?
|
|
|
|
|
Really don't know - those two #import lines compile fine on my machine
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I read data from a bmp file,and use it as a texture,but it just failed,which work well on others' computer,My code is no problem.Any help is appreciated .Thanks!
|
|
|
|
|
Could you please give more explanation ? We don't even know how you are loading your texture, how you display it, ... Please post some (relevant) code too (and use the code block tag).
|
|
|
|
|

unsigned int ID;
int imageWidth;
int imageHeight;
unsigned char *image;
FILE *pFile = 0;
BITMAPINFOHEADER bitmapInfoHeader;
BITMAPFILEHEADER header;
unsigned char textureColors = 0;
pFile = fopen("桌面.bmp", "rb");
if(pFile == 0) return false;
fread(&header, sizeof(BITMAPFILEHEADER), 1, pFile);
if(header.bfType != BITMAP_ID)
{
fclose(pFile);
return false;
}
fread(&bitmapInfoHeader, sizeof(BITMAPINFOHEADER), 1, pFile);
imageWidth = bitmapInfoHeader.biWidth;
imageHeight = bitmapInfoHeader.biHeight;
if(bitmapInfoHeader.biSizeImage == 0)
bitmapInfoHeader.biSizeImage = bitmapInfoHeader.biWidth *
bitmapInfoHeader.biHeight * 3;
fseek(pFile, header.bfOffBits, SEEK_SET);
image = new unsigned char[bitmapInfoHeader.biSizeImage];
fread(image, 1, bitmapInfoHeader.biSizeImage, pFile);
for(int index = 0; index < (int)bitmapInfoHeader.biSizeImage; index+=3)
{
textureColors = image[index];
image[index] = image[index + 2];
image[index + 2] = textureColors;
}
fclose(pFile);
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glGenTextures(1, &ID);
glBindTexture(GL_TEXTURE_2D, ID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, imageWidth,
imageHeight, GL_RGB, GL_UNSIGNED_BYTE,
image);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);
glPushMatrix();
glScaled(45.0,30.0,0);
glBindTexture(GL_TEXTURE_2D, ID);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.0f, -1.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(-2.0f, 1.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 0.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 0.0f, -1.0f, 0.0f);
glEnd();
glPopMatrix();
GLvoid ReShapeGLScene( GLsizei width,GLsizei height )
{
glViewport(0,0,(GLsizei)width,(GLsizei)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho((GLdouble)-450.0,(GLdouble)450.0,(GLdouble)-300.0,(GLdouble)300.0,50.0,-10.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static PIXELFORMATDESCRIPTOR pfd =
{
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW|
PFD_SUPPORT_OPENGL|
PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
24,
0,0,0,0,0,0,
0,
0,
0,
0,0,0,0,
32,
0,
0,
PFD_MAIN_PLANE,
0,
0,0,0
};
The above is my code, and my GPU is nViDIA Geforce G210M
Thanks
|
|
|
|
|
What is your problem in fact ? Because you just said that it failed, that rather vague...
Anyway I see you are using OpenGL, make sure that the width and height of your images are a power of 2.
|
|
|
|
|
Hello Friends
From last some weeks I m tryiny to solve How to restore viewtype in a dialog.
Now,Using lpfnhook I m able to set the viewtype in a Dialog and here is the code below:
void test()
{
OPENFILENAME ofn;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_EXPLORER | OFN_ENABLEHOOK ;
ofn.lpfnHook = HookProcCenterDialog;
}
UINT_PTR CALLBACK HookProcCenterDialog( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
enum LISTVIEWCMD
{ ODM_VIEW_ICONS = 0x7029,
ODM_VIEW_LIST = 0x702b,
ODM_VIEW_DETAIL= 0x702c,
ODM_VIEW_THUMBS= 0x702d,
ODM_VIEW_TILES = 0x702e,
};
if ( message == WM_INITDIALOG )
{
HWND hParent = GetParent( hDlg );
HWND pshell = GetDlgItem(hParent,0x0461);
PostMessage(hDlg,MYWM_POSTINIT,0,0);
}
if ( message == MYWM_POSTINIT )
{
HWND hParent = GetParent( hDlg );
HWND pshell = GetDlgItem(hParent,0x0461);
if(pshell)
{
SendMessage(pshell,WM_COMMAND,0x702D,0);
}
}
if ( message == WM_CLOSE)
{
}
return FALSE;
}
on line 1 I m setting the thumbnail view using 0X702D,Similar I m having other command ID like 0X702B,0X702C for other view.
Now,my prob is how can I get the viewType on Wm_CLOSE so tht i can set it next time dialog is open.
I tried like this to get this value:
int ID;
view = (int) SendMessage(pshell,WM_COMMAND,ID,0);
but in ID,it is always returning same value for all views.
Plz suggest me some solution.
Thx in Advance.
|
|
|
|
|
yogeshs wrote: tried like this to get this value:
int ID;
view = (int) SendMessage(pshell,WM_COMMAND,ID,0);
but in ID,it is always returning same value for all views.
Plz suggest me some solution.
I explained this to you in an earlier question that you raised (exactly the same if I recall). Send Message will not set ID to anything, SendMessage is for sending messages and their associated parameters. I am also not aware of any method to get the view type from the dialog when it closes.
|
|
|
|
|
IS there any other method to get?
|
|
|
|
|
yogeshs wrote: IS there any other method to get?
Find the list control handle from the open file dialog and using the GetWindowLong() funcion, get the style of list control( report, thumbnail, list etc ).
|
|
|
|
|
yogeshs wrote: SendMessage(pshell,WM_COMMAND,0x702D,0);//LINE 1
It's not related to your problem, but why are you not using ODM_VIEW_THUMBS ? It seems pointless to declare LISTVIEWCMD if you aren't going to use it.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Thats Ok,But my problem is how to get VIew Type ?
I m not able to get viewtype.
|
|
|
|
|
yogeshs wrote: But my problem is how to get VIew Type ?
I m not able to get viewtype.
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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 All
I am using a ListBox and add Variable derive of CCheckListBox.i use a Check box that is use to select and UnSelct all items of ListBox.i handle it over ON_LBN_SELCHANGE of ListBox and Click event of Check box.
Selection and UnSelection from Checkbox working fine.
But problem occur when i use it by List box.i want to do when the all items of list box is checked then Select all Check box automatically Checked or vice-versa.
Code is here
CButton m_check;
CCeckListBox m_list1;
void CTestDlg::OnBnClickedCheckSelAll()
{
const int nSize = m_list1.GetCount();
if(m_Check.GetCheck())
for(int nItem = 0; nItem < nSize; nItem++)
{
m_list1.SetCheck(nItem,1);
m_list1.SetSel(nItem,1);
}
else
for(int nItem = 0; nItem < nSize; nItem++)
{
m_list1.SetCheck(nItem,0);
m_list1.SetSel(nItem,0);
}
}
void CTestDlg::OnLbnSelchangeListColumns()
{
int x=m_list1.GetSelCount();
int y=m_list1.GetCount();
if(x==y)
{
m_Check.SetCheck(1);
}
else
{
m_Check.SetCheck(0);
}
}
Properties setting of List Box Has String is TRUE,Owner Draw is FIXED,Selection is Multiple.
Problem is that when first time click on listbox then OnLbnSelchangeListColumns() is call and when i click on listbox on second time then OnLbnSelchangeListColumns is not call.
Plz help me
|
|
|
|
|
i used print function in my application it will print the contents of richedit control but i want to print whole dialog along with button and richedit control content in vc++,mfc.Anyone who knows this please help me.
|
|
|
|
|
Try PrintWindow[^].
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
|
its available open source libraries are in net ....
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
thank u 
|
|
|
|
|
|
hi Raju,
in this api convert single tiff page only......
in multiple pages it's not support, thanks for any way your suggestion
|
|
|
|
|
Hi All
A few qureies regardign ListControl
I m using List Control in report view.
Hence my list control is having around 5 columns
Say for if user selects a particular row i need to collect all data from the columns..
Kindly help me
Thanks in advance!!!
Regards
Gany
|
|
|
|
|
Well, handle the LVN_ITEMCHANGED[^] notification sent by the list control and use CListCtrl::GetItemText[^] (the subitem parameter is the index of your column) to collect the texts in the columns.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi. Well.. another time when i need help. I am trying to create a map (made of MPictureBox(my class derived from CButton)) in a thread. I am creating modal window and clicking "ok" button and creating map on my main window (CDialog). When i did it without threads all worked just fine. But when i put the creation in a thread it make it all very well... BUT! created buttons don't show up in the main window! (they exists in the memory but didn't show). I was thinking that probably it's some kind of problem related to using main window with different threads so i wrote this
CRITICAL_SECTION m_cs;
BOOL result2;
if (theApp.m_hThread!=NULL)
{
::InitializeCriticalSection(&m_cs);
::EnterCriticalSection(&m_cs);
result2 = this->FieldBox.Create(FieldState,fieldid,nIDResourse, ButStyle,BtSize, lpszCaption, dwStyle, rect, pParentWnd, nID, Rotate);
FieldBox.ShowWindow(SW_SHOW);
::LeaveCriticalSection(&m_cs);
::DeleteCriticalSection(&m_cs);
}
with 0 effect. Same trouble i had when i tryed to create some dynamic objects (with "= new ..."). Somebody had same trouble? What's the problem? (When i do the same thing without any thread it all results okey).. Pls help.
|
|
|
|
|
If this is MFC then its Window Maps are created per thread and a CWnd* object in one thread is not (easily) accessible in another. So doing UI stuff in worker threads is difficult. It is much easier to do this in the main app thread, and shuffle off any lengthy non-ui processing to worker threads.
|
|
|
|
|