|
li zhiyuan wrote: also put header file in main function....
A missing or incorrect header file would yield a preprocessor/compiler error, not a linker error.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi ,
I developing an application that hooks the Open/Save dialog for getting the selected file path. currently am able to hook the common dialog but it's not working on office Open/Save dialog. On Searching i found that Office is using separate Open/Save dialog. Can anyone help me to identify the Office Open/Save dialog messages equivalent that of common dialog's
CDN_FILEOK
CDN_INITDONE
CDM_GETFILEPATH
CDM_GETFOLDERIDLIST
CDM_GETFOLDERPATH
CDM_GETSPEC
CDM_HIDECONTROL
CDM_SETCONTROLTEXT
CDM_SETDEFEXT
?
thanks
Nitheesh
|
|
|
|
|
void CAppplicationLanucherDlg::OnOpen()
{
// TODO: Add your control notification handler code here
CString str,fstr;
char strFilter[] = { "All Files (*.*)|*.*|" };
CFileDialog FileDlg(TRUE, ".All Files", NULL, 0, strFilter);
if( FileDlg.DoModal() == IDOK )
{
str=FileDlg.GetPathName();
HINSTANCE ht=ShellExecute(handle, "open", str, NULL, NULL, SW_SHOWNORMAL);
long i=(long)ht ;
if(i==SE_ERR_NOASSOC)
WinExec("rundll32.exe shell32.dll, OpenAs_RunDLL " +str, SW_SHOWNORMAL);
}
}
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
the user password is the login password.
|
|
|
|
|
|
|
NET_API_STATUS st = NetUserChangePassword( 0, L"User name", L"old pwd", L"new pwd" );
|
|
|
|
|
Hi,
I guess I tried in the subject matter to explain the problem
let me say before I describle the problem that I am using a few of the same headers .h files in both The C and C++
project
In the begining when I was getting unresolved extern __declspec from the link trying to import C symbols
into my C++ project I thought it had something to do with were I specfied my LIB file (I am using VS 2005 )
Linker -> General then the specfic .Lib under Linker -> Additional inputs
Now however I getting the Idea that a part of this problem is that I have C++ project importing C symmbols
When I declare the imports as extern "C" __declspec(dllimport) in the C++ project I resolve a few of the externs
However I still get unresolved ___impl_func
seems __impl is added to C export but linking the C++ project it doesn't see these names
would doing the following when building the C exports in the C++ projects Help
#ifdef __cplusplus
DLL_EXPORT __cdecl telling the C++ compiler that this is C export
Maybe there is simeple soultion to all of this if you know any please Share
Thankx
|
|
|
|
|
How are the C items exported?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
real vinalla statement __declspec(dllexport) int func(...,)
this probelm has to do with mixed language import/export C/C++
But then again I am sure they DLL's written in other Languages e.g. VB wich use C/C++ DLL's
so what I doing is not that uncommon
However part of the problem is that I am including the same Headers in both the C/C++
So ......
If have gotten rid of most of the errors with the exception of some unresolved externs with a prefix of __imp
Which I understand the compiler appends to a C export When the Link of C++ reads the .Lib
generated by the linker of the C proj it cann't seem to match __imp_func
maybee I need to qualify the C DLL EXPORT (___imp_func ) wih something like __cdecl to make it drop the __imp
prefix
Dont know ???
thankx
|
|
|
|
|
I think you can drop the ___imp_func specifier and use standard __declspec(dllexport) .
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.
[my articles]
|
|
|
|
|
the __imp is generated by the compiler for DLL EXPORTS on a C build
Linking the C++ projects with .lib from C gives me the problem
|
|
|
|
|
ForNow wrote: However part of the problem is that I am including the same Headers in both the C/C++
That's what you should be doing IMO. Then you only make changes in one place.
How are you handling the dllimport/dllexport difference depending on the type
of module being built...with a macro?
You should be able to form your shared header something like this:
#ifdef MY_DLL_BUILD
#define MY_IMPORTEXPORT __declspec(dllexport)
#else
#define MY_IMPORTEXPORT __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C" {
#endif
MY_IMPORTEXPORT void SomeFunction();
#ifdef __cplusplus
}
#endif
Note that's a simplified solution. You may need more for certain
types of builds.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
coding that seems more stright foward I'll try it tommorow nite
thankx
|
|
|
|
|
According to MSDN, the default constructor for a GDI+ RectF class will initialize the X and Y members to zero. It doesn't say anything about the Width and Height members. Does anyone know if the Width and Height get set to zero? I did some quick testing and it appears so but I thought I'd ask around before relying on this possibility in case I was getting fooled somehow.
From MSDN:
******************************
RectF::RectF Constructor
Creates a RectF object and initializes the X and Y data members to zero. This is the default constructor.
|
|
|
|
|
Here's the source code...
RectF()
{
X = Y = Width = Height = 0.0f;
}
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Where'd you find that?
Is that in the header?
|
|
|
|
|
Oops, by the way...thanks
|
|
|
|
|
Heh I just traced into it in the debugger....it was quicker
at the moment then a text search. And yes, it's in the header...
gdiplustypes.h. Looks like the entire class is inline methods.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I see it now.
Boy I feel stupid.
Thanks for the guidance.
|
|
|
|
|
Hi All,
I am looking some code in a dll which is part of a project I inherited & see the following code in a CWinThread derived class:
<br />
BOOL CMyThread::InitInstance()<br />
{<br />
AfxEnableControlContainer();<br />
AfxOleInit();<br />
<br />
CoInitialize(NULL);<br />
<br />
AFX_MANAGE_STATE(AfxGetStaticModuleState());<br />
<br />
return TRUE;<br />
}<br />
Is it me, or does AFX_MANAGE_STATE() not belong here? The thread is instantiated from other plaes in code where AFX_MANAGE_STATE has already been called & there is no cross-thread communication w/ other threads or the calling process.
Is it common practice to call AFX_MANAGE_STATE from a CWinThread derived class's InitInstance() ?
Also, does it matter if I call CoInitialize/CoInitializeEx before calls to AfxEnableControlContainer()/AfxOleInit()?
Thanks!
|
|
|
|
|
Wes Jones wrote: Is it common practice to call AFX_MANAGE_STATE from a CWinThread derived class's InitInstance() ?
Only if the place in which it is called will be loading resources from the DLL.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hmm.. so if the InitInstance brought up a CDialog based class & called DoModal(), it'd be loading resources & it'd be a good idea to call this?
such as:
<br />
viod MyDll_ShowScreen()<br />
{<br />
AFX_MANAGE_STATE(...);
...<br />
AfxBeginThread( RUNTIME_CLASS(CMyThread) );<br />
}<br />
<br />
CMyThread::InitInstance()<br />
{<br />
AFX_MANAGE_STATE(....);
<br />
CMyDlg dlg(...);<br />
dlg.DoModal();<br />
<br />
PostThreadMessage(WM_QUIT,0,0);<br />
return TRUE;<br />
}<br />
<br />
MyDll_ShowScreen();<br />
|
|
|
|
|
Yes, otherwise the InitInstance() method would be looking for CMyDlg 's dialog template in the EXE that owns your DLL.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
My understanding is that AFX_MANAGE_STATE is it's on more of a module level, not so much on a per-thread level.
|
|
|
|