|
Much thanks to Peter Molnar for mailing me a completely trivial DevStudio project containing a DllMain() that got properly invoked. What I was missing (and what I had never seen documented) was the APIENTRY declaration for the DLL entry point function. The DllMain must be declared like this:
BOOL APIENTRY DllMain(HINSTANCE , DWORD , LPVOID )
Once those 8 pesky characters were added, it worked great.
Also, for those who care, this works independently of the application type (i.e., works for both console apps and windows apps) and (as Peter said in an earlier message on this thread) works independently of how the library is loaded. (I.e., you can use either load-time dynamic linking or run-time dynamic linking.)
Matt
|
|
|
|
|
If this is VC6: in the Link tab, select the Output category, and ensure that Entry Point Symbol is either blank or set to _DllMainCRTStartup. You should also check that the /NOENTRY switch is not specified.
Both of you: be careful with your dependencies. The only routines you can guarantee will be initialised before your entry point is called are those implemented by KERNEL32.DLL . You should also be able to call C library functions if you're linking with the C run-time.
|
|
|
|
|
I have a floating CDialogBar whose caption I can't seem to change with SetWindowText. Does anyone know how to change the caption text?
Thx,
|
|
|
|
|
|
I am having a difficult time with the following project:
http://www.cse.psu.edu/~cg103/NewHW/proj3.pdf
http://www.cse.psu.edu/~cg103/NewHW/alice.txt
Can anyone toss me a hint (pseudocode would be great!).
|
|
|
|
|
Anonymous wrote:
I am having a difficult time with the following project:
Are you having a difficult time, or have you not started and are running out of time?
The encyption algorithm has been given to you:
"For a given message, we substitute each lowercase character to the other character
whose ASCII code is less than 6."
This tells you that you can ignore any characters that aren't lower case letters (ie you only need to encrypt chars whose ascii values are between 97 and 122, inclusive)
So, a high-level step-by-step process list could be:
1) Get next character
2) Is it a lower case letter?
No: Store it as is
Yes: subtract 6 and then store it
3) Is it the last character?
No: GOTO #1
Yes: EXIT
In pseudocode:
OPEN input file
LOOP
GET character from file
IF character is lower case letter
subtract 6 from it
STORE character
IF end of file
EXIT LOOP
END LOOP
CLOSE input file
OPEN output file
LOOP
GET encypted character
WRITE encrypted character
IF end of encypted characters
EXIT LOOP
END LOOP
CLOSE output file
|
|
|
|
|
I am creating a dll (non-MFC). I am getting linker errors from the .exe that is trying to link with it.
The linker is complaining about the static class variables, unresolved external symbol. How am I to "decorate" them? I've tried using __declspec(dllexport) but haven't had much luck.
Thanks
|
|
|
|
|
Well, I finally got it figured out, in case anybody is curious.
The compiler directive should be dllexport when compiling the dll, and dllimport when compiling the exe.
#ifdef _DLL_
#define DLL_GLOBAL __declspec(dllexport)
#else
#define DLL_GLOBAL __declspec(dllimport)
#endif
|
|
|
|
|
if i calloc() a buffer and write data into it and then later copy other data into it that is shorter than the original data (and zero terminated) will the entire original buffer be freed properly when i call free() on it?
"there is no spoon" biz stuff about me
|
|
|
|
|
|
|
That is my understanding. It is also my understanding that night will be followed by day in the coming hours. I could be mistaken about one or the other or both, but I'm fairly certain about both.
Matt
|
|
|
|
|
Edit: I'm not using MFC BTW
I made a blank DLL project, copied my resources over to the DLL compiled, everything is fine...
I then loaded my resource DLL inside my app...it's load fine...but nothing is showing...obviously my resources need special attention when stored in a DLL...
What steps do I have to take to make sure my Dialogs, Menus, etc...load...and are shown...?
Thanks
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
|
|
Thats what the problem was...
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
I see this in a sample on CP for a CStatusbar derived class. But I cant figure out how to get the classwizard to add the afx_msg UINT OnNcHitTest(CPoint point) handler . This class CTextualStatusBar doesnt show up in the class wizard. SO I thought maybe if I right click in the left panel classview window on this class and get "Add windows message handler" I migtht be able to do it that way. But for this class, that menu item isnt in the context menu. Yet this handler is in the afx area and its grey which means the wizard generated it. AM I overlooking something obvious?
Thanks.
ns
class CTextualStatusBar : public CStatusBar
{
public:
CTextualStatusBar();
public:
virtual ~CTextualStatusBar();
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnDestroy();
afx_msg UINT OnNcHitTest(CPoint point);
DECLARE_MESSAGE_MAP()
};
|
|
|
|
|
I would just add the handler manually.
ClassWizard can behave in a severely brain damaged manner, especially when the class files don't exist in the project's root folder.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
I need to pass Command line arguments to my MFC wizard created app and store the values in a local variable .
Where can i trap these values in code ?
I need something like
main(int argc ,char *argv[])
Please help
|
|
|
|
|
See CWinApp::m_lpCmdLine .
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
|
CRT ?
Engineering is the effort !
|
|
|
|
|
|
see the following MFC stuff:
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
After the call to ParseCommandLine() everything will be placed in to cmdInfo.
So Hum
|
|
|
|