|
DavidCrow wrote: enjoyed reading Code Complete by Steve McConnell
All developers should be familiar with this book or something comparable. But most developers are not.
Kevin
|
|
|
|
|
Hi Vikas,
Maybe this will guide you to a result:
<a href="http://books.google.co.za/books?q=Best+C%2B%2B+Book&ots=05wvPhjmZ-&sa=X&oi=print&ct=title">http:
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
yes i read one book very recently thats
C++ Gotchas: Avoiding Common Problems in Coding and Design
By Stephen C. Dewhurst
very good compilation!
May all beings be happy and free...
|
|
|
|
|
"Effective C++" (3rd Edition), and "Effective STL" by Scott Meyers are both very good.
Also, "Exceptional C++" by Herb Sutter is good at helping you avoid common mistakes.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
|
|
You should also probably read the desigh patterns book.
Regaredless of your progrmaming language, it is an essential read.
Any sufficiently gross incompetence is nearly indistinguishable from malice.
|
|
|
|
|
In a dll I dynamically load another dll and call some functions in there.
the problem is that I get an error:
The value of ESP was not properly saved across a function call. This is usualy a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention
So I understand I probably didn`t declare my function pointer correctly.
This is how I declare them
<br />
typedef void (*MY_FUNCPTR)(char*);<br />
MY_FUNCPTR myFunc;<br />
...<br />
<br />
myFunc = (MY_FUNCPTR)GetProcAddress(g_hMyDLL,"aFunction");<br />
myFunc("a string");
I tried adding extern "C" before the myFunc, doesn^t work... I think I need to put something in the typedef, but I can`t remember what... Does anybody know how I can fix this?
Thanks for any help,
Davy
|
|
|
|
|
typedef void __stdcall (*MY_FUNCPTR)(char*)
or
typedef void __cdecl (*MY_FUNCPTR)(char*)
will probably do it.
Steve S
Developer for hire
|
|
|
|
|
Just to be clear, these do very different things on x86!
If dynamically loading a Windows API, use WINAPI or CDECL as documented in MSDN Library. Almost all Windows API functions use WINAPI (== __stdcall on x86).
On compilers for non-x86 processors, there is no difference since Microsoft has defined a single calling convention for all functions to use.
|
|
|
|
|
and it did it
thanks for the help
|
|
|
|
|
GDavy wrote: Does anybody know how I can fix this?
Are you using the __stdcall calling convention?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
For whatever it is worth, if you ever need to solve this problem when calling a third-party DLL for which you can not change the information (source or header files), you can always push the ESP using inline assembly and pop it after calling the function. This is what we did, and it works well also.
Any sufficiently gross incompetence is nearly indistinguishable from malice.
|
|
|
|
|
That was it!
I needed to put the __stdcall in the function pointer typedef.
Thanks for your help.
|
|
|
|
|
I need to implement some Kind of Authentication for my RPC-Calls, since Microsoft has "improved" Security in SP2 so tightly, that basically nothing works anymore. I want to use the "ncacn_ip_tcp" Protocoll-Sequence. I tried entering Authentication-Information, on Server-Side using RpcServerRegisterAuthInfo with a Security Principal Name generated by DsMakeSpn, and on Client-Side using RpcBindingSetAuthInfo with the same Principal Name. The SEC_WINNT_AUTH_IDENTITY was filled with the Data for a valid User Account that has, i think, all requeired Authorizations on the Server Machine.
Now everytime i connect i get an Error Code 5 "Access Denied". I looked a little, and found that there supposedly is a Bug, making Windows convert the Error 1717 "Unknown Interface" wrongly into "Access Denied". I am not shure though. Anyway, I am completely at a loss, since there is no kind of Tutorial or Sample i could find, showing me what to do. I would just appreciate a Code Sample just showing me how to do it. I mean, there has to be a way.
|
|
|
|
|
Hy there.
I have problem showing a dialog from dinamicaly loaded .dll. I use MFC both for my application and for it's plug-ins (dll). And when i try to display dialog from my dll using function ShowDialogFromDll i don't get anithing.
Pls help. Thanks in advance.
|
|
|
|
|
Do you have a RichTextCtrl on your Dialog. If so, you must call AfxInitRichEdit() or AfxInitRichEdit2() before calling your function.
|
|
|
|
|
I'm not using rich text. It's blank dialog.
|
|
|
|
|
If the dialog resource is actually in the DLL, have you included the following in your ShowDialogFromDll() function:
AFX_MANAGE_STATE(AfxGetStaticModuleState());
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
But when i put AFX_MANAGE_STATE(AfxGetStaticModuleState()) before my dialog showing code it crashes my program. I get an assetion in WINCORE.CPP line: 884. It crashes because my DLL app does not have a main window. Damn
|
|
|
|
|
Show your ShowDialogFromDll() code.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
call MFC macro AFX_MANAGE_STATE, before calling any of the MFC functions
May all beings be happy and free...
|
|
|
|
|
I tried now creating a modeles dialog and it went fine but i need modal dialog Darn Any ideas now?
|
|
|
|
|
Show the code, how you are invoking the dialog?
|
|
|
|
|
First i am using function PlugInProc for exporting PlugIn class. In that class i have a function called ImportFile:
BOOL CPlugIn::ImportFile(CString sFile)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CImpOpts dlg;
dlg.DoModal();
return TRUE;
}
And when i call this class function from my main application it crashes. And i know why but i don't know how to fix it. Windows figures that CImpOpts is a part of my main application and tries to load dialog resource (IDD_IMPOPTS) from my main app, but resource is found in my dll.
Once again, i am exporting whole class from my dll using this function:
CMy3dsImpApp theApp;
CPlugIn plg; // CPlugIn is of type MPlugIn
extern "C" MPlugIn* PASCAL EXPORT PlugInProc()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return &plg;
}
I can show modeles dialogs, but i need modal dialog (because i need to stop execution of main application code 'till i do specific code in my plugin).
|
|
|
|