|
This works for me:
import "oaidl.idl";
import "ocidl.idl";
[
uuid(D39DD965-FC96-4C0A-AA62-CA3F5F117685),
version(1.0),
helpstring("cccc 1.0 Type Library")
]
library ccccLib
{
importlib("c:\Program Files\Common Files\System\ado\msado15.dll");
[
object,
uuid(7CD26371-4A6B-4234-A024-6690A53CA450),
nonextensible,
helpstring("Itest Interface"),
pointer_default(unique)
]
interface Itest : IUnknown
{
HRESULT DoSomething([in]_Connection* c);
HRESULT GetCount([in]_Recordset* rs, [out]int* num);
};
importlib("stdole2.tlb");
[
uuid(F8AAE058-76E9-4F2C-995A-FB5B6565CED6),
helpstring("test Class")
]
coclass test
{
[default] interface Itest;
};
};
Alternatively, remove the importlib statement and add
import "MSADO15.idl";
either in or out of the library's scope. Both of these have worked for me
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I will be crazy
the problem still with me !!! i have done all but no result for me !!!
|
|
|
|
|
Can you post more of your IDL? I wonder if there's something else causing this not to work
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
#pragma once
import "oaidl.idl";
import "ocidl.idl";
[
uuid(DADD8BCB-AAE5-4E88-9K06-1C991A2B77E4),
version(1.0),
helpstring("DllService Type Library")
]
library DllService Lib
{
importlib("C:\Program Files\Fichiers communs\System\ado\msado15.dll");
importlib("stdole2.tlb");
[
uuid(EC6DA8D8-DB33-4b29-BBED-8BDDC055D1E4),
version(1.0),
helpstring("Enum for UserType: enGroupType(0) - Group, enUserType(1) - User, enAdministaratorType(2) - Administrator")
]
typedef enum EUserType
{
enGroupType = 0,
enUserType = 1,
enAdministaratorType = 2
} _EUserType;
.
.
.
[
uuid(38570D0E-A46E-4A43-85DB-2A305D7667A7),
helpstring("_SAC_Session Class")
]
coclass _SAC_Session
{
[default] interface _ISAC_Session;
};
.
.
.
};
.
.
.
interface _ISAC_Session;
.
.
.
[
object,
uuid(148359B4-5D7E-4B7F-82F3-0E8FDBDA0D5D),
dual,
nonextensible,
helpstring("_ISAC_Session Interface"),
pointer_default(unique)
]
interface _ISAC_Session : IDispatch{
.
.
.
[id(24), helpstring("get ado connection")] HRESULT get_ADOConnectionObject([in,out] _Connection **ppAdoConnection);
};
i hope that can you find something.
|
|
|
|
|
Spotted it. You define _ISAC_Session OUTSIDE the library, so it cannot see the ADO definitions brought in by the importlib statement, as that is wihtin the library definition.
Changing the importlib to an import statement OUTSIDE the library definition will fix your error. Here's the sample code you posted, modified so it'll work. I've highlighted the import statement I added.
#pragma once
import "oaidl.idl";
import "ocidl.idl";
<big>import "msado15.idl";</big>
[
uuid(DADD8BCB-AAE5-4E88-9306-1C991A2B77E4),
version(1.0),
helpstring("DllService Type Library")
]
library DllServiceLib
{
importlib("stdole2.tlb");
[
uuid(EC6DA8D8-DB33-4B29-BBED-8BDDC055D1E4),
version(1.0),
helpstring("Enum for UserType: enGroupType(0) - Group, enUserType(1) - User, enAdministaratorType(2) - Administrator")
]
typedef enum EUserType
{
enGroupType = 0,
enUserType = 1,
enAdministaratorType = 2
} _EUserType;
[
uuid(38570D0E-A46E-4A43-85DB-2A305D7667A7),
helpstring("_SAC_Session Class")
]
coclass _SAC_Session
{
[default] interface _ISAC_Session;
};
};
interface _ISAC_Session;
[
object,
uuid(148359B4-5D7E-4B7F-82F3-0E8FDBDA0D5D),
dual,
nonextensible,
helpstring("_ISAC_Session Interface"),
pointer_default(unique)
]
interface _ISAC_Session : IDispatch{
[id(24), helpstring("get ado connection")] HRESULT get_ADOConnectionObject([in,out] _Connection **ppAdoConnection);
};
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thank you very much for your help.
One more thing i would ask, this statment have no effect in other classes if i use a rename_namespace?
like Internal ?
|
|
|
|
|
I've got no idea - sorry.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
THANK YOU VERYYYYYYYYYY MUCH
it work
you saved me really
|
|
|
|
|
Good - glad I could help!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
I'm surprised today when i build my dll and i have found many error almost are like this:
c:\sac\see_ac_services\debug\msadox.tli(245) : error C2065: '_result' : undeclared identifier
and the same error for other types like :
c:\sac\see_ac_services\debug\msadox.tlh(495) : error C2327: 'ADOX::_Index::Properties' : is not a type name, static, or enumerator
I don't know where is the mistake, i dont know how can i find the solution for this !!!!!!!
Have you an idea ?
|
|
|
|
|
Sounds like you need to #import the dependencies of your library - try adding the auto_search attribute to your #import statement.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Please can you explain more for me, i don't understand you ?
|
|
|
|
|
You're obviously using #import somewhere to reference a type library (the .tli and .tlh makes that quite clear). Here's a #import (for Excel) that uses auto_search:
#import "libid:00020813-0000-0000-C000-000000000046" auto_search
Replace the libid I've used with the type library reference you're using.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
you mean that i replace libid:00020813-0000-0000-C000-000000000046 by msado15.idl ?
|
|
|
|
|
msado15.idl? No.
I'm not talking about your IDL file any more. Somewhere in one of your .cpp files, there is a #import statement that defines a reference to a COM object. THAT #import statement is the one that needs modification.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Yes , i havelike this:
#import "C:\Program Files\Fichiers communs\System\ado\msado15.dll" rename_namespace("Internal") rename( "EOF", "EndOfFile" )
#import "C:\Program Files\Fichiers communs\System\ado\msadox.dll"
so can you help me how do this ?
Thank you
|
|
|
|
|
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?
|
|
|
|
|