|
Here goes the definition file you've mentioned
But i don't understand why the program is giving those errors... I'm using Win32...
#ifndef __COMPILER_H
#define __COMPILER_H
//-----------------------------------------------------------------------------
//
//Windows Compiler specific section: This should be extracted to the
//SMAlib system for compiler specific definitions. But first do it here....
//
//-----------------------------------------------------------------------------
//##### Microsoft Compiler specific #####
#if defined ( _MSC_VER ) || defined ( MSVCPP )
//to reduce some define stuff...
#define USING_MICROSOFT_COMPILER
//don't ask....
#if defined(_DLL) || defined (_WINDLL)
#define __DLL__ 1
#endif
//building an DLL? => Mark functions with "export"
//building host => Mark functions with "import"
#ifdef __DLL__
#define SHARED_FUNCTION __declspec(dllexport)
#else
#define SHARED_FUNCTION __declspec(dllimport)
#endif
//disable all deprecation warnings,
#if (_MSC_VER >= 1400) // VC8+
#pragma warning(disable : 4996)
#endif
//define it for the rest....
#ifndef __WIN32__
#define __WIN32__ 1
#endif
#endif
//##### Borland C++Builder specific #####
#ifdef __BORLANDC__
//building an DLL? => Mark functions with "export"
//building host => Mark functions with "import"
#ifdef __DLL__
#define SHARED_FUNCTION __declspec(dllexport)
#else
#define SHARED_FUNCTION __declspec(dllimport)
#endif
//for precompield head with borland compilers...stop caching here...
#pragma hdrstop
#endif
//##### GNU C compiler specific Windows #####
#ifdef __GNUC__
#ifdef _WIN32
//__cdecl or winapi
#define SHARED_FUNCTION __cdecl
#else
/* U*nix: Linux/NetBSD/SOLARIS/... */
#define SHARED_FUNCTION
#endif
#endif
#endif /*__COMPILER_H*/
Best Regards.
|
|
|
|
|
Please compile it with the /E option to see the expanded value of 'SHARED_FUNCTION '.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks! I already detect the problem. It was the compiler selection. The program wasn't doing it.
Best regards.
|
|
|
|
|
hi all....
I Need 2 Store the EMPLOYEE INFO of a COMPANY....
im not allowed to use DATABASE...
what else can i use?
I Can Use FILES....
Other than Files What all Can I Use...
Ive To Code In VC++ MFC
|
|
|
|
|
anna mathew wrote: Other than Files What all Can I Use...
PAPER.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
in INI file i can store data in a proper method like in database...
is there something else...i mean any other file...
that can store data in a PARTICULAR FORMAT?
|
|
|
|
|
There are a lot of options, depending on many factors.
You may for instance use a XML file.
If you need to be compact (XML is verbose) you may choose a (custom) binary file (if you're using MFC , have a look at Serialization in MFC [^] topic.
SQLite [^] being serverless, maybe another option.
...
Bottom line: there are a lot of options, you've to be more detailed in your requirements to end up with the proper solution.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thank you 4 your reply...
XML is a good choice...but little complicated with MFC...
Heard INI files is a good choice...
Can u tell me how to do it?
I mean HOW TO WRITE EMPLOYEE INFO OF A COMPANY
to INI file.....
and read it back
|
|
|
|
|
anna mathew wrote: XML is a good choice...but little complicated with MFC...
You may use MSXML or other libraries, there are lot of them around.
anna mathew wrote: Heard INI files is a good choice...
Serialization is far better. Anyway, if you want to use INI files, then you have use the functions (GetPrivateProfileInt ,...) listed at the bottom of this page [^].
Check out also this article [^].
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
If you know STL, vector would handle your needs.
A C++ programming language novice, but striving to learn
|
|
|
|
|
Thank You so much....
That Was a GREAT Answer.....
|
|
|
|
|
When I went through STL VECTOR....
I found Another one too...
That can be used for the same....
STL MAP
|
|
|
|
|
Read the information in MSDN on the different "containers", ie, vector, list quene(MS?),map and muti-Map. Then you can make an informative decision as to which "container" will suit your needs. Enjoy!!
A C++ programming language novice, but striving to learn
|
|
|
|
|
If you email me directly (larryamillssr@hughes.net) I'll send you some production code showing you how to create a vector, use that vector, save that vector's data and how to retrieve it back and put it into a vector.
A C++ programming language novice, but striving to learn
|
|
|
|
|
It stores data only temporarily
|
|
|
|
|
anna mathew wrote: Other than Files What all Can I Use...
Whether you use a database, an INI file, the registry, or some text file, they are all still files. You have no choice but to use a file. What kind of file is still debatable.
Are you wanting persistent storage, or just an in-memory data structure?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
You can use of text files or use of xml files or pdf files.
|
|
|
|
|
Hi there,
I've been trying a hook notepad using SetWindowsHookEx function and the WH_GETMESSAGE message but to no avail.
Below is my current running code. My code compiles and run, the problem is that the
LRESULT WINAPI GetMsgProc(UINT nCode, WPARAM wParam, LPARAM lParam) function is never called.
Can somebody please help as to why that function is never executed when I start/close notepad?
#define WIN32_LEAN_AND_MEAN // trim the excess fat from Windows
#include <stdlib.h>
#include <crtdbg.h>
#include <windows.h>
#include <windowsx.h>
#include <tchar.h>
#include <stdio.h>
#include <string.h>
#include <locale.h>
#include "Resource.h"
LRESULT WINAPI GetMsgProc(UINT, WPARAM, LPARAM);
BOOL CALLBACK DlgProc(HWND, UINT, WPARAM, LPARAM);
HWND hWndMainDialog;
HHOOK hIISHook;
HINSTANCE hinstDLL;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
BOOL bOK = FALSE;
hinstDLL = LoadLibrary((LPCTSTR) _T("c:/WINDOWS/system32/notepad.exe"));
hIISHook = SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc, hinstDLL, 0);
bOK = (hIISHook != NULL);
if (bOK)
{
MessageBox(NULL,_T("Low Level hook installed properly"), _T("Information"), MB_OK);
}else
{
UnhookWindowsHookEx(hIISHook);
MessageBox(NULL,_T("Error Installing Hook"), _T("Information"), MB_OK | MB_ICONSTOP);
}
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_IIS), NULL, DlgProc);
UnhookWindowsHookEx(hIISHook);
_CrtDumpMemoryLeaks();
return 0;
}
LRESULT WINAPI GetMsgProc(UINT nCode, WPARAM wParam, LPARAM lParam)
{
PMSG msg;
msg = (PMSG)lParam;
return CallNextHookEx(hIISHook, nCode, wParam, lParam);
}
BOOL CALLBACK DlgProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
BOOL b;
switch(Msg)
{
case WM_INITDIALOG:
hWndMainDialog = hWnd;
return TRUE;
case WM_COMMAND:
switch(HIWORD(wParam))
{
case BN_CLICKED:
switch(LOWORD(wParam))
{
case IDC_BTN_PROCESS:
b = FALSE;
if(!b)
{
MessageBox(NULL,_T("Button has been clicked"), _T("Information"), MB_OK | MB_ICONSTOP);
return;
}
break;
}
break;
}
return TRUE;
case WM_CLOSE:
PostQuitMessage(0);
return TRUE;
case WM_DESTROY:
PostQuitMessage(0);
return TRUE;
}
return FALSE;
}
</locale.h></string.h></stdio.h></tchar.h></windowsx.h></windows.h></crtdbg.h></stdlib.h>
|
|
|
|
|
u need to check the recvd messages of notepad in ur GetMsgProc().
and post a message to ur app when u recv the desired message.
|
|
|
|
|
use WH_CALLWNDPROC type instead of WH_GETMESSAGE
|
|
|
|
|
i have 6 COM dlls that are shared between 4 different versions of our product, more than one version can be installed at any one time. so in which directory do I put them?
is C:\Documents and Settings\All Users\Application Data\<company-name> a good one for putting dlls?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
If they are all the same, and are COM DLLs, they can reside anywhere. If each version of the app requires slightly different and incompatable versions of the DLLs, which means someone did not version the COM interfaces correctly and broke the "COM Contract", I would keep them in each app's install directory and have a bootstrapper register them when the app starts.
If the DLLs' interfaces are versioned correctly, you just have to keep the most recent version somewhere and register it.
If you go the APPDATA route, be sure to select a suitable subdirectory.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Thanks for the helpful answer
I will probably put the files in "C:\Documents and Settings\All Users\Application Data\<company name="">\". The required dll versions are the same - the files in the different versions are exact duplicates.
Anyway, my problem was with the registry - because we have a standard and 'pro' version, if user installs standard version, then pro, then uninstalls pro, standard will stop working. Standard has the dlls in its own directory in Program Files, but pro has overwritten the registry entries to point to its dlls, which are now gone. So I'm going have a single directory for these COM dlls to solve the problem.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
sashoalm wrote: is C:\Documents and Settings\All Users\Application Data\ a good one for putting dlls?
Sure, why not?
But it's a strong recommendation that you create a folder below that path with your company name and place the files in that folder.
However, this only takes care of the issues regarding how to access those shared files and where to put them and since they are COM servers it doesn't matter where they're located.
You also have to consider how they will be installed and un-installed and whether or not you will have an installation wizard at your aid such as Wise or InstallShield.
To be able to know when to unregister the COM servers and remove those files, you should make DWORD-entries in the registry below the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDlls key where the value reflects the reference count. This means that the DWORD value tells how many installed applications will make use of the shared file. When you install you increase that number and consequently you decrease the value when you un-install. When the value reaches zero you unregister the COM server with RegSvr32, or similar, and remove the file and the registry entry.
This can be done automatically with a wizard, but if you're not using one you can do this by yourself.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi all,
Can someone explain what's the difference between the followings.
int freeLib = FreeLibrary(m_hwnd_Lib);
int freeLib = ::FreeLibrary(m_hwnd_Lib);
Thanks
I appreciate your help all the time...
CodingLover
|
|
|
|
|